This commit is contained in:
Xuan Sang LE 2018-03-03 14:33:05 +01:00
parent f5d4e87828
commit 662c3f87d0
2 changed files with 17 additions and 12 deletions

View File

@ -49,10 +49,14 @@
term = new RegExp t, "i" term = new RegExp t, "i"
for k, v of _OS.setting.system.packages when v.app for k, v of _OS.setting.system.packages when v.app
if (v.name.match term) or (v.description and v.description.match term) if (v.name.match term) or (v.description and v.description.match term)
ar.push v v1 = {}
v1[k1] = e for k1, e of v when k1 isnt "selected"
ar.push v1
else if v.mimes else if v.mimes
for m in v.mimes for m in v.mimes
if t.match (new RegExp m, "g") if t.match (new RegExp m, "g")
ar.push v v1 = {}
v1[k1] = v[k1] for k1, e of v when k1 isnt "selected"
ar.push v1
break break
return ar return ar

View File

@ -9,7 +9,6 @@ class SpotlightDialog extends this.OS.GUI.BaseDialog
me = @ me = @
@height = ($ @scheme).css("height") @height = ($ @scheme).css("height")
@container = @find "container" @container = @find "container"
@container.set "selected", -1
console.log "new dia" console.log "new dia"
($ @scheme).css("height", "45px") ($ @scheme).css("height", "45px")
#fn = (e) -> #fn = (e) ->
@ -17,7 +16,14 @@ class SpotlightDialog extends this.OS.GUI.BaseDialog
# ($ document).unbind "keyup", fn # ($ document).unbind "keyup", fn
# me.handler(e) if me.handler # me.handler(e) if me.handler
#($ document).keyup fn #($ document).keyup fn
($ document).click @clickHandler
@fn1 = (e) ->
if not $(e.target).closest(me.scheme).length
($ document).unbind "click", me.fn1
me.handler(e) if me.handler
me.quit()
($ document).click @fn1
@searchbox = @find "searchbox" @searchbox = @find "searchbox"
($ @searchbox).focus() ($ @searchbox).focus()
($ @searchbox).keyup (e) -> ($ @searchbox).keyup (e) ->
@ -26,15 +32,10 @@ class SpotlightDialog extends this.OS.GUI.BaseDialog
return if e.data.dataid and e.data.dataid is "header" return if e.data.dataid and e.data.dataid is "header"
me.handler(e) if me.handler me.handler(e) if me.handler
me._gui.openWith e.data me._gui.openWith e.data
($ document).unbind "click", me.clickHandler ($ document).unbind "click", me.fn1
me.quit() me.quit()
clickHandler: (e) ->
me = @
if not $(e.target).closest(me.scheme).length
($ document).unbind "click", me.clickHandler
me.handler(e) if me.handler
me.quit()
search: (e) -> search: (e) ->
switch e.which switch e.which
@ -55,7 +56,7 @@ class SpotlightDialog extends this.OS.GUI.BaseDialog
return if sel.dataid and sel.dataid is "header" return if sel.dataid and sel.dataid is "header"
@.handler(e) if @.handler @.handler(e) if @.handler
@._gui.openWith sel @._gui.openWith sel
($ document).unbind "click", @clickHandler ($ document).unbind "click", @fn1
@.quit() @.quit()
else else
text = @searchbox.value text = @searchbox.value