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"
for k, v of _OS.setting.system.packages when v.app
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
for m in v.mimes
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
return ar

View File

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