diff --git a/src/core/BaseModel.coffee b/src/core/BaseModel.coffee index c3bc227..7d27706 100644 --- a/src/core/BaseModel.coffee +++ b/src/core/BaseModel.coffee @@ -35,7 +35,7 @@ class BaseModel trigger: (e, d) -> @observable.trigger e, d - subscribe: (e, f) -> + subscribe: (e, f) -> _courrier.on e, f, @ openDialog: (d, f, title, data) -> @@ -46,6 +46,7 @@ class BaseModel @error "Dialog #{d} not found" return @dialog = new _GUI.subwindows[d]() + #@dialog.observable = riot.observable() unless @dialog @dialog.parent = @ @dialog.handler = f @dialog.pid = @pid diff --git a/src/packages/CoreServices/Spotlight.coffee b/src/packages/CoreServices/Spotlight.coffee index 2a0ef85..c27e460 100644 --- a/src/packages/CoreServices/Spotlight.coffee +++ b/src/packages/CoreServices/Spotlight.coffee @@ -9,19 +9,15 @@ 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) -> # if e.keyCode is 27 # ($ document).unbind "keyup", fn # me.handler(e) if me.handler #($ document).keyup fn - - fn1 = (e) -> - if not $(e.target).closest(me.scheme).length - ($ document).unbind "click", fn1 - me.handler(e) if me.handler - - ($ document).click fn1 + ($ document).click @clickHandler @searchbox = @find "searchbox" ($ @searchbox).focus() ($ @searchbox).keyup (e) -> @@ -30,8 +26,15 @@ 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 + 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 @@ -52,6 +55,8 @@ 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 + @.quit() else text = @searchbox.value ($ @scheme).css("height", "45px") @@ -81,13 +86,13 @@ class Spotlight extends this.OS.GUI.BaseService awake: (e) -> me = @ - @show = not @show - if @show + if not @show + me.show = true @openDialog "SpotlightDialog", (d) -> me.show = false - me.dialog.quit() if me.dialog me.dialog = undefined else + me.show = false @dialog.quit() if @dialog cleanup: (evt) ->