diff --git a/src/core/BaseDialog.coffee b/src/core/BaseDialog.coffee index a7c7989..693738f 100644 --- a/src/core/BaseDialog.coffee +++ b/src/core/BaseDialog.coffee @@ -46,11 +46,11 @@ class BasicDialog extends BaseDialog init: () -> @title = @name if not @title html = " - " + " html += "<#{@conf.tag} #{@conf.att} data-id = 'content'>" html += "
" html += "" for k,v of @conf.buttons - html += "
" + html += "" #render the html _GUI.htmlToScheme html, @, @host @@ -62,6 +62,7 @@ class BasicDialog extends BaseDialog # bind action to button ( (me.find "bt#{k}").set "onbtclick", f(v) ) for k, v of @conf.buttons @conf.filldata @ if @conf.filldata + @conf.xtra @ if @conf.xtra this.OS.GUI.BasicDialog = BasicDialog @@ -90,6 +91,9 @@ class PromptDialog extends BasicDialog filldata: (d) -> return unless d.data (d.find "content").value = d.data + xtra: (d) -> + $( d.find "content" ).keyup (e) -> + (d.find "bt0").trigger() if e.which is 13 } this.OS.register "PromptDialog", PromptDialog @@ -157,7 +161,7 @@ class InfoDialog extends BasicDialog filldata: (d) -> return unless d.data rows = [] - rows.push [ { value: k }, { value: v } ] for k, v of d.data + rows.push [ { value: k }, { value: v } ] for v, k in d.data (d.find "content").set "rows", rows } this.OS.register "InfoDialog", InfoDialog @@ -213,6 +217,10 @@ class SelectionDialog extends BasicDialog filldata: (d) -> return unless d.data (d.find "content").set "items", d.data + xtra: (d) -> + ( d.find "content" ).set "onlistdbclick", (e) -> + (d.find "bt0").trigger() + } this.OS.register "SelectionDialog", SelectionDialog diff --git a/src/core/gui.coffee b/src/core/gui.coffee index 8567183..5bba88b 100644 --- a/src/core/gui.coffee +++ b/src/core/gui.coffee @@ -77,10 +77,16 @@ self.OS.GUI = ( f m, i if m ) for m, i in mimes return apps - + + appsWithServices: () -> + o = {} + o[k] = v for k, v of _OS.setting.system.packages when v.services and v.services.length > 0 + o + openWith: (it) -> return unless it return _GUI.launch it.app if it.type is "app" and it.app + return _courrier.osinfo "Application#{it.text} is not executable" if it.type is "app" apps = _GUI.appsByMime ( if it.type is "dir" then "dir" else it.mime ) return _courrier.osinfo "No application available to open #{it.filename}" if apps.length is 0 return _GUI.launch apps[0].app, [it.path] if apps.length is 1 @@ -169,6 +175,7 @@ self.OS.GUI = handler p if p isnt ($ "#workspace").get(0) handler event.target event.preventDefault() + initDM: -> # check login first _API.resource "schemes/dm.html", (x) -> @@ -236,7 +243,25 @@ self.OS.GUI = desktop[0].contextmenuHandler = (e, m) -> desktop[0].set "selected", -1 if e.target is desktop[0] ($ "#sysdock").get(0).set "selectedApp", null - console.log "context menu handler for desktop" + menu = [ + { text: "Open", dataid: "desktop-open" }, + { text: "Refresh", dataid: "desktop-refresh" } + ] + menu = menu.concat _OS.setting.desktop.menu + m.set "items", menu + m.set "onmenuselect", (evt) -> + switch evt.item.data.dataid + when "desktop-open" + it = desktop[0].get "selected" + return _GUI.openWith it if it + it = _OS.setting.desktop.path.asFileHandler() + it.mime = "dir" + _GUI.openWith it + when "desktop-refresh" + desktop[0].fetch() + else + _GUI.launch evt.item.data.app if evt.item.data.app + m.show(e) desktop[0].fetch() _courrier.observable.on "VFS", (d) -> @@ -303,12 +328,14 @@ self.OS.GUI = _OS.setting.appearance = conf.appearance if conf.appearance _OS.setting.user = conf.user _OS.setting.VFS = conf.VFS if conf.VFS + _OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path + _OS.setting.desktop.menu = [] unless _OS.setting.desktop.menu _OS.setting.VFS.mountpoints = [ #TODO: multi app try to write to this object, it neet to be cloned { text: "Applications", path: 'app:///', iconclass: "fa fa-adn", type: "app" }, { text: "Home", path: 'home:///', iconclass: "fa fa-home", type: "fs" }, { text: "OS", path: 'os:///', iconclass: "fa fa-inbox", type: "fs" }, - { text: "Desktop", path: 'home:///.desktop', iconclass: "fa fa-desktop", type: "fs" }, + { text: "Desktop", path: _OS.setting.desktop.path , iconclass: "fa fa-desktop", type: "fs" }, ] if not _OS.setting.VFS.mountpoints _OS.setting.system = conf.system if conf.system @@ -317,7 +344,7 @@ self.OS.GUI = "os:///packages" ] unless _OS.setting.system.pkgpaths _OS.setting.system.menu = [] unless _OS.setting.system.menu - _OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path + _OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme # load theme _GUI.loadTheme _OS.setting.appearance.theme diff --git a/src/core/schemes/about.html b/src/core/schemes/about.html index ad8bc6f..aba8877 100644 --- a/src/core/schemes/about.html +++ b/src/core/schemes/about.html @@ -1,5 +1,5 @@ - +

