12 new, 4 updated for 1.3.5
[webos-internals:modifications.git] / universal-search / universal-search-uscl-memos-patch.patch
1 Index: /usr/palm/applications/com.palm.app.notes/app/controllers/app-assistant.js
2 ===================================================================
3 --- .orig/usr/palm/applications/com.palm.app.notes/app/controllers/app-assistant.js
4 +++ /usr/palm/applications/com.palm.app.notes/app/controllers/app-assistant.js
5 @@ -14,6 +14,15 @@
6      {
7                 var name = 'notes';
8                 var stageController = this.controller.getStageController(name);
9 +               if (params && ("newNoteText" in params)) {
10 +                       this.data.newNoteText = params.newNoteText;
11 +               }
12 +               else {
13 +                       this.data.newNoteText = null;
14 +               }
15 +               if (params && ("refresh" in params)) {
16 +                       this.data.refresh = params.refresh;
17 +               }
18                 if (stageController) 
19                 {
20                         this.launch(false, stageController);
21 @@ -32,6 +41,27 @@
22         {
23                 if (!created) 
24                 {
25 +                       var scenes = stageController.getScenes();
26 +                       if ("newNoteText" in this.data && this.data.newNoteText !== null) {
27 +                               if (!(scenes && scenes.length === 1)) {
28 +                                       // doing this if the top scene
29 +                                       // is already 'grid' causes an
30 +                                       // unwanted transition effect.
31 +                                       stageController.popScenesTo('grid');
32 +                               }
33 +                               else {
34 +                                       // In GridAssistant, activate() calls
35 +                                       // refreshList() which calls
36 +                                       // _createNewNoteFromParams().
37 +                                       // Since in this situation activate
38 +                                       // isn't called, we do this "manually".
39 +                                       stageController.delegateToSceneAssistant('_createNewNoteFromParams');
40 +                               }
41 +                       }
42 +                       else if (this.data.refresh && 
43 +                                scenes && scenes.length === 1) {
44 +                               stageController.delegateToSceneAssistant('_refreshList');
45 +                       }
46                         stageController.activate();
47                 }
48                 else 
49 Index: /usr/palm/applications/com.palm.app.notes/app/controllers/grid-assistant.js
50 ===================================================================
51 --- .orig/usr/palm/applications/com.palm.app.notes/app/controllers/grid-assistant.js
52 +++ /usr/palm/applications/com.palm.app.notes/app/controllers/grid-assistant.js
53 @@ -100,7 +100,7 @@
54                 this.controller.getSceneScroller().mojo.revealTop(0);
55      },
56      
57 -    _handleNewNote: function()
58 +    _handleNewNote: function(newNoteText)
59      {
60          // Get top element.  We insert before this one so we need to know its position and its color
61          var top = this.$widget_noteGrid.getItemAt(0, 1); // row-0,col-1 : Skip notepad which is element 0
62 @@ -115,12 +115,20 @@
63          }
64          this.controller.stageController.pushScene('note', 
65          {
66 +            newNoteText: newNoteText,
67              model: this.model,
68              color: Note.colors[(Note.colors.indexOf(top.color) + 1) % Note.colors.length],
69              position: this._findInsertPosition('a', top.position)
70          });
71      },
72      
73 +    _createNewNoteFromParams: function () {
74 +        if ("newNoteText" in this.data && this.data.newNoteText !== null) {
75 +            this._handleNewNote(this.data.newNoteText);
76 +            this.data.newNoteText = null;
77 +        }
78 +    },
79 +
80      _handleEditNote: function(id, color)
81      {
82          this.controller.stageController.pushScene('note', 
83 @@ -279,6 +287,7 @@
84                         self._fixMissingInfo(list, 1);
85                         self.$widget_noteGrid.render(list);
86                         self._enableDisableFilter(total);
87 +                       self._createNewNoteFromParams();
88                         done && done();
89                 });
90      },
91 Index: /usr/palm/applications/com.palm.app.notes/app/controllers/note-assistant.js
92 ===================================================================
93 --- .orig/usr/palm/applications/com.palm.app.notes/app/controllers/note-assistant.js
94 +++ /usr/palm/applications/com.palm.app.notes/app/controllers/note-assistant.js
95 @@ -55,6 +55,12 @@
96                         green: {},
97                         blue: {}
98                 };
99 +                if (data.newNoteText) {
100 +                       this.newNoteText = data.newNoteText;
101 +               }
102 +                else {
103 +                       this.newNoteText = "";
104 +               }
105      },
106      
107      setup: function()
108 @@ -77,7 +83,9 @@
109          {
110              this._onNoteLoaded.bind(this).defer(new Note(
111              {
112 -                text: '',
113 +                text: (this.newNoteText !== "") ? 
114 +                           (this.newNoteText + "\n\n" + Mojo.Format.formatDate(new Date(), "short") + "\n") :
115 +                           this.newNoteText,
116                  color: data.color,
117                  position: data.position
118              }), true);
119 Index: /usr/palm/applications/com.palm.app.notes/appinfo.json
120 ===================================================================
121 --- .orig/usr/palm/applications/com.palm.app.notes/appinfo.json
122 +++ /usr/palm/applications/com.palm.app.notes/appinfo.json
123 @@ -7,5 +7,5 @@
124         "version": "1.0",
125         "icon": "icon.png",
126         "noWindow": true,
127 -       "keywords": ["Notes", "Stickies", "Notepad"]
128 +       "keywords": ["Notes", "Stickies", "Notepad", "iGrokTheCommandLine", "iCanBeRefreshed"] 
129  }