← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~rpadovani/reminders-app/integration into lp:reminders-app

 

Riccardo Padovani has proposed merging lp:~rpadovani/reminders-app/integration into lp:reminders-app.

Commit message:
Extend ability to create new notes from other apps

Requested reviews:
  Ubuntu Notes app developers (notes-app-dev)
Related bugs:
  Bug #1445107 in Ubuntu Notes app: "Extend ability to create new notes & reminders from another app"
  https://bugs.launchpad.net/reminders-app/+bug/1445107

For more details, see:
https://code.launchpad.net/~rpadovani/reminders-app/integration/+merge/271846

Add possibility to other apps to create a note setting title and content
-- 
Your team Ubuntu Notes app developers is requested to review the proposed merge of lp:~rpadovani/reminders-app/integration into lp:reminders-app.
=== modified file 'src/app/qml/reminders.qml'
--- src/app/qml/reminders.qml	2015-09-15 14:50:55 +0000
+++ src/app/qml/reminders.qml	2015-09-21 17:51:24 +0000
@@ -260,16 +260,42 @@
                     }
                     break;
 
+                // evernote://newnote
+                // Optional arguments:
+                // /title/<title>
+                // /content/<content>
+                // /guid/<notebookguid>
                 case "newnote": // evernote://newnote  or  evernote://newnote/<notebookguid>
-                    if (commands[1]) {
-                        if (NotesStore.notebook(commands[1])) {
-                            NotesStore.createNote(i18n.tr("Untitled"), commands[1]);
-                        } else {
-                            console.warn("No such notebook.");
+                    var title = i18n.tr("Untitled");
+                    var content;
+                    var notebookguid;
+
+                    if (commands.lengt % 2 === 0) {
+                        console.warn("Wrong number of params");
+                        break;
+                    }
+                    
+                    for (var i = 1; i < commands.length; i+=2) {
+                        switch(commands[i]) {
+                            case "title":
+                                title = commands[i+1];
+                                break;
+
+                            case "content":
+                                content = commands[i+1];
+                                break;
+
+                            case "notebookguid":
+                                notebookguid = commands[i+1];
+                                break;
                         }
+                    }
+                    if (notebookguid && NotesStore.notebook(notebookguid) {
+                        console.warn("No such notebook.");
                     } else {
-                        NotesStore.createNote(i18n.tr("Untitled"));
+                        NotesStore.createNote(title, notebookguid, content);
                     }
+
                     break;
 
                 case "editnote": // evernote://editnote/<noteguid>


Follow ups