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