updates and new patches by rod
[webos-internals:djcin7s-modifications.git] / email / email-email-mega-mix.patch
1 diff --git a/usr/palm/applications/com.palm.app.email/app/controllers/accountpreferences-assistant.js b/usr/palm/applications/com.palm.app.email/app/controllers/accountpreferences-assistant.js
2 index 3c48b42..f4924f7 100644
3 --- a/usr/palm/applications/com.palm.app.email/app/controllers/accountpreferences-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.email/app/controllers/accountpreferences-assistant.js
5 @@ -455,6 +455,11 @@ var AccountpreferencesAssistant = Class.create({
6                         {label: $L('7 days'), value: 7},
7                         {label: $L('2 weeks'), value: 14},
8                         {label: $L('1 month'), value: 30},
9 +                       {label: $L('2 months'), value: 60},
10 +                       {label: $L('3 months'), value: 90},
11 +                       {label: $L('6 months'), value: 180},
12 +                       {label: $L('9 months'), value: 270},
13 +                       {label: $L('1 year'), value: 365},
14                         {label: $L('All'), value: 0}
15                 ]
16         },
17 @@ -493,11 +498,22 @@ var AccountpreferencesAssistant = Class.create({
18                         {label: $L('10 minutes'), value: 10},
19                         {label: $L('15 minutes'), value: 15},
20                         {label: $L('30 minutes'), value: 30},
21 -                       {label: $L('1 hour'), value: 60},
22 -                       {label: $L('6 hours'), value: 360},
23 -                       {label: $L('12 hours'), value: 720},
24 -                       {label: $L('24 hours'), value: 1440},
25 -                       {label: $L('Manual'), value: 1000000}
26 +                       {label: $L('45 minutes'), value: 45},
27 +                       {label: $L('1 hour'), value: 60},
28 +                       {label: $L('90 minutes'), value: 90},
29 +                       {label: $L('2 hours'), value: 120},
30 +                       {label: $L('3 hours'), value: 180},
31 +                       {label: $L('4 hours'), value: 240},
32 +                       {label: $L('5 hours'), value: 300},
33 +                       {label: $L('6 hours'), value: 360},
34 +                       {label: $L('7 hours'), value: 420},
35 +                       {label: $L('8 hours'), value: 480},
36 +                       {label: $L('9 hours'), value: 540},
37 +                       {label: $L('10 hours'), value: 600},
38 +                       {label: $L('11 hours'), value: 660},
39 +                       {label: $L('12 hours'), value: 720},
40 +                       {label: $L('24 hours'), value: 1440},
41 +                       {label: $L('Manual'), value: 1000000}
42                 ]
43         }
44  });
45 diff --git a/usr/palm/applications/com.palm.app.email/app/controllers/compose-assistant.js b/usr/palm/applications/com.palm.app.email/app/controllers/compose-assistant.js
46 index e4f2e91..2302338 100644
47 --- a/usr/palm/applications/com.palm.app.email/app/controllers/compose-assistant.js
48 +++ b/usr/palm/applications/com.palm.app.email/app/controllers/compose-assistant.js
49 @@ -172,8 +172,11 @@ var ComposeAssistant = Class.create({
50                                 visible: true,
51                                 menuClass: 'palm-white',
52                                 items: [
53 +                                       {label:$L('Priority'), icon:'priority', command:'priority'},
54                                         {label:$L('Attach'), icon:'attach', command:'attach'},
55 -                                       {label:$L('Send'), icon:'send', command:'send'}
56 +                                       {label:$L('Send'), icon:'send', command:'send'},
57 +                                       {label:$L('Save'), icon:'save', command:'save'},
58 +                                       {label:$L('Delete'),icon:'delete', command:'cancel'}
59                                 ]};
60  
61                 this.appMenuSaveIndex = 2;
62 @@ -609,16 +612,37 @@ var ComposeAssistant = Class.create({
63                                         break;
64  
65                                 case 'save':
66 -                                       this.draftIsDirty = true; // set to true to make sure the save occurs
67 -                                       this.saveDraft();
68 +                                       this.controller.showAlertDialog({
69 +                                       onChoose: function(value) {if (value == 'yes') {this.saveDraft();}},
70 +                                       title: $L("Save This Message?"),
71 +                                       choices:[
72 +                                               {label:$L('Yes'), value:"yes", type:'negative'},  
73 +                                               {label:$L("No"), value:"no", type: 'dismiss'}
74 +                                                       ]
75 +                                       });
76                                         break;
77  
78                                 case 'send':
79 -                                       this.send();
80 -                                       break;
81 +                                       this.controller.showAlertDialog({
82 +                                       onChoose: function(value) {if (value == 'yes') {this.send();}},
83 +                                       title: $L("Send This Message?"),
84 +                                       choices:[
85 +                                               {label:$L('Yes'), value:"yes", type:'negative'},  
86 +                                               {label:$L("No"), value:"no", type: 'dismiss'}
87 +                                                       ]
88 +                                       });
89 +                                       break;
90  
91                                 case 'cancel':
92 -                                       this.cancelCompose();
93 +                                       this.controller.showAlertDialog({
94 +                                       onChoose: function(value) {if (value == 'yes') {this.cancelCompose();}},
95 +                                       title: $L("Discard this Draft?"),
96 +                                       message: $L("This cannot be undone"),
97 +                                       choices:[
98 +                                               {label:$L('Yes'), value:"yes", type:'negative'},  
99 +                                               {label:$L("No"), value:"no", type: 'dismiss'}
100 +                                                       ]
101 +                                       });
102                                         break;
103                                                 
104                                 case 'priority':
105 @@ -1164,8 +1188,7 @@ ComposeAssistant.onLoad = function(controller, email) {
106         if (email.action === ComposeAssistant.kForwardAction) {
107                 controller.get('forwarded_msg_body').innerHTML = originalText;
108         } else {
109 -               bodyText += originalText;
110 -               editor.setStyle({'min-height':'320px', 'font-size': '18px'});
111 +               controller.get('forwarded_msg_body').innerHTML = originalText;
112         }
113         editor.innerHTML = bodyText;
114         
115 @@ -1212,6 +1235,6 @@ ComposeAssistant.replaceURIs = function(originalText, email) {
116  ComposeAssistant.kForwardAction = 'forward';
117  ComposeAssistant.kAppMenuHighPriority = $L('Set as High Priority');
118  ComposeAssistant.kAppMenuNormalPriority = $L('Set as Normal Priority');
119 -ComposeAssistant.kEmptySignatureRegex = /<span id="signature"><div style="font-family: arial, sans-serif; font-size: 12px;color: #999999;">[<br>]*<\/div>[<br>]*<\/span>/
120 +ComposeAssistant.kEmptySignatureRegex = /<span id="signature"><div style="font-family: Calibri, sans-serif; font-size: 16px;color: #999999;">[<br>]*<\/div>[<br>]*<\/span>/
121  ComposeAssistant.kForwardDraftDelimeter = "<span id='FORWARD_DRAFT_TEXT' class='display:none'></span>"; 
122  
123 diff --git a/usr/palm/applications/com.palm.app.email/app/controllers/email-dashboard-assistant.js b/usr/palm/applications/com.palm.app.email/app/controllers/email-dashboard-assistant.js
124 index e8278ac..df838f4 100644
125 --- a/usr/palm/applications/com.palm.app.email/app/controllers/email-dashboard-assistant.js
126 +++ b/usr/palm/applications/com.palm.app.email/app/controllers/email-dashboard-assistant.js
127 @@ -50,6 +50,13 @@ var EmailDashboardAssistant = Class.create({
128                         target = target.up('div.email-dashboard-tap-target');
129                 }
130  
131 +               var tDelete = false;
132 +
133 +               //check to see if the trash icon was tapped
134 +               if ( target.hasClassName('email-dashboard-tap-target-delete')) {
135 +                       tDelete = true;
136 +               }
137 +
138                 event.stopPropagation();
139                 if (target) {
140                         // disable the tap event to prevent keep handling user's multiple taps
141 @@ -61,7 +68,15 @@ var EmailDashboardAssistant = Class.create({
142                         if (accountId == "single") {
143                                 var folderId = target.readAttribute('folderid');
144                                 var messageId = target.readAttribute('messageid');
145 -                               this.showSingleMessage(accountId, folderId, messageId);
146 +                               
147 +                               if(tDelete)
148 +                               {
149 +                                       this.deleteSingleMessage(accountId, folderId, messageId);
150 +                               }
151 +                               else
152 +                               {
153 +                                       this.showSingleMessage(accountId, folderId, messageId);
154 +                               }
155                         } else if (accountId == "all") {
156                                 this.showAccount(); // just display the account scene
157                         } else {
158 @@ -171,6 +186,51 @@ var EmailDashboardAssistant = Class.create({
159                         });
160         },
161  
162 +       deleteSuccess: function(account, folder, message) {
163 +               //try to sync so that we get notified of the delete and the notification gets updated
164 +               Folder.syncFolder(folder, true);
165 +       },
166 +
167 +       deleteFailure: function(account, folder, message) {
168 +               //if we failed it is likely due to not getting the delete msg back from the server so we didnt remove the already deleted email notification
169 +
170 +               //set the ignoreClear flag so that the new email timestamp doesnt get set
171 +               //this will allow for us to close the stage but when the next update comes through we will still have all the unread emails to work with
172 +               this.ignoreClear = true;
173 +               if (this.notificationAssistant.allInboxesOn) {
174 +                       this.notificationAssistant.closeEmailDashboard();
175 +              }
176 +              else
177 +              {
178 +                       this.notificationAssistant.closeEmailDashboard(this.notifications[0]);
179 +              }
180 +
181 +               //try to sync the folder to get any updates
182 +               Folder.syncFolder(folder, true);
183 +       },
184 +
185 +       deleteSingleMessage: function(account, folder, message) {
186 +               var deleteReq = new Mojo.Service.Request('palm://com.palm.mail', {
187 +                       method: 'setDeleted',
188 +                       parameters: {'message':message, 'value': true },
189 +                       onSuccess: this.deleteSuccess.bind(this, account, folder, message),
190 +                       onFailure: this.deleteFailure.bind(this, account, folder, message)
191 +               });
192 +
193 +               //So should not need to do this but many have reported the emails not deleting due to issues with synchronization after 1.3.1 update
194 +               //So lets try to send the delete twice.
195 +//             var delet?eReq = new Mojo.Service.Request('palm://com.palm.mail', {
196 +//                     method: 'setDeleted',
197 +//                     parameters: {'message':message, 'value': true },
198 +//                     onSuccess: this.deleteSuccess.bind(this, account, folder, message),
199 +//                     onFailure: this.deleteFailure.bind(this, account, folder, message)
200 +//             });
201 +
202 +               //Since we are not consistently getting the message back from the server that something was deleted so that the notification bar
203 +               //gets updated go ahead and close it if we get the message the notification bar will come back up. Truly sucks that it doesnt always give us$
204 +               this.deleteFailure(account, folder, message);
205 +       },
206 +
207         showFolder: function(accountId, folderId, resp) {
208                 this.notificationAssistant.setFolderViewedTimestamp(folderId, new Date().getTime());
209                 this.notificationAssistant.clearAccount(accountId, folderId);
210 diff --git a/usr/palm/applications/com.palm.app.email/app/controllers/list-assistant.js b/usr/palm/applications/com.palm.app.email/app/controllers/list-assistant.js
211 index e66f292..665afce 100644
212 --- a/usr/palm/applications/com.palm.app.email/app/controllers/list-assistant.js
213 +++ b/usr/palm/applications/com.palm.app.email/app/controllers/list-assistant.js
214 @@ -49,7 +49,8 @@ var ListAssistant = Class.create(App.Scene, {
215                         visible:true,
216                         items: [
217                                 {label:$L('Compose'), icon:'compose', command:'compose'},
218 -                               {},
219 +                               {label:$L('Delete All'), icon:'delete', command:'deleteall'},
220 +                               {label:$L('All Read'), icon:'priority', command:'readall'},
221                                 {label:$L('Update'), icon:'sync', command:'sync'}
222                         ]};
223         this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel);
224 @@ -66,6 +67,15 @@ var ListAssistant = Class.create(App.Scene, {
225                                         ListAssistant.kSortBySenderMenuItem, 
226                                         ListAssistant.kSortBySubjectMenuItem
227                         ]},
228 +                       //TheInnKeeper
229 +                       {
230 +                               label:$L('Delete View Next ...'),
231 +                               items: [
232 +                                       {label:$L('Newer'), command:'deleteNewer', checkEnabled:true}, 
233 +                                       {label:$L('Older'), command:'deleteOlder', checkEnabled:true}, 
234 +                                       {label:$L('List'), command:'deleteList', checkEnabled:true},
235 +                       ]},
236 +                       //End TheInnKeeper
237                         {label:$L('Preferences & Accounts'), command:Mojo.Menu.prefsCmd, disabled: false},
238                         {label:$L('Help'), command:Mojo.Menu.helpCmd, disabled:false}
239                 ]};
240 @@ -89,7 +99,7 @@ var ListAssistant = Class.create(App.Scene, {
241                                         fixedHeightItems:true,
242                                         itemTemplate: 'list/email_entry',
243                                         swipeToDelete: true,
244 -                                       autoconfirmDelete: true,
245 +                                       autoconfirmDelete: false,
246                                         uniquenessProperty: 'id',
247                                         dividerTemplate: 'list/date_separator',
248                                         dividerFunction: function(email) { return email.category; },
249 @@ -231,6 +241,14 @@ var ListAssistant = Class.create(App.Scene, {
250    handleCommand: function(event) {
251         if (event.type == Mojo.Event.command) {
252                 switch (event.command) {
253 +                       case 'deleteall':
254 +                               this.handleDeleteAll();
255 +                               break;
256 +
257 +                       case 'readall':
258 +                               this.handleReadAll();
259 +                               break;
260 +
261                         case 'compose':
262                                 this.handleSend();
263                                 break;
264 @@ -263,6 +281,17 @@ var ListAssistant = Class.create(App.Scene, {
265                         case Mojo.Menu.helpCmd:
266                                 MenuController.showHelp();
267                                 break;
268 +               //TheInnKeeper
269 +                       case 'deleteNewer':
270 +                               this.updateDeleteNext("newer");
271 +                               break;
272 +                       case 'deleteOlder':
273 +                               this.updateDeleteNext("older");
274 +                               break;
275 +                       case 'deleteList':
276 +                               this.updateDeleteNext("list");
277 +                               break;
278 +               //End TheInnKeeper
279                 }
280         }
281         // Enable prefs & help menu items
282 @@ -761,6 +790,81 @@ var ListAssistant = Class.create(App.Scene, {
283                         }
284                 }
285         },
286 +  handleDeleteAll: function (event) {
287 +       
288 +       var totalCount = 0;
289 +                       
290 +       totalCount = this.emailListElement.mojo.getLength();
291 +                                       
292 +       this.controller.showAlertDialog({
293 +               onChoose: function(value) {
294 +                       if(value == 'yes') {
295 +                               //Delete all items in this folder
296 +//                             this.deleteAll();
297 +                               Folder.emptyFolder(this.folderObj.folderId);
298 +                       }
299 +               },
300 +               title: '<b>' + $L('Delete All') + '</b>',
301 +               message: $L('Are you sure you want to delete all ') + "<b>" + totalCount + "</b>" + $L(' items in this folder?'),
302 +               choices: [
303 +                       {label:$L('Yes'), value:'yes', type:'affirmative'},
304 +                       {label:$L('No'), value:'no', type:'alert'}
305 +                       ]
306 +       });
307 +  },
308 +  
309 +  handleReadAllResponse: function (event) {
310 +  },
311 +
312 +  readAll: function(tleft){
313 +       var count = this.emailListElement.mojo.getLength();
314 +       var id;
315 +       while(tleft > 0) 
316 +       {       
317 +               var item = this.emailListElement.mojo.getNodeByIndex((tleft - 1));      
318 +               if(item !== undefined)
319 +               {
320 +                       id = item.id;
321 +                       if(id)
322 +                       {
323 +                               this.controller.serviceRequest(Email.identifier, {
324 +                                       method: 'setRead',
325 +                                       parameters: {'message':id, 'value': true },
326 +                                       onSuccess: this.handleReadAllResponse.bind(this),
327 +                                       onFailure: this.handleReadAllResponse.bind(this)
328 +                                       });
329 +                       }
330 +               
331 +                       tleft = tleft - 1;
332 +               }
333 +               else
334 +               {
335 +                       tleft = tleft - 1;
336 +               }
337 +       }       
338 +  },
339 +  
340 +
341 +  handleReadAll: function (event) {
342 +               var totalCount = 0;
343 +               totalCount = this.emailListElement.mojo.getLength();
344 +               if (totalCount > 0) {
345 +                       this.controller.showAlertDialog({
346 +                   onChoose: function(value) {
347 +                               if(value == 'yes') {
348 +                                               var tleft = totalCount;
349 +                                                       this.readAll(tleft);
350 +                       }
351 +                               },
352 +                       title: '<b>' + $L('All Read') + '</b>',
353 +                       message: $L('Are you sure you want to mark ') + "<b>" + totalCount + "</b>" + $L(' items in this folder read?'),
354 +                    choices: [
355 +                       {label:$L('Yes'), value:'yes', type:'affirmative'},
356 +                        {label:$L('No'), value:'no', type:'alert'}
357 +                    ]
358 +                       });
359 +               }
360 +  },
361  
362    updateFolderStatusModel: function(response) {
363         if (!response.folders) {
364 @@ -1142,6 +1246,13 @@ var ListAssistant = Class.create(App.Scene, {
365          this.dataSource.minimizeSubscription();
366          // TODO: minimize this.folderSubscription.
367      }
368 +    //TheInnKeeper
369 +    ,
370 +    updateDeleteNext: function(delDirection){
371 +       Mojo.Log.info("Setting del Direction: " + delDirection);
372 +       EmailAppDepot.getDepot().setDeleteDirection(delDirection);
373 +    }
374 +    //End TheInnKeeper
375  });
376  
377  ListAssistant.syncDate = function(timestamp) {
378 diff --git a/usr/palm/applications/com.palm.app.email/app/controllers/message-assistant.js b/usr/palm/applications/com.palm.app.email/app/controllers/message-assistant.js
379 index 761069e..ff246a5 100644
380 --- a/usr/palm/applications/com.palm.app.email/app/controllers/message-assistant.js
381 +++ b/usr/palm/applications/com.palm.app.email/app/controllers/message-assistant.js
382 @@ -61,23 +61,46 @@ var MessageAssistant = Class.create({
383                 if (focusStage === true) {
384                         this.focusStageTimer = this.focusEmailStage.bind(this).delay(0.6);
385                 }
386 +               this.requests = [];
387 +
388 +               //TheInnKeeper
389 +               EmailAppDepot.getDepot().getDeleteDirection( function(delDirection){
390 +                       if (delDirection) {
391 +                               Mojo.Log.info("Setting Delete Direction: " + delDirection);
392 +                               MessageAssistant.deleteDirection = delDirection;
393 +                       }else{
394 +                               Mojo.Log.info("No value Found setting Older");
395 +                               MessageAssistant.deleteDirection = "older";
396 +                               EmailAppDepot.getDepot().setDeleteDirection("older");
397 +                       }
398 +                       
399 +               });
400 +               //End TheInnKeeper      
401         },
402  
403         setup: function() {
404                 this.setupMessage(); // get message details and setup message webview widget
405 -               
406 +               // move-to menu
407 +               this.moveToMenuModel = {
408 +                       items: []
409 +                       };      
410 +       
411                 // setup menu   
412                 this.cmdMenuModel = {
413                                 visible:true,
414                                 items: [
415 +                                       {label:$L('Move'),      icon:'file',      submenu:'move-to', disabled: true},
416 +                                       {label:$L('Set Flag'),  icon:'make-vip',      command:'flag'},
417                                         {label:$L('Reply'),     icon:'reply',     command:'reply'},
418                                         {label:$L('Reply all'), icon:'reply-all', command:'replyAll'},
419                                         {label:$L('Forward'),   icon:'forward-email', command:'forward'},
420 +                                       {label:$L('MarkUnread'),   icon:'back', command:'mark-unread'},
421                                         {label:$L('Delete'),    icon:'delete',    command:'delete'}
422                                 ]};
423                 this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel);
424 -               
425 -               this.markUnreadMenuItem =     {label:MessageAssistant.kAppMenuMarkUnread, shortcut:'k', command:'mark-unread'};
426 +               this.controller.setupWidget('move-to', undefined, this.moveToMenuModel);
427 +
428 +               this.markUnreadMenuItem =     {label:MessageAssistant.kAppMenuMarkUnread, shortcut:'u', command:'mark-unread'};
429                 this.markSetFlagMenuItem =    {label:MessageAssistant.kAppMenuSetFlag, shortcut:'g', command:'flag'};
430                 this.showRecipientsMenuItem = {label:MessageAssistant.kAppMenuShowRecipients, shortcut:'s', command:'show-recipients'};
431                 
432 @@ -143,6 +166,7 @@ var MessageAssistant = Class.create({
433                 Mojo.Event.listen(this.controller.stageController.document, Mojo.Event.activate, this.boundUpdateRecipientStatus);
434  
435                 Mojo.Event.listen(this.controller.getSceneScroller(), Mojo.Event.scrollStarting, this.addAsScrollListener.bind(this));
436 +               Mojo.Event.listen(this.controller.document, Mojo.Event.flick, this.flickHandler.bind(this));
437                 
438                 this.subjectElement = this.controller.get('email_subject');
439                 this.readViewContainer = this.controller.get('email-readview-content-container');
440 @@ -175,9 +199,27 @@ var MessageAssistant = Class.create({
441                 Mojo.Event.stopListening(this.controller.stageController.document, Mojo.Event.activate, this.boundUpdateRecipientStatus);
442                 //  This currently does nothing. Commenting out
443                 //  Message.closeMessage(this.controller, this.data.id);
444 +               this.requests.each(function (r) { r.cancel();});
445         },
446 -
447 -       aboutToActivate: function(callback) {
448 +       
449 +       renderFolderList: function(data) {
450 +               var padding = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
451 +               if (data.list) {
452 +                       this.moveToMenuModel.items = [];
453 +                       data.list.each(function(folder) {
454 +                               var name = padding.substring(0, folder.depth*24) + folder.name;
455 +                               var icon = 'server-folder-icon';
456 +                               if (this.account.folder === folder.id) {
457 +                                       icon = 'server-folder-checkmark checked';
458 +                               }
459 +                               this.moveToMenuModel.items.push({label: name, command: 'move-to-cmd_' + folder.id, icon: icon});
460 +                       }.bind(this));
461 +                       this.cmdMenuModel.items[0].disabled = false;
462 +                       this.controller.modelChanged(this.moveToMenuModel);
463 +                       this.controller.modelChanged(this.cmdMenuModel);
464 +               }
465 +},
466 + aboutToActivate: function(callback) {
467                 if (this.delayActivate === true) {
468                         this.readyToActivateCallback = callback;
469                 } else {
470 @@ -376,6 +418,8 @@ var MessageAssistant = Class.create({
471                 var assistant = Mojo.Controller.getAppController().assistant;
472                 assistant.notificationAssistant.clear(resp.account, resp.folder, this.data.id);
473                 assistant.clearDebounce('m'+this.data.id);
474 +               this.requests.push(Folder.subscribeAccountFolderList(this.account.account, undefined, this.renderFolderList.bind(this)));
475 +
476         },
477  
478         updateRecipientStatus: function() {
479 @@ -1442,8 +1486,21 @@ var MessageAssistant = Class.create({
480         handleCommand: function(event) {
481                 if (event.type == Mojo.Event.command) {
482                         try {
483 -                               switch (event.command) {
484 -                                       case 'copyAll':
485 +                               var targetId = null;
486 +                               if (event.command.substring(0, 11) === 'move-to-cmd') {
487 +                                       targetId = event.command.substring(event.command.lastIndexOf('_')+1);
488 +                                       event.command = 'move-to-cmd';
489 +                               }
490 +                       switch (event.command) {
491 +                                       case 'move-to-cmd':
492 +                                               if (targetId) {
493 +                                                       Mojo.Log.error('moving to folder: %s', targetId);
494 +                                                       Message.moveMessage(this.controller, this.account.emailId, targetId);
495 +                                                       this.controller.stageController.popScene();
496 +                                               }
497 +                                               break;
498 +
499 +                               case 'copyAll':
500                                                 this.copyAll(event);
501                                                 break;
502                                                 
503 @@ -1473,14 +1530,10 @@ var MessageAssistant = Class.create({
504                                                 var currentLabel = this.markUnreadMenuItem.label;
505                                                 var markRead = (currentLabel == MessageAssistant.kAppMenuMarkRead);
506                                                 Message.setRead(this.data.id, markRead);
507 -                                               if (markRead) {
508 -                                                       this.markUnreadMenuItem.label = MessageAssistant.kAppMenuMarkUnread;
509 -                                               } else {
510 -                                                       this.markUnreadMenuItem.label = MessageAssistant.kAppMenuMarkRead;
511 -                                               }
512 -                                               
513 +
514 +                                               this.markUnreadMenuItem.label = MessageAssistant.kAppMenuMarkUnread;
515                                                 this.updateMessageInParentScene();
516 -                                               
517 +                                               this.controller.stageController.popScene();
518                                                 break;
519  
520                                         case 'flag':
521 @@ -1854,6 +1907,14 @@ var MessageAssistant = Class.create({
522                         }
523                 }
524         },
525 +       flickHandler: function(event) {
526 +           if (event.velocity.x > 0) {
527 +               this.boundGotoNextEmailNewer();
528 +        }
529 +        else {
530 +            this.boundGotoNextEmailOlder();
531 +        }
532 +       },
533  
534         gotoNextEmail: function(direction) {
535                 if (this.nextMessages !== undefined && this.nextMessages[direction] !== undefined) {
536 @@ -2143,8 +2204,15 @@ var MessageAssistant = Class.create({
537         },
538  
539         deleteEmail: function() {
540 -               Message.setDeleted(this.data.id, true);
541 -               this.controller.stageController.popScene();
542 +               //TheInnKeeper
543 +               Mojo.Log.info("Delete Direction: " + MessageAssistant.deleteDirection);
544 +                 Message.setDeleted(this.data.id, true);       
545 +          if(MessageAssistant !== "list" && this.nextMessages[MessageAssistant.deleteDirection] !== undefined){       
546 +                  this.gotoNextEmail(MessageAssistant.deleteDirection);       
547 +          }else{
548 +                  this.controller.stageController.popScene();
549 +          }                 
550 +      //End InnKeeper
551         }
552  });
553  
554 diff --git a/usr/palm/applications/com.palm.app.email/app/controllers/notification-assistant.js b/usr/palm/applications/com.palm.app.email/app/controllers/notification-assistant.js
555 index e6af5d5..7d3578e 100644
556 --- a/usr/palm/applications/com.palm.app.email/app/controllers/notification-assistant.js
557 +++ b/usr/palm/applications/com.palm.app.email/app/controllers/notification-assistant.js
558 @@ -20,7 +20,7 @@ var NotificationAssistant = Class.create({
559                 // sending broadcast and dashboard updates when the user would see it because of the
560                 // scene he's in.
561                 this.filter = {};
562 -               this.newMailDeferralTimeout = 7;
563 +               this.newMailDeferralTimeout = 0;//7;
564         },
565  
566         windowBlurFocusHandler: function(event) {
567 @@ -234,8 +234,10 @@ var NotificationAssistant = Class.create({
568  
569                         var folderObj;
570                         var listIndex;
571 +
572                         for (listIndex = 0; listIndex < resp.list.length; ++listIndex) {
573                                 folderObj = resp.list[listIndex];
574 +
575                                 if (this.shouldDoNotification(folderObj)) {
576                                         // Add to the UI model only if notify is set and the count shows there's items to add
577                                         if (folderObj.notify === true && folderObj.count > 0) {
578 @@ -658,10 +660,10 @@ var NotificationAssistant = Class.create({
579                         // displayActive and displayDimmed
580                         if (data.event == 'displayOff') {
581                                 this.displayOff = true;
582 -                               this.newMailDeferralTimeout = 0.5;
583 +                               this.newMailDeferralTimeout = 0;//0.5;
584                         } else if (data.event == 'displayOn') {
585                                 this.displayOff = false;
586 -                               this.newMailDeferralTimeout = 7;
587 +                               this.newMailDeferralTimeout = 0;//7;
588                         }
589  
590                         Mojo.Log.info("displayUpdate displayOff", this.displayOff, "event", data.event);
591 diff --git a/usr/palm/applications/com.palm.app.email/app/models/Email.js b/usr/palm/applications/com.palm.app.email/app/models/Email.js
592 index 7a69e15..fb0f108 100644
593 --- a/usr/palm/applications/com.palm.app.email/app/models/Email.js
594 +++ b/usr/palm/applications/com.palm.app.email/app/models/Email.js
595 @@ -159,7 +159,7 @@ var Email = Class.create({
596                                                         if (r.displayName === r.address) 
597                                                                 toStr = r.displayName;
598                                                         else 
599 -                                                               toStr = "#{displayName} <#{address}>".interpolate(r);
600 +                                                               toStr = "#{displayName}".interpolate(r);
601                                                         toAddressList.push(toStr);
602                                                 }
603                                         } else if (r.role === EmailRecipient.roleCc) {
604 @@ -168,7 +168,7 @@ var Email = Class.create({
605                                                         if (r.displayName === r.address) 
606                                                                 ccStr = r.displayName;
607                                                         else 
608 -                                                               ccStr = "#{displayName} <#{address}>".interpolate(r);
609 +                                                               ccStr = "#{displayName}".interpolate(r);
610                                                         ccAddressList.push(ccStr);
611                                                 }
612                                         }
613 @@ -180,33 +180,34 @@ var Email = Class.create({
614                                         this.text += $L("<b>From:</b> ") + "#{displayName}".interpolate(fromObj).escapeHTML() + "<br/>";
615                                 }
616                                 else {
617 -                                       this.text += $L("<b>From:</b> ") + "#{displayName} <#{address}>".interpolate(fromObj).escapeHTML() + "<br/>" 
618 +                                       this.text += $L("<b>From:</b> ") + "#{displayName}".interpolate(fromObj).escapeHTML() + "<br/>" 
619                                 };
620 -                               this.text += $L("<b>Date:</b> ") + Mojo.Format.formatDate(new Date(parseInt(original.timeStamp)), {date:'medium', time:'short'}) + "<br/>";
621 -                               this.text += $L("<b>Subject:</b> #{summary}").interpolate(original) + "<br/>";
622 +                               this.text += $L("<b>Sent:</b> ") + Mojo.Format.formatDate(new Date(parseInt(original.timeStamp)), {date:'full', time:'short'}) + "<br/>";               
623                                 if (toAddressList.length > 0) {
624                                         this.text += $L("<b>To:</b> ") + "#{list}".interpolate({list:toAddressList.join("; ")}).escapeHTML() + "<br/>";
625                                 }
626                                 if (ccAddressList.length > 0) {
627 -                                       this.text += $L("<b>CC:</b> ") + "#{list}".interpolate({list:ccAddressList.join("; ")}).escapeHTML() + "<br/>";
628 +                                       this.text += $L("<b>Cc:</b> ") + "#{list}".interpolate({list:ccAddressList.join("; ")}).escapeHTML() + "<br/>";
629                                 }
630 +                               this.text += $L("<b>Subject:</b> #{summary}").interpolate(original) + "<br/>";
631                                 this.text += "<br/>";
632                         } else {
633                                 
634 -                               // reply case. Integrate header info with sentence
635 -                               var strArgs = {
636 -                                       "monthDate": "",
637 -                                       "displayName": fromObj.displayName,
638 -                                       "address": fromObj.address
639 +                               if (fromObj.displayName === fromObj.address) {
640 +                                       this.text += $L("<b>From:</b> ") + "#{displayName}".interpolate(fromObj).escapeHTML() + "<br/>";
641 +                               }
642 +                               else {
643 +                                       this.text += $L("<b>From:</b> ") + "#{displayName}".interpolate(fromObj).escapeHTML() + "<br/>" 
644                                 };
645 -                               if (original.timeStamp) {
646 -                                       // <Month (short version)> <Day>,<Year> at <time>
647 -                                       strArgs.monthDate = Mojo.Format.formatDate(new Date(parseInt(original.timeStamp, 10)), {date:'medium', time:'short'});
648 -                                       this.text += $L("On #{monthDate}, #{displayName} <#{address}> wrote: ").interpolate(strArgs).escapeHTML();
649 -                               } else {
650 -                                       this.text += $L("#{displayName} <#{address}> wrote: ").interpolate(strArgs).escapeHTML();
651 +                               this.text += $L("<b>Sent:</b> ") + Mojo.Format.formatDate(new Date(parseInt(original.timeStamp)), {date:'full', time:'short'}) + "<br/>";               
652 +                               if (toAddressList.length > 0) {
653 +                                       this.text += $L("<b>To:</b> ") + "#{list}".interpolate({list:toAddressList.join("; ")}).escapeHTML() + "<br/>";
654 +                               }
655 +                               if (ccAddressList.length > 0) {
656 +                                       this.text += $L("<b>Cc:</b> ") + "#{list}".interpolate({list:ccAddressList.join("; ")}).escapeHTML() + "<br/>";
657                                 }
658 -                               this.text += "<br><br>";
659 +                               this.text += $L("<b>Subject:</b> #{summary}").interpolate(original) + "<br/>";
660 +                               this.text += "<br/>";
661                         }
662                         this.originalText = original.text;
663                 } else {
664 @@ -347,7 +348,7 @@ var Email = Class.create({
665                 else if (this.action == "reply" || this.action == "replyAll") {
666                         Message.setReplied(this.id, true);
667                         // No SmartReply in version 1.0
668 -                       //params.replyMessage = this.id;
669 +                       params.replyMessage = this.id;
670                 }
671  
672                 // Quick strip: replace <br> and <p> with newline and then strip all html tags
673 @@ -380,8 +381,8 @@ Email.getPriorityClass = function(priority) {
674         return priority;
675  }
676  
677 -Email.kSignaturePlaceholder = "<span style='font-family:Prelude, Verdana, san-serif;'><br><br></span><span id='signature'></span>";
678 -Email.kReplyForwardSetupElems = "<br><br>" + Email.kSignaturePlaceholder + "<span style='color:navy; font-family:Prelude, Verdana, san-serif; '><hr align='left' style='width:75%'/>";
679 +Email.kSignaturePlaceholder = "<span style='font-family:Prelude, Calibri, san-serif; font-size:16px; color:black;'><br><br></span><span id='signature'></span>";
680 +Email.kReplyForwardSetupElems = "<span style='font-family:Prelude, Calibri, san-serif; font-size:16px'>" + Email.kSignaturePlaceholder + "<hr align='left' style='width:75%'/>";
681  
682  Email.kSubjectPrefixRe = $L("Re: ");
683  Email.kSubjectPrefixFw = $L("Fw: ");
684 diff --git a/usr/palm/applications/com.palm.app.email/app/models/EmailAppDepot.js b/usr/palm/applications/com.palm.app.email/app/models/EmailAppDepot.js
685 index 6179cfd..c6f8713 100644
686 --- a/usr/palm/applications/com.palm.app.email/app/models/EmailAppDepot.js
687 +++ b/usr/palm/applications/com.palm.app.email/app/models/EmailAppDepot.js
688 @@ -30,6 +30,17 @@ var EmailAppDepot = Class.create({
689                 Mojo.Log.info("setShowFavorites id="+accountId+", "+$H(obj).inspect())
690                 this.depot.simpleAdd(accountId, obj);
691         },
692 +       //TheInnKeeper
693 +       getDeleteDirection: function(callback) {
694 +               Mojo.Log.info("in getDeleteDirectin");
695 +               this.depot.simpleGet('deleteDirection', callback);
696 +       },
697 +
698 +       setDeleteDirection: function(direction) {
699 +               Mojo.Log.info("delDirection direction="+direction)
700 +               this.depot.simpleAdd('deleteDirection', direction);
701 +       },
702 +       //End TheInnKeeper
703         
704         getDefaultSignature: function(callback) {
705                 if (this.defaultSignature) {
706 diff --git a/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/multiple-accounts-template.html b/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/multiple-accounts-template.html
707 index 38c8b71..0941eb1 100644
708 --- a/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/multiple-accounts-template.html
709 +++ b/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/multiple-accounts-template.html
710 @@ -5,6 +5,10 @@
711      </div>
712       <div class="palm-dashboard-icon email">
713       </div>
714 +  </div>
715 +  <div class="palm-dashboard-icon-container email-dashboard-tap-target email-dashboard-tap-target-delete" style="float: right; margin-left: 4px;" accountid="single" folderid="#{folder}" messageid="#{message}">
716 +       <div class="palm-dashboard-icon delete">
717 +       </div>
718    </div>   
719    <div class="palm-dashboard-text-container email-dashboard-tap-target" accountid="single" folderid="#{folder}" messageid="#{message}">
720       <div class="dashboard-title">
721 diff --git a/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/single-account-template.html b/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/single-account-template.html
722 index 31a4683..5c4619c 100644
723 --- a/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/single-account-template.html
724 +++ b/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/single-account-template.html
725 @@ -5,6 +5,10 @@
726      </div>
727       <div class="palm-dashboard-icon #{accountDomain}">
728       </div>
729 +  </div>
730 +  <div class="palm-dashboard-icon-container email-dashboard-tap-target email-dashboard-tap-target-delete" style="float: right; margin-left: 4px;" accountid="single" folderid="#{folder}" messageid="#{message}">
731 +       <div class="palm-dashboard-icon delete">
732 +       </div>
733    </div>   
734    <div class="palm-dashboard-text-container email-dashboard-tap-target" accountid="single" folderid="#{folder}" messageid="#{message}">
735       <div class="dashboard-title">
736 diff --git a/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/single-email-template.html b/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/single-email-template.html
737 index 0eca342..6307dc5 100644
738 --- a/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/single-email-template.html
739 +++ b/usr/palm/applications/com.palm.app.email/app/views/email-dashboard/single-email-template.html
740 @@ -1,7 +1,12 @@
741 -<div class="dashboard-notification-module single">
742 +<div class="dashboard-notification-module">
743    <div class="palm-dashboard-icon-container email-dashboard-tap-target" accountid="#{account}">
744       <div class="palm-dashboard-icon #{accountDomain}">
745       </div>
746 +  </div>
747 +  <div class="palm-dashboard-icon-container email-dashboard-tap-target email-dashboard-tap-target-delete" style="float: right; margin-left: 4px;" 
748 +               accountid="single" folderid="#{folder}" messageid="#{message}">
749 +        <div class="palm-dashboard-icon delete">
750 +       </div>
751    </div>   
752    <div class="palm-dashboard-text-container email-dashboard-tap-target" accountid="single" folderid="#{folder}" messageid="#{message}">
753       <div class="dashboard-title">
754 diff --git a/usr/palm/applications/com.palm.app.email/stylesheets/notifications.css b/usr/palm/applications/com.palm.app.email/stylesheets/notifications.css
755 index 5ba21eb..fdf9fa9 100644
756 --- a/usr/palm/applications/com.palm.app.email/stylesheets/notifications.css
757 +++ b/usr/palm/applications/com.palm.app.email/stylesheets/notifications.css
758 @@ -78,3 +78,9 @@ Copyright 2009 Palm, Inc.  All rights reserved.
759  .palm-dashboard-icon.gmail                     { background: url(../images/notification-large-gmail.png) center left no-repeat; }
760  .palm-dashboard-icon.yahoo                     { background: url(../images/notification-large-yahoo.png) center left no-repeat; }
761  .palm-dashboard-icon.aol                       { background: url(../images/notification-large-aol.png) center left no-repeat; }
762 +
763 +/*To support delete of email from notification*/
764 +.palm-dashboard-icon.delete           { background: url(../images/icon_trash.png) center center no-repeat; }
765 +
766 +.email-dashboard-tap-target-delete {
767 +}