From 47c6f6f7b6e8bf4b5524b094c657e47c3e4cbf64 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sat, 10 Mar 2012 12:47:18 -0500 Subject: [PATCH 01/13] removed debug line --- srv/ReadFileAssistant.js | 1 - 1 file changed, 1 deletion(-) diff --git a/srv/ReadFileAssistant.js b/srv/ReadFileAssistant.js index b4efdde..5f92dae 100644 --- a/srv/ReadFileAssistant.js +++ b/srv/ReadFileAssistant.js @@ -9,7 +9,6 @@ ReadFileAssistant.prototype.run = function(future) { fs.readFile(path, 'utf8', function(err,data) { //future.result = { path: path, content: data }; setTimeout(function () { - console.log("delay test..."); future.result = { path: path, content: data }; }, 100); }); From 7408899004e0c695c08747ef3fcbd5a78a798491 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sat, 10 Mar 2012 13:33:22 -0500 Subject: [PATCH 02/13] initial playbook port --- app/appinfo.json | 2 +- app/source/Dropbox.js | 10 +++++-- app/source/TodoEdit.js | 2 +- app/source/TodoPrefs.js | 6 +++- app/source/TodoTxt.js | 64 ++++++++++++++++++++++++++++++++++++----- bbww/appindex.html | 24 ++++++++++++++++ bbww/config.xml | 49 +++++++++++++++++++++++++++++++ pkg/packageinfo.json | 2 +- 8 files changed, 146 insertions(+), 13 deletions(-) create mode 100644 bbww/appindex.html create mode 100644 bbww/config.xml diff --git a/app/appinfo.json b/app/appinfo.json index 97e0d55..05faffe 100644 --- a/app/appinfo.json +++ b/app/appinfo.json @@ -1,6 +1,6 @@ { "id": "com.monkeystew.todotxtenyo.beta", - "version": "0.1.0", + "version": "0.2.0", "vendor": "Monkeystew", "type": "web", "main": "index.html", diff --git a/app/source/Dropbox.js b/app/source/Dropbox.js index 48158bd..583c806 100644 --- a/app/source/Dropbox.js +++ b/app/source/Dropbox.js @@ -141,10 +141,16 @@ enyo.kind({ this.requestToken = tokens[1].split("=")[1]; console.log("...launching browser window..."); - this.$.launch.call({ + if (this.owner.os == "BlackBerry") { + var args = new blackberry.invoke.BrowserArguments(url); + blackberry.invoke.invoke( + blackberry.invoke.APP_BROWSER, args); + } else { + this.$.launch.call({ "id": "com.palm.app.browser", "params": {"target": url} - }); + }); + } } }, diff --git a/app/source/TodoEdit.js b/app/source/TodoEdit.js index dc7b24a..3a25ed6 100644 --- a/app/source/TodoEdit.js +++ b/app/source/TodoEdit.js @@ -24,7 +24,7 @@ enyo.kind({ components: [ {flex: 1, kind: "Scroller", components: [ - {kind: "RichText", name: "tododetail"}, + {kind: "Input", name: "tododetail"}, ]}, {name: "editToolbar", kind: "Toolbar", pack: "justify", className: "enyo-toolbar-light", components: [ diff --git a/app/source/TodoPrefs.js b/app/source/TodoPrefs.js index 8149bde..455686e 100644 --- a/app/source/TodoPrefs.js +++ b/app/source/TodoPrefs.js @@ -137,7 +137,11 @@ enyo.kind({ if (inSender.preferenceProperty == "storage") { if (value == "file") { //this.$.todoFilePicker.pickFile(); - var mypath = "/media/internal/todo/todo.txt" + if (this.owner.os == "BlackBerry") { + var mypath = this.owner.dirs.shared.documents.path + "/todo/todo.txt"; + } else { + var mypath = "/media/internal/todo/todo.txt" + } this.owner.preferences["filepath"] = mypath; this.$.filepath.setValue(mypath); this.$.filepath.render(); diff --git a/app/source/TodoTxt.js b/app/source/TodoTxt.js index 90257c1..45cd30f 100644 --- a/app/source/TodoTxt.js +++ b/app/source/TodoTxt.js @@ -88,7 +88,16 @@ enyo.kind({ ], ready: function() { - this.$.getConn.call(); + + if (window.PalmSystem) { + this.$.getConn.call(); + this.os = "webOS"; + } else if (window.blackberry) { + this.os = "BlackBerry"; + this.dirs = blackberry.io.dir.appDirs; + } else { + this.os = "unknown"; + } this.preferences = localStorage.getItem("TodoPreferences"); if (this.preferences == undefined) { @@ -124,7 +133,14 @@ enyo.kind({ this.$.viewTitle.setContent("[offline]"); } - this.$.makeDir.call({ path: "/media/internal/todo" }); + if (this.os == "BlackBerry") { + var path = this.dirs.shared.documents.path + "/todo"; + if (!blackberry.io.dir.exists(path)) { + blackberry.io.dir.createNewDir(path); + } + } else { + this.$.makeDir.call({ path: "/media/internal/todo" }); + } this.todoList = []; this.refreshTodo(); @@ -218,7 +234,11 @@ enyo.kind({ }, parseFile: function(path, file) { - var todofile = file.content.split("\n"); + if (file.content != undefined) { + todofile = file.content.split("\n"); + } else { + todofile = ""; + } this.todoList = []; for (line in todofile) { if (todofile[line]) { @@ -242,8 +262,15 @@ enyo.kind({ for (item in list) { data = data + list[item].detail + "\n"; } - this.$.writeFile.call({ - path: path, content: data }); + if (this.os == "BlackBerry") { + if (blackberry.io.file.exists(path)) { + blackberry.io.file.deleteFile(path); + } + blackberry.io.file.saveFile(path, + blackberry.utils.stringToBlob(data)); + } else { + this.$.writeFile.call({ path: path, content: data }); + } if (this.preferences["storage"] == "dropbox" && this.preferences["offline"] == false && @@ -285,7 +312,20 @@ enyo.kind({ }, getLocalFile: function() { - this.$.readFile.call({ path: this.preferences["filepath"] }); + var path = this.preferences["filepath"]; + if (this.os == "BlackBerry") { + if (blackberry.io.file.exists(path)) { + blackberry.io.file.readFile(path, + function(fpath, blob) { + var data = blackberry.utils.blobToString(blob); + appInstance.parseFile(null, {content: data}); + } + ); + } + } else { + this.$.readFile.call({ path: path }); + //this.$.readFile.call({ path: this.preferences["filepath"] }); + } }, loadDropbox: function(inSender, inResponse, inRequest) { @@ -297,15 +337,25 @@ enyo.kind({ }, resetPreferences: function() { + localStorage.clear(); this.preferences = new Object(); this.preferences["storage"] = "file"; this.preferences["offline"] = true; - this.preferences["filepath"] = "/media/internal/todo/todo.txt"; this.preferences["dboxpath"] = "/todo"; + if (this.os == "BlackBerry") { + var path = this.dirs.shared.documents.path + "/todo/todo.txt"; + this.preferences["filepath"] = path; + } else { + this.preferences["filepath"] = "/media/internal/todo/todo.txt"; + } + + // reset the preferences pane this.$.preferenceView.$.offline.setChecked(true); this.$.preferenceView.$.dboxlogout.hide(); this.$.preferenceView.$.dboxpathselect.hide(); this.$.preferenceView.$.filepathselect.show(); + + // save preferences localStorage.setItem("TodoPreferences", JSON.stringify(this.preferences)); }, diff --git a/bbww/appindex.html b/bbww/appindex.html new file mode 100644 index 0000000..a0322c9 --- /dev/null +++ b/bbww/appindex.html @@ -0,0 +1,24 @@ + + + + Todo.txt Enyo + + + + + + + + diff --git a/bbww/config.xml b/bbww/config.xml new file mode 100644 index 0000000..ab7a118 --- /dev/null +++ b/bbww/config.xml @@ -0,0 +1,49 @@ + + + + + + + Todo.txt Enyo + + Morgan McMillian + + + A mobile application for managing your todo.txt file written using the EnyoJS framework. + + + + + + + + + + + + + + + + + + + + + + + + + + + access_shared + + + diff --git a/pkg/packageinfo.json b/pkg/packageinfo.json index 368be29..8f22813 100644 --- a/pkg/packageinfo.json +++ b/pkg/packageinfo.json @@ -3,7 +3,7 @@ "package_format_version": 2, "loc_name": "Todo.txt Enyo", "icon": "icon.png", - "version": "0.1.0", + "version": "0.2.0", "vendor": "Monkeystew", "app": "com.monkeystew.todotxtenyo.beta", "services": ["com.monkeystew.todotxtenyo.beta.service"] From 1bba91356c6eb682c0ba24e4f4e37be99e535883 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sat, 10 Mar 2012 14:23:43 -0500 Subject: [PATCH 03/13] fixed config file for proper package build --- bbww/config.xml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/bbww/config.xml b/bbww/config.xml index ab7a118..4bad90b 100644 --- a/bbww/config.xml +++ b/bbww/config.xml @@ -7,7 +7,7 @@ + version="0.2.0"> Todo.txt Enyo @@ -34,13 +34,7 @@ - - - - - + access_shared From 23991a26def4e80c3772183bdddcce3d6e5f50fd Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sat, 10 Mar 2012 20:24:57 -0500 Subject: [PATCH 04/13] hide dropbox path when not enabled and set simple transistions to speed up playbook response --- app/source/TodoPrefs.js | 2 +- app/source/TodoTxt.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/source/TodoPrefs.js b/app/source/TodoPrefs.js index 455686e..b6ab7fa 100644 --- a/app/source/TodoPrefs.js +++ b/app/source/TodoPrefs.js @@ -82,7 +82,7 @@ enyo.kind({ } ]}, {kind: "Item", layoutKind: "HFlexLayout", - name: "dboxpathselect", showing: true, + name: "dboxpathselect", showing: false, components: [ {flex: 1, kind: "Input", name: "dboxpath", preferenceProperty: "dboxpath", diff --git a/app/source/TodoTxt.js b/app/source/TodoTxt.js index 45cd30f..be15553 100644 --- a/app/source/TodoTxt.js +++ b/app/source/TodoTxt.js @@ -44,7 +44,8 @@ enyo.kind({ {name: "viewTitle", kind: "HtmlContent", className: "todo-view-title", content: ""} ]}, - {flex: 1, kind: "Pane", onSelectView: "viewSelected", components: [ + {flex: 1, kind: "Pane", onSelectView: "viewSelected", + transitionKind: enyo.transitions.Simple, components: [ {name: "listView", kind: "TodoList", onEdit: "showEditView", onPrefs: "showPrefView", onReload: "refreshTodo" }, From 7316f8c67e036d476a4396a5bac4f14fe6254031 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 11 Mar 2012 15:04:46 -0400 Subject: [PATCH 05/13] Reverted input field back to richtext because of line wrapping issues Added priority, project, and context selection to the edit view Fixed replace flag when closing popups to avoid race conditions --- app/source/TodoEdit.js | 82 ++++++++++++++++++++++++++++++++++++++++-- app/source/TodoList.js | 42 ++++++++++++++++++++++ app/source/TodoTxt.js | 2 ++ 3 files changed, 123 insertions(+), 3 deletions(-) diff --git a/app/source/TodoEdit.js b/app/source/TodoEdit.js index 3a25ed6..fe09bde 100644 --- a/app/source/TodoEdit.js +++ b/app/source/TodoEdit.js @@ -22,9 +22,28 @@ enyo.kind({ "onSave": "" }, components: [ - + {name: "insertPopup", kind: "ModalDialog", dismissWithClick: true, + components: [ + {name: "projects", kind: "RowGroup", caption: "Projects"}, + {name: "contexts", kind: "RowGroup", caption: "Contexts"}, + {kind: "Button", caption: "Dismiss", onclick: "closePopup"} + ]}, + {name: "filterToolbar", kind: "Toolbar", pack: "justify", className: "enyo-toolbar-light", + components: [ + {kind: "RadioGroup", name: "priGroup", + onChange: "setPriority", components: [ + {caption: "-", value: "-"}, + {caption: "A", value: "A"}, + {caption: "B", value: "B"}, + {caption: "C", value: "C"}, + {caption: "D", value: "D"}, + {caption: "E", value: "E"} + ]}, + {kind: "Button", caption: "+", onclick: "showInsert"} + ] + }, {flex: 1, kind: "Scroller", components: [ - {kind: "Input", name: "tododetail"}, + {kind: "RichText", name: "tododetail", richContent: false}, ]}, {name: "editToolbar", kind: "Toolbar", pack: "justify", className: "enyo-toolbar-light", components: [ @@ -35,6 +54,63 @@ enyo.kind({ ] } - ] + ], + + setPriority: function(inSender) { + var pri = inSender.getValue(); + var val = this.$.tododetail.getValue(); + val = val.replace(/^\([A-E]\)\s/,"") + if (pri.match(/[A-E]/)) { + this.$.tododetail.setValue( + "(" + pri + ") " + val); + } else { + this.$.tododetail.setValue( val ); + } + }, + + showInsert: function() { + this.$.insertPopup.openAtCenter(); + this.projectList = this.owner.$.listView.getProjectList(); + for (i=0; i Date: Sun, 11 Mar 2012 15:55:30 -0400 Subject: [PATCH 06/13] added scroller to insert popup --- app/source/TodoEdit.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/source/TodoEdit.js b/app/source/TodoEdit.js index fe09bde..c4176b0 100644 --- a/app/source/TodoEdit.js +++ b/app/source/TodoEdit.js @@ -22,10 +22,13 @@ enyo.kind({ "onSave": "" }, components: [ - {name: "insertPopup", kind: "ModalDialog", dismissWithClick: true, + {name: "insertPopup", kind: "Popup", dismissWithClick: false, + layoutKind: "VFlexLayout", height: "60%", components: [ + {flex: 1, kind: "Scroller", components: [ {name: "projects", kind: "RowGroup", caption: "Projects"}, - {name: "contexts", kind: "RowGroup", caption: "Contexts"}, + {name: "contexts", kind: "RowGroup", caption: "Contexts"} + ]}, {kind: "Button", caption: "Dismiss", onclick: "closePopup"} ]}, {name: "filterToolbar", kind: "Toolbar", pack: "justify", className: "enyo-toolbar-light", From 763df87ad0cba61fcb28a78bef9ebe0e7cb0bda6 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 11 Mar 2012 20:37:33 -0400 Subject: [PATCH 07/13] temporary hack for richtext kind on webworks --- app/source/TodoEdit.js | 2 +- app/source/TodoTxt.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/source/TodoEdit.js b/app/source/TodoEdit.js index c4176b0..a208017 100644 --- a/app/source/TodoEdit.js +++ b/app/source/TodoEdit.js @@ -45,7 +45,7 @@ enyo.kind({ {kind: "Button", caption: "+", onclick: "showInsert"} ] }, - {flex: 1, kind: "Scroller", components: [ + {flex: 1, name: "scroller", kind: "Scroller", components: [ {kind: "RichText", name: "tododetail", richContent: false}, ]}, {name: "editToolbar", kind: "Toolbar", pack: "justify", className: "enyo-toolbar-light", diff --git a/app/source/TodoTxt.js b/app/source/TodoTxt.js index 0f921f1..ce58395 100644 --- a/app/source/TodoTxt.js +++ b/app/source/TodoTxt.js @@ -96,6 +96,12 @@ enyo.kind({ } else if (window.blackberry) { this.os = "BlackBerry"; this.dirs = blackberry.io.dir.appDirs; + // hack for RichText not working properly + this.$.editView.$.tododetail.destroy(); + this.$.editView.$.scroller.createComponent( + {kind: "Input", name: "tododetail", owner:this.$.editView} + ); + this.$.editView.render(); } else { this.os = "unknown"; } From 315f28edfae376c80d1f064bb65d7e8bb6d12045 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 11 Mar 2012 21:06:11 -0400 Subject: [PATCH 08/13] fixes for scrolling in the modaldialog kind --- app/source/TodoEdit.js | 11 +++++++---- app/source/TodoTxt.js | 4 ++-- app/source/styles.css | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/source/TodoEdit.js b/app/source/TodoEdit.js index a208017..278dd90 100644 --- a/app/source/TodoEdit.js +++ b/app/source/TodoEdit.js @@ -22,14 +22,15 @@ enyo.kind({ "onSave": "" }, components: [ - {name: "insertPopup", kind: "Popup", dismissWithClick: false, + {name: "insertPopup", kind: "ModalDialog", dismissWithClick: true, layoutKind: "VFlexLayout", height: "60%", + contentHeight: "100%", onClose: "closePopup", components: [ - {flex: 1, kind: "Scroller", components: [ + {flex: 1, name: "iscroller", kind: "Scroller", + components: [ {name: "projects", kind: "RowGroup", caption: "Projects"}, {name: "contexts", kind: "RowGroup", caption: "Contexts"} - ]}, - {kind: "Button", caption: "Dismiss", onclick: "closePopup"} + ]} ]}, {name: "filterToolbar", kind: "Toolbar", pack: "justify", className: "enyo-toolbar-light", components: [ @@ -93,6 +94,7 @@ enyo.kind({ ); } this.$.contexts.render(); + this.$.iscroller.render(); }, closePopup: function() { @@ -106,6 +108,7 @@ enyo.kind({ eval("this.$."+name+".destroy()"); } this.$.contexts.render(); + this.$.tododetail.forceFocus(); this.$.insertPopup.close(); }, diff --git a/app/source/TodoTxt.js b/app/source/TodoTxt.js index ce58395..1680d77 100644 --- a/app/source/TodoTxt.js +++ b/app/source/TodoTxt.js @@ -26,9 +26,9 @@ enyo.kind({ {caption: "Preferences", onclick: "showPrefView"}, {caption: "About", onclick: "showAbout"} ]}, - {kind: "Popup", name: "about", layoutKind: "VFlexLayout", + {kind: "ModalDialog", name: "about", layoutKind: "VFlexLayout", contentHeight: "100%", height: "80%", width: "80%", - components: [ + dismissWithClick: true, components: [ {name: "aboutTitle", content: ""}, {content: "by Morgan McMillian"}, {kind: "Divider", caption: "Version History"}, diff --git a/app/source/styles.css b/app/source/styles.css index 1f17d3b..9b89907 100644 --- a/app/source/styles.css +++ b/app/source/styles.css @@ -33,3 +33,4 @@ } .ver-history { font-size: 16px; } .version { font-weight: bold;} +.enyo-modaldialog > * { height:100%; } From b80225dc27d8e6afc3f79995c4e7d9c3e5cc2577 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 11 Mar 2012 22:16:26 -0400 Subject: [PATCH 09/13] modified the ui a bit with regards to the modaldialog boxes --- app/source/TodoList.js | 65 +++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/app/source/TodoList.js b/app/source/TodoList.js index ad81960..764b106 100644 --- a/app/source/TodoList.js +++ b/app/source/TodoList.js @@ -35,29 +35,42 @@ enyo.kind({ }, components: [ - {name: "todoPopup", kind: "ModalDialog", components: [ - {kind: "Button", caption: "Complete", onclick: "completeTodoItem"}, - {kind: "Button", caption: "Prioritize", onclick: "showPriList"}, - {kind: "Button", caption: "Update", onclick: "updateTodoItem"}, - {kind: "Button", caption: "Delete", onclick: "deleteTodoItem"}, - {kind: "Button", caption: "Dismiss", onclick: "closePopup"} + {name: "todoPopup", kind: "ModalDialog", dismissWithClick: true, + onClose: "closePopup", components: [ + {kind: "RowGroup", components: [ + {content:"Complete", onclick:"completeTodoItem", + style: "text-align:center"}, + {content:"Prioritize", onclick:"showPriList", + style: "text-align:center"}, + {content:"Update", onclick:"updateTodoItem", + style: "text-align:center"}, + {content:"Delete", onclick:"deleteTodoItem", + style: "text-align:center"} + ]} ]}, - {name: "completedPopup", kind: "ModalDialog", components: [ - {kind: "Button", caption: "Undo Complete", onclick: "undoCompleteTodoItem"}, - {kind: "Button", caption: "Delete", onclick: "deleteTodoItem"}, - {kind: "Button", caption: "Dismiss", onclick: "closePopup"} + {name: "completedPopup", kind: "ModalDialog", + dismissWithClick: true, onClose: "closePopup", components: [ + {kind: "RowGroup", components: [ + {content:"Undo Complete", + onclick:"undoCompleteTodoItem", + style: "text-align:center"}, + {content:"Delete", onclick:"deleteTodoItem", + style: "text-align:center"} + ]} ]}, - {name: "priorityPopup", kind: "ModalDialog", components: [ - {kind: "HtmlContent", content: "Select priority"}, - {kind: "RadioGroup", name: "priGroup", onChange: "setPriority", components: [ - {caption: "-", value: "-"}, - {caption: "A", value: "A"}, - {caption: "B", value: "B"}, - {caption: "C", value: "C"}, - {caption: "D", value: "D"}, - {caption: "E", value: "E"} - ]}, - {kind: "Button", caption: "Dismiss", onclick: "closePopup"} + {name: "priorityPopup", kind: "ModalDialog", + dismissWithClick: true, onClose: "closePopup", components: [ + {kind: "RowGroup", caption:"Select Priority", components: [ + {kind: "RadioGroup", name: "priGroup", + onChange: "setPriority", components: [ + {caption: "-", value: "-"}, + {caption: "A", value: "A"}, + {caption: "B", value: "B"}, + {caption: "C", value: "C"}, + {caption: "D", value: "D"}, + {caption: "E", value: "E"} + ]} + ]} ]}, {kind: "SearchInput", name: "searchbox", onchange: "searchList", onCancel: "clearSearch"}, {flex: 1, kind: "Scroller", name: "scroller", components: [ @@ -290,11 +303,11 @@ enyo.kind({ }, closePopup: function() { - this.$.todoPopup.close(); - this.$.completedPopup.close(); - this.$.priorityPopup.close(); - this.selectedIndex = null; - this.selectedId = null; + //this.$.todoPopup.close(); + //this.$.completedPopup.close(); + //this.$.priorityPopup.close(); + //this.selectedIndex = null; + //this.selectedId = null; this.$.todoList.render(); }, From 027ef2833efb0d89811b6f1eee5a829f2f72b72e Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 11 Mar 2012 23:25:55 -0400 Subject: [PATCH 10/13] merged bugfix from 0.1.1 --- app/index.html | 4 ++++ app/source/TodoList.js | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/index.html b/app/index.html index bb93b50..10702e7 100644 --- a/app/index.html +++ b/app/index.html @@ -16,6 +16,10 @@ appInstance.renderInto(document.body);