@@ -7,5 +7,5 @@

-
+
\ No newline at end of file diff --git a/src/core/schemes/filedialog.html b/src/core/schemes/filedialog.html index b830c6c..9800846 100644 --- a/src/core/schemes/filedialog.html +++ b/src/core/schemes/filedialog.html @@ -1,13 +1,13 @@ - + - +
-
-
+ +
\ No newline at end of file diff --git a/src/core/tags/afx-button.js b/src/core/tags/afx-button.js index 01d9690..cac3bdc 100644 --- a/src/core/tags/afx-button.js +++ b/src/core/tags/afx-button.js @@ -1,5 +1,5 @@ - \ No newline at end of file diff --git a/src/core/tags/afx-list-view.js b/src/core/tags/afx-list-view.js index 6bb6908..68b5d99 100644 --- a/src/core/tags/afx-list-view.js +++ b/src/core/tags/afx-list-view.js @@ -24,7 +24,10 @@ { if(self.selidx != -1) self.items[self.selidx].selected =false - if(self.items[v]) self.items[v].selected = true + if(v == -1) + self.selidx = -1 + else + if(self.items[v]) self.items[v].selected = true } else if(k == "*") for(var i in v) diff --git a/src/core/tags/afx-menu.js b/src/core/tags/afx-menu.js index 82aed7a..722d87a 100644 --- a/src/core/tags/afx-menu.js +++ b/src/core/tags/afx-menu.js @@ -7,7 +7,7 @@ - +
  • diff --git a/src/core/tags/afx-vbox.js b/src/core/tags/afx-vbox.js index 4860e0c..6b1b772 100644 --- a/src/core/tags/afx-vbox.js +++ b/src/core/tags/afx-vbox.js @@ -1,5 +1,5 @@ -
    +
    \ No newline at end of file diff --git a/src/packages/ActivityMonitor/scheme.html b/src/packages/ActivityMonitor/scheme.html index 5c66f43..47388f3 100644 --- a/src/packages/ActivityMonitor/scheme.html +++ b/src/packages/ActivityMonitor/scheme.html @@ -1,6 +1,6 @@ - + - + \ No newline at end of file diff --git a/src/packages/CoreServices/package.json b/src/packages/CoreServices/package.json index b45cae3..7691707 100644 --- a/src/packages/CoreServices/package.json +++ b/src/packages/CoreServices/package.json @@ -1,5 +1,6 @@ { "app":null, + "services": [ "Calendar", "PushNotification", "Spotlight" ] "name":"CoreServices", "description":"This is the core services", "info":{ diff --git a/src/packages/DummyApp/package.json b/src/packages/DummyApp/package.json index 645b13a..001e6f5 100644 --- a/src/packages/DummyApp/package.json +++ b/src/packages/DummyApp/package.json @@ -11,5 +11,5 @@ "version":"0.1a", "category":"System", "iconclass":"fa fa-user-circle-o", - "mimes":[".*"] + "mimes":["none"] } \ No newline at end of file diff --git a/src/packages/DummyApp/scheme.html b/src/packages/DummyApp/scheme.html index 7c43da0..0637c42 100644 --- a/src/packages/DummyApp/scheme.html +++ b/src/packages/DummyApp/scheme.html @@ -1,13 +1,15 @@ - - - - + + + + + + - - + + \ No newline at end of file diff --git a/src/packages/Files/main.coffee b/src/packages/Files/main.coffee index 3c81fea..d20d8ac 100644 --- a/src/packages/Files/main.coffee +++ b/src/packages/Files/main.coffee @@ -81,13 +81,20 @@ class Files extends this.OS.GUI.BaseApplication me.view.set "data", d.result mnFile:() -> + #console.log file me = @ + f = () -> + console.log "called" + file = me.view.get "selectedFile" + return undefined unless file + return me._gui.appsByMime file.mime + { text: "File", child: [ { text: "New file", dataid: "#{@name}-mkf" }, { text: "New folder", dataid: "#{@name}-mkdir" }, - { text: "Open", dataid: "#{@name}-open" }, + { text: "Open with", dataid: "#{@name}-open", child: f }, { text: "Upload", dataid: "#{@name}-upload" }, { text: "Download", dataid: "#{@name}-download" }, { text: "Properties", dataid: "#{@name}-info" } diff --git a/src/packages/Files/scheme.html b/src/packages/Files/scheme.html index 5011dce..d153af9 100644 --- a/src/packages/Files/scheme.html +++ b/src/packages/Files/scheme.html @@ -1,14 +1,14 @@ - - + +
    -
    - +
    + - - + +
    \ No newline at end of file diff --git a/src/packages/MarkOn/main.coffee b/src/packages/MarkOn/main.coffee index ea3f269..ed5f657 100644 --- a/src/packages/MarkOn/main.coffee +++ b/src/packages/MarkOn/main.coffee @@ -8,6 +8,7 @@ class MarkOn extends this.OS.GUI.BaseApplication @container = @find "mycontainer" @previewOn = false @currfile = if @args and @args.length > 0 then @args[0].asFileHandler() else "Untitled".asFileHandler() + @editormux = false @editor = new SimpleMDE element: markarea autofocus: true @@ -38,7 +39,10 @@ class MarkOn extends this.OS.GUI.BaseApplication ] @editor.codemirror.on "change", () -> - console.log "thing changed" + return if me.editormux + if me.currfile.dirty is false + me.currfile.dirty = true + me.scheme.set "apptitle", "#{me.currfile.basename}*" @on "vboxchange", (e) -> me.resizeContent() @resizeContent() @open @currfile @@ -53,9 +57,14 @@ class MarkOn extends this.OS.GUI.BaseApplication open: (file) -> #find table + return if file.path is "Untitled" me = @ + file.dirty = false file.read (d) -> + me.editormux = true me.editor.value d + me.scheme.set "apptitle", "#{me.currfile.basename}" + me.editormux = false save: (file) -> @@ -64,6 +73,7 @@ class MarkOn extends this.OS.GUI.BaseApplication return me.error "Error saving file #{file.basename}" if d.error file.dirty = false file.text = file.basename + me.scheme.set "apptitle", "#{me.currfile.basename}" menu: () -> me = @ @@ -97,4 +107,15 @@ class MarkOn extends this.OS.GUI.BaseApplication when "#{@name}-Saveas" @currfile.cache = @editor.value() saveas() + + cleanup: (evt) -> + return unless @currfile.dirty + me = @ + evt.preventDefault() + @.openDialog "YesNoDialog", (d) -> + if d + me.currfile.dirty = false + me.quit() + , "Quit", { text: "Quit without saving ?" } + this.OS.register "MarkOn", MarkOn \ No newline at end of file diff --git a/src/packages/MarkOn/scheme.html b/src/packages/MarkOn/scheme.html index d97500d..38ed98b 100644 --- a/src/packages/MarkOn/scheme.html +++ b/src/packages/MarkOn/scheme.html @@ -1,7 +1,7 @@ - +
    -
    +
    \ No newline at end of file diff --git a/src/packages/NotePad/main.coffee b/src/packages/NotePad/main.coffee index bad968f..7df949f 100644 --- a/src/packages/NotePad/main.coffee +++ b/src/packages/NotePad/main.coffee @@ -215,7 +215,17 @@ class NotePad extends this.OS.GUI.BaseApplication when "#{@name}-Saveas" @currfile.cache = @editor.getValue() saveas() - + + cleanup: (evt) -> + dirties = ( v for v in @tabarea.get "items" when v.dirty ) + return if dirties.length is 0 + me = @ + evt.preventDefault() + @.openDialog "YesNoDialog", (d) -> + if d + v.dirty = false for v in dirties + me.quit() + , "Quit", { text: "Ignore all #{dirties.length} unsaved files ?" } NotePad.singleton = false this.OS.register "NotePad", NotePad \ No newline at end of file diff --git a/src/packages/NotePad/scheme.html b/src/packages/NotePad/scheme.html index fed1131..cdf04e6 100644 --- a/src/packages/NotePad/scheme.html +++ b/src/packages/NotePad/scheme.html @@ -1,18 +1,18 @@ - - + + - - + +
    - +
    -
    - -
    + + +
    \ No newline at end of file diff --git a/src/packages/wTerm/main.coffee b/src/packages/wTerm/main.coffee index 5eb4f9a..0a58cb0 100644 --- a/src/packages/wTerm/main.coffee +++ b/src/packages/wTerm/main.coffee @@ -31,6 +31,8 @@ class wTerm extends this.OS.GUI.BaseApplication end = if (i + 1) * 1000 > len then len else (i + 1) * 1000 me.term.write pastedText.substring i * 1000, end #self.socket.send("i"+ substr.replace(/\n/g,"\r\n")) + # make desktop menu if not exist + @systemsetting.desktop.menu.push { text: "Open terminal", app: "wTerm" } @openSession() @on "vboxchange", (e) -> me.resizeContent e.w, e.h diff --git a/src/packages/wTerm/scheme.html b/src/packages/wTerm/scheme.html index be18835..15a2347 100644 --- a/src/packages/wTerm/scheme.html +++ b/src/packages/wTerm/scheme.html @@ -1,5 +1,5 @@ - +
    -
    +
    \ No newline at end of file