From 662c3f87d076f0a70057672b597033d9d11acc45 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Sat, 3 Mar 2018 14:33:05 +0100 Subject: [PATCH] fix --- src/core/settings.coffee | 8 ++++++-- src/packages/CoreServices/Spotlight.coffee | 21 +++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/core/settings.coffee b/src/core/settings.coffee index 2b79ebe..224c84b 100644 --- a/src/core/settings.coffee +++ b/src/core/settings.coffee @@ -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 \ No newline at end of file diff --git a/src/packages/CoreServices/Spotlight.coffee b/src/packages/CoreServices/Spotlight.coffee index c27e460..74be973 100644 --- a/src/packages/CoreServices/Spotlight.coffee +++ b/src/packages/CoreServices/Spotlight.coffee @@ -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