Updated system prefs patches
[webos-internals:imagineer1981s-modifications.git] / advanced / advanced-system-prefs-cal-prefs-vzw.patch
1 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
2 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
3 @@ -86,6 +86,8 @@
4  ,      handleLaunch: function(param) {
5                 Mojo.Log.info("**********in handle launch");
6                 
7 +               this.reminderManager.removePlayNotificationSoundTask();
8 +
9                 // TEMP Ignore the first time we get called which is at boot time. We need this until framework
10                 // gives us a flag to let us now if this being called at boot.
11                 this.handleLaunchCount++;
12 @@ -137,6 +139,24 @@
13                 else if (launchParams.launchType == "passwordInvalid") {
14                         this.showPasswordNotification(launchParams);
15                 }
16 +               else if (launchParams.closeReminderAlert) {
17 +                       if(Mojo.Controller.getAppController().getStageController("calendar-alarm-short")) {
18 +                               Mojo.Controller.getAppController().closeStage("calendar-alarm-short");
19 +                               
20 +                               this.reminderManager.schedulePlayNotificationSoundTask(0);
21 +                       }
22 +                       
23 +                       if(Mojo.Controller.getAppController().getStageController("calendar-alarm-long")) {
24 +                               Mojo.Controller.getAppController().closeStage("calendar-alarm-long");
25 +                       
26 +                               this.reminderManager.schedulePlayNotificationSoundTask(0);
27 +                       }
28 +               }               
29 +               else if (launchParams.playNotificationSound) {
30 +                       // Delay playing to go around WebOS bug (sound not playing).
31 +
32 +                       setTimeout(this.playNotificationSound.bind(this, launchParams.playNotificationSound), 1000);
33 +               }
34                 else {
35                         //we always want to launch today rather than the last viewed day
36                         //per bug NOV-29174
37 @@ -162,6 +182,12 @@
38                 }
39         },
40  
41 +       playNotificationSound: function(playNotificationSound) {
42 +               this.reminderManager.playNotificationSound();
43 +                       
44 +               this.reminderManager.schedulePlayNotificationSoundTask(playNotificationSound);
45 +       },
46 +
47         launchDayView: function(stageController, date, appExists) {
48                 Mojo.Log.info("********handle launch day view");
49  
50 @@ -487,8 +513,16 @@
51                                 }.bind(this)
52                         });
53                 } else {
54 -                       // Otherwise show the Day View
55 -                       stageController.pushScene({name: "day", transition: Mojo.Transition.crossFade, disableSceneScroller: true});
56 +                       if(this.prefsManager.prefs) {
57 +                               if(this.prefsManager.prefs.eventsViewDisplayMode == "default")
58 +                                       stageController.pushScene({name: this.prefsManager.prefs.eventsViewDisplayType, transition: Mojo.Transition.crossFade, disableSceneScroller: true});
59 +                               else
60 +                                       stageController.pushScene({name: this.prefsManager.prefs.eventsViewDisplayMode, transition: Mojo.Transition.crossFade, disableSceneScroller: true});
61 +                       }
62 +                       else {
63 +                               // Otherwise show the Day View
64 +                               stageController.pushScene({name: "day", transition: Mojo.Transition.crossFade, disableSceneScroller: true});
65 +                       }
66                 }
67         },
68  
69 --- .orig/usr/palm/applications/com.palm.app.calendar/stylesheets/calendar.css
70 +++ /usr/palm/applications/com.palm.app.calendar/stylesheets/calendar.css
71 @@ -74,6 +74,14 @@
72    background: url(../images/menu-icon-all.png) center center no-repeat;
73  }
74  
75 +.palm-menu-icon.new-timed {
76 +       background-image: url(../images/menu-icon-newevent.png);
77 +}
78 +
79 +.palm-menu-icon.new-allday {
80 +       background-image: url(../images/menu-icon-newadevent.png);
81 +}
82 +
83  /* Calendar Selector in Month/Week/Day view headers */
84  .header-cal-source {
85         position:relative;
86 @@ -156,3 +164,14 @@
87    left: auto !important;
88    right: 0px;
89  }
90 +
91 +#jumpto-picker .title.left.mv-picker-label {
92 +       font-size: 18px;
93 +       padding-left: 0px;
94 +       padding-top: 20px;
95 +       line-height: 24px;
96 +}
97 +
98 +#jumpto-picker .mv-picker-capsules-container {
99 +       margin-right: -8px;
100 +}
101 --- .orig/usr/palm/applications/com.palm.app.calendar/app/models/calendar-prefs-manager.js
102 +++ /usr/palm/applications/com.palm.app.calendar/app/models/calendar-prefs-manager.js
103 @@ -43,16 +43,22 @@
104  
105  
106         loadFromDB: function() {
107 -               this.loadRequest = this.db.getCalendarPrefs (this.onLoadFromDB, this.onLoadFromDBFailed);
108 +               this.loadRequest = this.db.getCalendarPrefs (this.onLoadFromDB, this.onLoadFromDBFailed, true);
109         },
110  
111  
112         onLoadFromDB: function (response, request) {
113 +               if(response.fired) {
114 +                       this.loadRequest = this.db.getCalendarPrefs (this.onLoadFromDB, this.onLoadFromDBFailed, true);
115 +               
116 +                       return;
117 +               }
118 +               
119                 Mojo.Log.info("getcalendarPrefs Success: %j", response);
120  
121                 // Release the db service request:
122 -               this.loadRequest.cancel();
123 -               this.loadRequest = undefined;
124 +//             this.loadRequest.cancel();
125 +//             this.loadRequest = undefined;
126                 
127                 var results = response && response.results;
128                 var resultsLength = results && results.length;
129 @@ -89,7 +95,31 @@
130                         Foundations.Data.DB.del(idsToDelete);
131                 }
132                         
133 -                       
134 +               // Check for existence of advanced configuration
135 +               if(this.prefs.eventsViewDisplayMode == undefined)
136 +                       this.prefs.eventsViewDisplayMode = "default";
137 +               
138 +               if(this.prefs.eventsViewDisplayType == undefined)
139 +                       this.prefs.eventsViewDisplayType = "day";
140 +
141 +               if(this.prefs.visualNotification == undefined)
142 +                       this.prefs.visualNotification = true;
143 +
144 +               if(this.prefs.blinkNotification == undefined)
145 +                       this.prefs.blinkNotification = true;
146 +
147 +               if(this.prefs.snoozeEventReminder == undefined)
148 +                       this.prefs.snoozeEventReminder = -300;
149 +
150 +               if(this.prefs.snoozeAllDayEventReminder == undefined)
151 +                       this.prefs.snoozeAllDayEventReminder = -3600;
152 +
153 +               if(this.prefs.notificationRepeatInterval == undefined)
154 +                       this.prefs.notificationRepeatInterval = 0;
155 +
156 +               if(this.prefs.notificationRepeatLimit == undefined)
157 +                       this.prefs.notificationRepeatLimit = 3;
158 +               
159                 //Check to make sure the user didn't change country, affecting start of week since last time we saved prefs
160                 var startOfWeek = Mojo.Format.getFirstDayOfWeek()+1;
161                 
162 @@ -109,8 +139,8 @@
163                 Mojo.Log.error ("PrefsManager: getCalendarsPrefs service call failed: %j", response);
164  
165                 // Release the db service request:
166 -               this.loadRequest.cancel();
167 -               this.loadRequest = undefined;
168 +//             this.loadRequest.cancel();
169 +//             this.loadRequest = undefined;
170  
171                 this.setDefaults();
172         },
173 @@ -132,6 +162,14 @@
174                 ,       startOfWeek                                     : startOfWeek
175                 ,       startTimeOfDay                          : -226799992
176                 ,       userChangedStartOfWeek          : false
177 +               ,       eventsViewDisplayMode   : "default"
178 +               ,       eventsViewDisplayType   : "day"
179 +               ,       snoozeEventReminder             : 0
180 +               ,       snoozeAllDayEventReminder : 0
181 +               ,       blinkNotification                       : false
182 +               ,       visualNotification              : true
183 +               ,       notificationRepeatInterval : 0
184 +               ,       notificationRepeatLimit : 3
185                 };
186  
187                 // Cache the db service request to prevent if from being garbage collected:
188 @@ -167,7 +205,7 @@
189                 this.prefs._rev = results.rev;
190  
191                 // Update preference change observers:
192 -               this.notifyObservers();
193 +//             this.notifyObservers();
194         },
195  
196         
197 --- .orig/usr/palm/applications/com.palm.app.calendar/app/models/database.manager.js
198 +++ /usr/palm/applications/com.palm.app.calendar/app/models/database.manager.js
199 @@ -20,20 +20,21 @@
200                                 });
201         },
202         
203 -       getCalendarPrefs:function(successCB,failureCB){
204 +       getCalendarPrefs:function(successCB,failureCB,watchChanges){
205                 Mojo.Log.info("**********In getCalendarPrefs");
206                 return new Mojo.Service.Request(DatabaseManager.identifier , {
207                         method: "find",
208                         parameters: {
209                                         query:{
210                                                 from:DatabaseManager.calendarPrefsTable
211 -                                       }
212 +                                       },
213 +                                       watch: watchChanges
214                         },
215                         onSuccess: successCB,
216                         onFailure: failureCB
217                 });
218         },
219 -       
220 +
221         watchCalendars:function(lastRev, successCB, failureCB){
222                 lastRev = (lastRev ? lastRev : 0);
223                 return  new Mojo.Service.Request (DatabaseManager.identifier,
224 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/day-assistant.js
225 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/day-assistant.js
226 @@ -73,6 +73,10 @@
227                 this.onResize                   = this.onResize                         .bind (this);
228                 this.onVerticalScroll   = this.onVerticalScroll         .bind (this);
229                 this.refreshDisplay             = this.refreshDisplay           .bind (this);
230 +
231 +               var prefs = this.prefsManager.getPrefs();
232 +               prefs.eventsViewDisplayType = "day";
233 +               this.prefsManager.saveToDB(prefs);
234         },
235         
236         getEventChangeCallback: function(response) {
237 @@ -189,11 +193,17 @@
238                         Mojo.Dom.hide (this.controller.get('dv_scrim'));
239                         Mojo.Dom.hide (this.controller.get('dv_scrim_prev'));
240                 }
241 +
242 +               var now = new Date();
243 +               this.drawNowIndicator(now,true);
244         },
245  
246         getEventsFailCallback: function(response) {
247                 Mojo.Log.info("FAILURE IN THE SERVICE **********************************************************");
248                 this.hideFastScrollView();
249 +
250 +               var now = new Date();
251 +               this.drawNowIndicator(now,true);
252         },
253  
254         isDayDisplayed: function(day) {
255 @@ -242,6 +252,7 @@
256         buildDayTitle: function(doScrim) {
257                 var today = Date.today().clearTime();
258                 var dayDateNoTime = new Date(this.dayDate).clearTime();
259 +               var weekNumber = new Date(this.dayDate).getISO8601Week();
260                 var formatObj = {};
261                 
262          // formatString = "EEE MMM d";
263 @@ -250,18 +261,23 @@
264          formatObj.dateComponents = "md";
265                 
266                 if (dayDateNoTime.compareTo(today) === 0) {
267 -                       var template = new Template($L("#{todayStr}, #{dateStr}"));
268 -                       var todayStr= Mojo.Format.formatRelativeDate(today, {date: "short"}).capitalize();
269 +                       var template = new Template($L("#{todayStr}, #{dateStr}") + ", W#{weekStr}");
270 +                       var todayStr = Mojo.Format.formatRelativeDate(today, {date: "medium"}).capitalize();
271                         
272                         var templateModel = {};
273                         templateModel.todayStr = todayStr;
274                         //templateModel.dateStr = Mojo.Format.formatDate(this.dayDate, $L("EEE MMM d"));
275                         templateModel.dateStr = Mojo.Format.formatDate(this.dayDate, formatObj);
276 +                       templateModel.weekStr = weekNumber;
277                         this.controller.get('dv_title').update(template.evaluate(templateModel)); // Localize this date format string
278                 } else {
279                         //this.controller.get('dv_title').update(Mojo.Format.formatDate(this.dayDate, $L("EEE MMM d, yyyy"))); // Localize this date format string
280                         formatObj.dateComponents = "mdy";
281 -                       this.controller.get('dv_title').update(Mojo.Format.formatDate(this.dayDate, formatObj)); // Localize this date format string
282 +                       var template = new Template($L("#{dateStr}") + ", W#{weekStr}");
283 +                       var templateModel = {};
284 +                       templateModel.weekStr = weekNumber;
285 +                       templateModel.dateStr = Mojo.Format.formatDate(this.dayDate, formatObj);
286 +                       this.controller.get('dv_title').update(template.evaluate(templateModel)); // Localize this date format string
287                 }
288                 
289                 if (doScrim) {
290 @@ -1934,7 +1950,7 @@
291                 this.menuModel = {
292                         visible:true,
293                         items: [
294 -                                       {},
295 +                                               {label: $L('Event'), icon: 'new-timed', command: 'newtimed'},
296                                                 {label:$L('Views'), 
297                                                 toggleCmd:'day', 
298                                                 items:[
299 @@ -1942,7 +1958,7 @@
300                                                         {label:$L('Week'), icon: 'menu-week', command:'week'}, 
301                                                         {label:$L('Month'), icon: 'menu-month', command:'month'}
302                                          ]},
303 -                                       {}
304 +                                               {label: $L('All day event'), icon: 'new-allday', command: 'newallday'}
305                                         ]};
306                         
307                 this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.menuModel);
308 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js
309 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js
310 @@ -36,6 +36,10 @@
311                 this.renderBusyTimes            = this.renderBusyTimes          .bind (this);
312  
313  ///*DEBUG:*/   this.timing = { launch: 0, mgr: 0 };
314 +
315 +               var prefs = this.prefsManager.getPrefs();
316 +               prefs.eventsViewDisplayType = "month";
317 +               this.prefsManager.saveToDB(prefs);
318         },
319  
320         loadBusyTimes: function (delay) {
321 @@ -133,8 +137,15 @@
322          formatObj.date = "medium";
323          formatObj.dateComponents = "my";
324  
325 +               var weekNumber = new Date(this.monthDate);
326 +               weekNumber.setDate(1);
327 +               var firstWeek = weekNumber.getISO8601Week();    
328 +               weekNumber.setMonth(weekNumber.getMonth()+1);
329 +               weekNumber.setDate(weekNumber.getDate()-1);
330 +               var lastWeek = weekNumber.getISO8601Week();
331 +
332                 //this.mvTitle.innerText = Mojo.Format.formatDate(this.monthDate, $L("MMM yyyy")); // Localize this date format string
333 -               this.mvTitle.innerText = Mojo.Format.formatDate(this.monthDate, formatObj); // Localize this date format string
334 +               this.mvTitle.innerText = Mojo.Format.formatDate(this.monthDate, formatObj) + ", " + $L("Weeks") + " " + firstWeek + "-" + lastWeek; // Localize this date format string
335         },
336  
337         buildDayHeader: function() {
338 @@ -758,7 +769,7 @@
339                 this.menuModel = 
340                 {       visible :       true
341                 ,       items   :
342 -                       [       {}
343 +                       [       {label: $L('Event'), icon: 'new-timed', command: 'newtimed'}
344                         ,       {       label           : $L('Views')
345                                 ,       toggleCmd       : 'month'
346                                 ,       items           :
347 @@ -776,7 +787,7 @@
348                                                 }
349                                         ]
350                                 }
351 -                       ,       {}
352 +                       ,       {label: $L('All day event'), icon: 'new-allday', command: 'newallday'}
353                         ]
354                 };
355  
356 @@ -896,6 +907,30 @@
357                         "calendar-sync-all");
358         },
359         
360 +       getCalId :function(){
361 +               var currentCal  = this.calendarsManager.getCurrentCal();
362 +               var defaultCalId= currentCal;
363 +
364 +               if (currentCal === "all") {
365 +                       // Create an event in the calendar specified by the defaultCalId preference
366 +                       defaultCalId= this.prefsManager.getDefaultCalendar();
367 +                       var manager     = this.calendarsManager;
368 +
369 +                       if (defaultCalId === 0) {
370 +                               defaultCalId = manager.getLocalCalendarId();
371 +                       }
372 +
373 +                       // Check to see if the calendarId is a valid one
374 +                       if (manager.getCalName(defaultCalId) === undefined) {
375 +                               // The default calendar doesn't exist anymore so let's just create it
376 +                               // in Local
377 +                               defaultCalId = manager.getLocalCalendarId();
378 +                       }
379 +               }
380 +
381 +               return defaultCalId;
382 +       },
383 +       
384         handleCommand: function (event) 
385         {
386                 if(event.type == Mojo.Event.command) {
387 @@ -908,6 +943,10 @@
388                         } else if (event.command == 'day') {
389                                 Mojo.Event.stop (event);
390                                 this.handleDayView();
391 +                       } else if (event.command == 'newtimed') {
392 +                               this.controller.stageController.pushScene('edit', 0, 0, false,this.getCalId()/*calendarId*/,0/*subject*/);
393 +                       } else if (event.command == 'newallday') {
394 +                               this.controller.stageController.pushScene('edit', 0, 0, true,this.getCalId()/*calendarId*/,0/*subject*/);
395                         } else if (event.command == Mojo.Menu.prefsCmd) {
396                                 Mojo.Event.stop (event);
397                                 this.controller.stageController.pushScene('prefs');
398 --- .orig/usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
399 +++ /usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
400 @@ -15,7 +15,10 @@
401  
402  #reminder-email,
403  #reminder-dismiss,
404 -#reminder-snooze {
405 +#reminder-snooze,
406 +#snooze-select,
407 +#snooze-prev,
408 +#snooze-next {
409      height: 45px;
410         position: fixed;
411         -webkit-box-sizing: border-box;
412 @@ -57,6 +60,36 @@
413  #reminder-snooze .button-wrapper { -webkit-border-image:url(../images/button-snooze.png) 0 15 45 15 repeat repeat; }
414  #reminder-snooze:active .button-wrapper { -webkit-border-image:url(../images/button-snooze.png) 45 15 0 15 repeat repeat; }
415  
416 +#snooze-select {
417 +/*     right: 0px; */
418 +       width: 100%;
419 +       padding-left: 65px;
420 +       padding-right: 65px;    
421 +       bottom: 10px;
422 +}
423 +
424 +#snooze-prev {
425 +       width: 60px;
426 +       padding-right: 5px;     
427 +       bottom: 10px;
428 +}
429 +
430 +#snooze-next {
431 +       right: 0px; 
432 +       width: 60px;
433 +       padding-left: 5px;
434 +       bottom: 10px;
435 +}
436 +
437 +#snooze-select .button-wrapper { -webkit-border-image:url(../images/button-snooze.png) 0 15 45 15 repeat repeat; }
438 +#snooze-select:active .button-wrapper { -webkit-border-image:url(../images/button-snooze.png) 45 15 0 15 repeat repeat; }
439 +
440 +#snooze-prev .button-wrapper { -webkit-border-image:url(../images/button-contact.png) 0 15 45 15 repeat repeat; }
441 +#snooze-prev:active .button-wrapper { -webkit-border-image:url(../images/button-contact.png) 45 15 0 15 repeat repeat; }
442 +
443 +#snooze-next .button-wrapper { -webkit-border-image:url(../images/button-contact.png) 0 15 45 15 repeat repeat; }
444 +#snooze-next:active .button-wrapper { -webkit-border-image:url(../images/button-contact.png) 45 15 0 15 repeat repeat; }
445 +
446  .notification-event-container {
447         width: 290px;
448         height: 48px;
449 --- .orig/usr/palm/applications/com.palm.app.calendar/stylesheets/prefs-acct.css
450 +++ /usr/palm/applications/com.palm.app.calendar/stylesheets/prefs-acct.css
451 @@ -31,6 +31,10 @@
452         background-image: url(../images/header-icon-calendar.png);
453  }
454  
455 +.palm-page-header .icon.reminder {
456 +       background-image: url(../images/header-icon-reminder.png);
457 +}
458 +
459  .disabled-toggle-label {
460         width: 96px;
461         height: 48px;
462 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/prefs-assistant.js
463 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/prefs-assistant.js
464 @@ -21,6 +21,8 @@
465                 this.calendarsManager   = this.app.getCalendarsManager();
466                 this.prefsManager               = this.app.getPrefsManager();
467                 this.alarmSoundOptions  = this.prefsManager.getAlarmSoundOptions();
468 +               
469 +               this.currentView = "default";
470         },
471         
472         startOfDayCallback: function(event) {
473 @@ -45,13 +47,13 @@
474                 this.dirty = true;
475         },
476         
477 -       renderStartOfWeek: function() {
478 +/*     renderStartOfWeek: function() {
479                 var sowDate = new Date();
480                 sowDate.moveToDayOfWeek(this.prefs.startOfWeek-1);
481                 // var sow = {};
482                 
483                 this.controller.get('pv_start_of_week').update(Mojo.Format.formatDate(sowDate, "EEEE"));
484 -       },
485 +       }, */
486         
487         renderNewEventDuration: function() {
488                 var ned = {};
489 @@ -280,6 +282,20 @@
490                 if (event.command == Mojo.Menu.helpCmd) {
491                         this.app.getAppManagerService().launchHelp (this.controller);
492                 }
493 +               else if ((event.type === Mojo.Event.back) && (this.currentView != "default")) {
494 +                       event.stop();
495 +                       
496 +                       this.currentView = "default";
497 +
498 +                       this.controller.get("event_options").hide();
499 +                       this.controller.get("reminder_options").hide(); 
500 +                       this.controller.get("event_view").hide();
501 +                       this.controller.get("reminder_view").hide();            
502 +                       this.controller.get("prefs_view").show();
503 +                       this.controller.get("pv_accounts_div").show();  
504 +
505 +                       this.controller.getSceneScroller().mojo.scrollTo(0,0);
506 +               }
507         },
508         
509         setup: function() {
510 @@ -296,7 +312,24 @@
511                 this.prefsManager.observeCalendarPrefs ("prefs", this);
512                 
513                 this.renderDefaultCalendar();
514 -               this.renderStartOfWeek();
515 +//             this.renderStartOfWeek();
516 +
517 +               var sowDate = new Date().moveToDayOfWeek(0);
518 +
519 +               this.choicesStartOfWeek = [
520 +                       {label: Mojo.Format.formatDate(sowDate, 'EEEE'), value: 0},
521 +                       {label: Mojo.Format.formatDate(sowDate.addDays(1), 'EEEE'), value: 1},
522 +                       {label: Mojo.Format.formatDate(sowDate.addDays(1), 'EEEE'), value: 2},
523 +                       {label: Mojo.Format.formatDate(sowDate.addDays(1), 'EEEE'), value: 3},
524 +                       {label: Mojo.Format.formatDate(sowDate.addDays(1), 'EEEE'), value: 4},
525 +                       {label: Mojo.Format.formatDate(sowDate.addDays(1), 'EEEE'), value: 5},
526 +                       {label: Mojo.Format.formatDate(sowDate.addDays(1), 'EEEE'), value: 6} ];
527 +
528 +               this.modelStartOfWeek = {value: this.prefs.startOfWeek-1, disabled: false};
529 +
530 +               this.controller.setupWidget("pv_start_of_week", {
531 +                       choices: this.choicesStartOfWeek},
532 +                       this.modelStartOfWeek);
533                 
534                 // new Date() will create a LOCAL time, so we need to adjust the time
535                 // to reflect UTC time
536 @@ -343,7 +376,60 @@
537                         this.controller.get('currentringtone').update(this.prefs.ringtoneName);
538                 }
539                 
540 -       
541 +               this.choicesSnoozeEvent = [
542 +                       {label: $L("1 hour before"), value: -3600},
543 +                       {label: $L("30 minutes before"), value: -1800},
544 +                       {label: $L("15 minutes before"), value: -900},
545 +                       {label: $L("10 minutes before"), value: -600},
546 +                       {label: $L("5 minutes before"), value: -300},
547 +                       {label: $L("At start time"), value: 0},
548 +                       {label: $L("After 5 minutes"), value: 300},
549 +                       {label: $L("After 10 minutes"), value: 600},
550 +                       {label: $L("After 15 minutes"), value: 900},
551 +                       {label: $L("After 30 minutes"), value: 1800},
552 +                       {label: $L("After 1 hour"), value: 3600} ];
553 +
554 +               this.modelSnoozeEvent = {value: this.prefs.snoozeEventReminder};
555 +
556 +               this.controller.setupWidget("notificationSnoozeEvent", {
557 +                       label: $L("Timed"),
558 +                       choices: this.choicesSnoozeEvent},
559 +                       this.modelSnoozeEvent);
560 +
561 +               this.choicesSnoozeAllDay = [
562 +                       {label: $L("1 day before"), value: -86400},
563 +                       {label: $L("1 hour before"), value: -3600},
564 +                       {label: $L("30 minutes before"), value: -1800},
565 +                       {label: $L("15 minutes before"), value: -900},
566 +                       {label: $L("10 minutes before"), value: -600},
567 +                       {label: $L("5 minutes before"), value: -300},
568 +                       {label: $L("At start time"), value: 0},
569 +                       {label: $L("After 5 minutes"), value: 300},
570 +                       {label: $L("After 10 minutes"), value: 600},
571 +                       {label: $L("After 15 minutes"), value: 900},
572 +                       {label: $L("After 30 minutes"), value: 1800},
573 +                       {label: $L("After 1 hour"), value: 3600},
574 +                       {label: $L("After 1 day"), value: 86400} ];
575 +
576 +               this.modelSnoozeAllDay = {value: this.prefs.snoozeAllDayEventReminder};
577 +
578 +               this.controller.setupWidget("notificationSnoozeAllDay", {
579 +                       label: $L("All Day"),
580 +                       choices: this.choicesSnoozeAllDay},
581 +                       this.modelSnoozeAllDay);
582 +
583 +               this.choicesDefaultView = [
584 +                       {label: $L("No Default View"), value: "default"},
585 +                       {label: $L("Day View"), value: "day"},
586 +                       {label: $L("Week View"), value: "week"},
587 +                       {label: $L("Month View"), value: "month"} ];
588 +
589 +               this.modelDefaultView = {value: this.prefs.eventsViewDisplayMode, disabled: false};
590 +
591 +               this.controller.setupWidget("defaultCalendarView", {
592 +                       choices: this.choicesDefaultView},
593 +                       this.modelDefaultView);
594 +
595                 this.renderNewEventDuration();
596         
597                 this.buildAlarmsMenu();
598 @@ -363,7 +449,59 @@
599                         ,       handleListTap : this.handleAccountsListTap.bind(this)
600                         }
601                 );
602 -       },
603 +
604 +               this.modelVisualNotification = { value: this.prefs.visualNotification };
605 +
606 +               this.controller.setupWidget('VisualNotification', 
607 +                       {falseLabel: $L("Off"), trueLabel: $L("On")},
608 +                  this.modelVisualNotification);
609 +
610 +      if(!this.prefs.visualNotification) {
611 +                       this.controller.get('notificationprefs').hide();
612 +                       this.controller.get('BlinkNotificationRow').hide();
613 +               }
614 +               
615 +               this.modelBlinkNotification = { value: this.prefs.blinkNotification };
616 +
617 +               this.controller.setupWidget('BlinkNotification', 
618 +                       {falseLabel: $L("Off"), trueLabel: $L("On")},
619 +                  this.modelBlinkNotification);
620 +
621 +               this.choicesNotificationRepeat = [
622 +                       {label: $L("Disabled"), value: 0},
623 +                       {label: $L("Every 2 minutes"), value: 120},
624 +                       {label: $L("Every 5 minutes"), value: 300},
625 +                       {label: $L("Every 15 minutes"), value: 900},
626 +                       {label: $L("Every 30 minutes"), value: 1800},
627 +                       {label: $L("Every 60 minutes"), value: 3600} ];
628 +
629 +               this.modelNotificationRepeat = {value: this.prefs.notificationRepeatInterval};
630 +
631 +               this.controller.setupWidget("NotificationRepeat", {
632 +                       label: $L("Repeat"),
633 +                       labelPlacement: "right",                                                        
634 +                       choices: this.choicesNotificationRepeat},
635 +                       this.modelNotificationRepeat);
636 +
637 +               if(this.prefs.notificationRepeatInterval == 0)
638 +                       this.controller.get('NotificationLimitRow').hide();
639 +
640 +               this.choicesNotificationLimit = [
641 +                       {label: $L("Repeat infinitely"), value: 999},
642 +                       {label: $L("Repeat 3 times"), value: 3},
643 +                       {label: $L("Repeat 5 times"), value: 5},
644 +                       {label: $L("Repeat 10 times"), value: 10},
645 +                       {label: $L("Repeat 15 times"), value: 15},
646 +                       {label: $L("Repeat 30 times"), value: 30} ];
647 +
648 +               this.modelNotificationLimit = {value: this.prefs.notificationRepeatLimit};
649 +
650 +               this.controller.setupWidget("NotificationLimit", {
651 +                       label: $L("Limitation"),
652 +                       labelPlacement: "right",                                                        
653 +                       choices: this.choicesNotificationLimit},
654 +                       this.modelNotificationLimit);   
655 +},
656         
657         savePrefs: function() {
658                 this.prefsManager.saveToDB (this.prefs);
659 @@ -395,8 +533,11 @@
660                 //Mojo.Log.info('prefs-assistant: activate');
661                 this.prefsManager.validateDefaultCalPref();
662                 
663 -               this.startOfWeekClickHandler = this.handleStartOfWeekClick.bindAsEventListener(this);
664 -               this.controller.get('pv_start_of_week').observe('mojo-tap', this.startOfWeekClickHandler);
665 +//             this.startOfWeekClickHandler = this.handleStartOfWeekClick.bindAsEventListener(this);
666 +//             this.controller.get('pv_start_of_week').observe('mojo-tap', this.startOfWeekClickHandler);
667 +
668 +               this.startOfWeekClickHandler = this.startOfWeekChoose.bindAsEventListener(this);
669 +               this.controller.listen('pv_start_of_week',Mojo.Event.propertyChange, this.startOfWeekClickHandler);
670                 
671                 this.defaultEventAlarmClickHandler = this.handleDefaultEventAlarmClick.bindAsEventListener(this);
672                 this.controller.get('pv_default_evt_alarm').observe('mojo-tap', this.defaultEventAlarmClickHandler);
673 @@ -409,8 +550,14 @@
674                 this.defaultCalClickHandler = this.handleDefaultCalClick.bindAsEventListener(this);
675                 this.controller.get('pv_default_cal').observe('mojo-tap', this.defaultCalClickHandler);
676                 
677 -               this.syncAccountsBtnTapHandler = this.handleSyncAccountsBtnTap.bindAsEventListener(this);
678 -               this.controller.get('pv_sync_accounts_btn').observe('mojo-tap', this.syncAccountsBtnTapHandler);
679 +//             this.syncAccountsBtnTapHandler = this.handleSyncAccountsBtnTap.bindAsEventListener(this);
680 +//             this.controller.get('pv_sync_accounts_btn').observe('mojo-tap', this.syncAccountsBtnTapHandler);
681 +
682 +               this.eventOptionsBtnTapHandler = this.handleEventOptionsBtnTap.bindAsEventListener(this);
683 +               this.controller.get('pv_default_option_btn').observe('mojo-tap', this.eventOptionsBtnTapHandler);
684 +
685 +               this.reminderOptionsBtnTapHandler = this.handleReminderOptionsBtnTap.bindAsEventListener(this);
686 +               this.controller.get('pv_reminder_option_btn').observe('mojo-tap', this.reminderOptionsBtnTapHandler);
687                 
688                 this.addAccountBtnTapHandler = this.handleAddAccountBtnTap.bindAsEventListener(this);
689                 this.controller.get('pv_add_account_btn').observe('mojo-tap', this.addAccountBtnTapHandler);
690 @@ -423,6 +570,49 @@
691                 
692                 this.chooseNotificationRingtone = this.chooseNotificationRingtone.bindAsEventListener(this);
693                 this.controller.listen('currentringtonerow',Mojo.Event.tap, this.chooseNotificationRingtone);           
694 +
695 +               this.defaultViewChanged = this.setDefaultView.bindAsEventListener(this);
696 +               this.controller.listen("defaultCalendarView", Mojo.Event.propertyChange, this.defaultViewChanged);
697 +
698 +               this.snoozeEventChanged = this.setSnoozeEvent.bindAsEventListener(this);
699 +               this.controller.listen("notificationSnoozeEvent", Mojo.Event.propertyChange, this.snoozeEventChanged);
700 +
701 +               this.snoozeAllDayChanged = this.setSnoozeAllDay.bindAsEventListener(this);
702 +               this.controller.listen("notificationSnoozeAllDay", Mojo.Event.propertyChange, this.snoozeAllDayChanged);
703 +
704 +               this.visualNotificationChanged = this.setVisualNotification.bindAsEventListener(this);
705 +               this.controller.listen('VisualNotification', Mojo.Event.propertyChange, this.visualNotificationChanged);
706 +
707 +               this.blinkNotificationChanged = this.setBlinkNotification.bindAsEventListener(this);
708 +               this.controller.listen('BlinkNotification', Mojo.Event.propertyChange, this.blinkNotificationChanged);
709 +
710 +               this.notificationRepeatChanged = this.setNotificationRepeat.bindAsEventListener(this);
711 +               this.controller.listen('NotificationRepeat', Mojo.Event.propertyChange, this.notificationRepeatChanged);
712 +
713 +               this.notificationLimitChanged = this.setNotificationLimit.bindAsEventListener(this);
714 +               this.controller.listen('NotificationLimit', Mojo.Event.propertyChange, this.notificationLimitChanged);
715 +       },
716 +
717 +       handleEventOptionsBtnTap: function() {
718 +               this.currentView = "extra";
719 +
720 +               this.controller.get("prefs_view").hide();
721 +               this.controller.get("pv_accounts_div").hide();  
722 +               this.controller.get("event_view").show();
723 +               this.controller.get("event_options").show();
724 +               
725 +               this.controller.getSceneScroller().mojo.scrollTo(0,0);
726 +       },
727 +       
728 +       handleReminderOptionsBtnTap: function() {
729 +               this.currentView = "extra";
730 +
731 +               this.controller.get("prefs_view").hide();
732 +               this.controller.get("pv_accounts_div").hide();  
733 +               this.controller.get("reminder_view").show();
734 +               this.controller.get("reminder_options").show();
735 +
736 +               this.controller.getSceneScroller().mojo.scrollTo(0,0);
737         },
738         
739         handleAddAccountBtnTap: function() {
740 @@ -435,7 +625,9 @@
741         
742         deactivate: function() {
743                 //Mojo.Log.info('prefs-assistant: deactivate');
744 -               this.controller.get('pv_start_of_week').stopObserving('mojo-tap', this.startOfWeekClickHandler);
745 +//             this.controller.get('pv_start_of_week').stopObserving('mojo-tap', this.startOfWeekClickHandler);
746 +               
747 +               this.controller.stopListening('pv_start_of_week',Mojo.Event.propertyChange, this.startOfWeekClickHandler);
748                 
749                 this.controller.get('pv_default_evt_alarm').stopObserving('mojo-tap', this.defaultEventAlarmClickHandler);
750                 this.defaultEventAlarmClickHandler = undefined;
751 @@ -446,7 +638,7 @@
752                 
753                 this.controller.get('pv_default_cal').stopObserving('mojo-tap', this.defaultCalClickHandler);
754                 
755 -               this.controller.get('pv_sync_accounts_btn').stopObserving('mojo-tap', this.syncAccountsBtnTapHandler);
756 +//             this.controller.get('pv_sync_accounts_btn').stopObserving('mojo-tap', this.syncAccountsBtnTapHandler);
757                 
758                 this.controller.get('pv_add_account_btn').stopObserving('mojo-tap', this.addAccountBtnTapHandler);
759                 
760 @@ -456,6 +648,19 @@
761                 
762                 this.controller.stopListening('currentringtonerow',Mojo.Event.tap, this.chooseNotificationRingtone);            
763  
764 +               this.controller.stopListening("defaultCalendarView", Mojo.Event.propertyChange, this.defaultViewChanged);
765 +
766 +               this.controller.stopListening("notificationSnoozeEvent", Mojo.Event.propertyChange, this.snoozeEventChanged);
767 +
768 +               this.controller.stopListening("notificationSnoozeAllDay", Mojo.Event.propertyChange, this.snoozeAllDayChanged);
769 +
770 +               this.controller.stopListening('VisualNotification', Mojo.Event.propertyChange, this.visualNotificationChanged);
771 +
772 +               this.controller.stopListening('BlinkNotification', Mojo.Event.propertyChange, this.blinkNotificationChanged);
773 +
774 +               this.controller.stopListening('NotificationRepeat', Mojo.Event.propertyChange, this.notificationRepeatChanged);
775 +
776 +               this.controller.stopListening('NotificationLimit', Mojo.Event.propertyChange, this.notificationLimitChanged);
777         },
778         
779         // *** EVENT HANDLERS ***
780 @@ -493,18 +698,76 @@
781         },
782  
783  
784 -       startOfWeekChoose: function(val) {
785 +       startOfWeekChoose: function(event) {
786                 //Mojo.Log.info('prefs-assistant: startOfWeekChoose: %s', val);
787 -               var value = parseInt(val, 10);
788 -               if (val !== undefined && value != this.prefs.startOfWeek) {
789 +               var value = parseInt(event.value + 1, 10);
790 +               if (value != this.prefs.startOfWeek) {
791                         this.prefs.startOfWeek = value ;
792 -                       this.prefs.userChangedstartOfWeek =true;
793 -                       this.renderStartOfWeek();
794 +                       this.prefs.userChangedStartOfWeek = true;
795 +//                     this.renderStartOfWeek();
796                         this.dirty = true;
797                 }
798         },
799         
800 -       handleStartOfWeekClick: function(event) {
801 +       setDefaultView: function(event) {
802 +               this.prefs.eventsViewDisplayMode = event.value;
803 +
804 +               this.dirty = true;
805 +       },
806 +
807 +       setSnoozeEvent: function(event) {
808 +               this.prefs.snoozeEventReminder = event.value;
809 +
810 +               this.dirty = true;
811 +       },
812 +
813 +       setSnoozeAllDay: function(event) {
814 +               this.prefs.snoozeAllDayEventReminder = event.value;
815 +
816 +               this.dirty = true;
817 +       },
818 +       
819 +       setVisualNotification: function(event) {
820 +      if(!event.value) {
821 +                       this.controller.get('notificationprefs').hide();
822 +                       this.controller.get('BlinkNotificationRow').hide();
823 +                       
824 +                       this.prefs.blinkNotification = false;
825 +               }
826 +               else {
827 +                       this.controller.get('notificationprefs').show();
828 +                       this.controller.get('BlinkNotificationRow').show();
829 +               }
830 +
831 +               this.prefs.visualNotification = event.value;
832 +
833 +               this.dirty = true;
834 +       },
835 +
836 +       setBlinkNotification: function(event) {
837 +               this.prefs.blinkNotification = event.value;
838 +       
839 +               this.dirty = true;
840 +       },
841 +
842 +       setNotificationRepeat: function(event) {
843 +               if(event.value != 0)
844 +                       this.controller.get('NotificationLimitRow').show();
845 +               else
846 +                       this.controller.get('NotificationLimitRow').hide();
847 +
848 +               this.prefs.notificationRepeatInterval = event.value;
849 +       
850 +               this.dirty = true;
851 +       },
852 +
853 +       setNotificationLimit: function(event) {
854 +               this.prefs.notificationRepeatLimit = event.value;
855 +       
856 +               this.dirty = true;
857 +       },
858 +
859 +/*     handleStartOfWeekClick: function(event) {
860                 //Mojo.Log.info('prefs-assistant: handleStartOfWeekClick');
861                 var sowDate = new Date().moveToDayOfWeek(0);
862                 Event.stop(event);
863 @@ -535,7 +798,7 @@
864                                 }]
865                         });
866         },
867 -       
868 +*/     
869         newEventDurationChoose: function(value) {
870                 //Mojo.Log.info('prefs-assistant: newEventDurationChoose');
871                 if (value !== undefined && value != this.prefs.defaultEventDuration) {
872 --- .orig/usr/palm/applications/com.palm.app.calendar/app/views/prefs/prefs-scene.html
873 +++ /usr/palm/applications/com.palm.app.calendar/app/views/prefs/prefs-scene.html
874 @@ -8,6 +8,19 @@
875                 </div>                                                                                                                                                                         
876         </div>
877         
878 +<div id="calendar_options">
879 +       <div class="palm-group">
880 +               <div class="palm-group-title">Default Calendar View</div>
881 +
882 +               <div class="palm-list">
883 +                       <div class="palm-row single" x-mojo-tap-highlight="momentary">
884 +                               <div class="palm-row-wrapper">
885 +                                       <div id="defaultCalendarView" x-mojo-element="ListSelector"></div>
886 +                               </div>
887 +                       </div>
888 +               </div>
889 +       </div>
890 +
891         <div id='pv_startofweek_div' class="palm-group">
892                 <div class="palm-group-title" x-mojo-loc="">
893                         First day of week
894 @@ -15,7 +28,7 @@
895                 <div class="palm-list">
896                         <div class="palm-row single ">
897                                 <div class="palm-row-wrapper">
898 -                                       <div class="title" id="pv_start_of_week"></div>
899 +                                       <div id="pv_start_of_week" x-mojo-element="ListSelector"></div>
900                                 </div>
901                         </div>
902                 </div>
903 @@ -27,7 +40,7 @@
904         <div class="palm-list">
905                 <div class="palm-row first">
906                         <div class="palm-row-wrapper">
907 -        <div class="title start-of-day-picker">
908 +        <div class="title start-of-day-picker">                        
909                                   <div class="" id="pv_startofday_timepicker" x-mojo-element="TimePicker"></div>          
910          </div>
911                         </div>
912 @@ -41,28 +54,70 @@
913                 </div>
914         </div>
915  </div>
916 +</div>
917 +
918 +<div id='event_view' style="display:none;">
919 +       <div class="palm-page-header multi-line">
920 +               <div class="palm-page-header-wrapper">
921 +                 <div class="icon prefs"></div>
922 +                       <div class="title" x-mojo-loc=''>
923 +                               Default Event Settings
924 +                       </div>   
925 +               </div>   
926 +       </div>
927 +</div>
928
929 +<div id="event_options" style="display:none;">
930 +<div id='pv_neweventduration_div' class="palm-group">
931 +       <div class="palm-group-title" x-mojo-loc="">Default event duration</div>
932 +       <div class="palm-list">
933 +               <div class="palm-row single">
934 +                       <div class="palm-row-wrapper">
935 +                               <div class="title" id="pv_new_event_duration"></div>
936 +                       </div>
937 +               </div>
938 +       </div>
939 +</div>
940  
941  <div id='pv_defaulteventalarm_div' class="palm-group">
942         <div class="palm-group-title" x-mojo-loc="">Default event reminder</div>
943                 <div class="palm-list">
944                         <div id="pv_default_evt_alarm" class="palm-row first">
945                                 <div class="palm-row-wrapper">
946 -                                               <div class="label" x-mojo-loc="">Timed</div>
947 -                                               <div id="pv_default_evt_alarm_value" class="title"></div>
948 +                                               <div id="pv_default_evt_alarm_value" class="label" x-mojo-loc=""></div>
949 +                                               <div class="title">Timed</div>
950                                 </div>
951                         </div>
952         
953                         <div id="pv_default_allday_evt_alarm" class="palm-row last">
954                                 <div class="palm-row-wrapper">
955 -                                       <div class="label" x-mojo-loc="">All day</div>
956 -                                       <div id="pv_default_allday_evt_alarm_value" class="title"></div>
957 +                                       <div id="pv_default_allday_evt_alarm_value" class="label" x-mojo-loc=""></div>
958 +                                       <div class="title">All day</div>
959                                 </div>
960                         </div>
961                 </div>
962  </div>
963 -<div id='pv_alarmsound_div' class='palm-group'>
964 +
965 +<div class="palm-group">
966 +       <div class="palm-group-title">Snooze Event Reminder</div>
967 +
968 +       <div class="palm-list">
969 +               <div class="palm-row first" x-mojo-tap-highlight="momentary">
970 +                       <div class="palm-row-wrapper">
971 +                               <div id="notificationSnoozeEvent" x-mojo-element="ListSelector" class="right"></div>
972 +                       </div>
973 +               </div>
974 +               <div class="palm-row last" x-mojo-tap-highlight="momentary">
975 +                       <div class="palm-row-wrapper">
976 +                               <div id="notificationSnoozeAllDay" x-mojo-element="ListSelector" class="right"></div>
977 +                       </div>
978 +               </div>
979 +       </div>
980 +</div>
981 +</div>
982 +<!--<div id='pv_alarmsound_div' class='palm-group'>
983         <div class="palm-group-title" x-mojo-loc="">Event reminders</div>
984 -               <div class="palm-list">
985 +               <div class="palm-list"> -->
986                         <!--<div class="palm-row">
987                                 <div class="palm-row-wrapper">
988                                         <div x-mojo-element="ToggleButton" id="pv_alarmsound_tgl" name="pv_alarmsound_tgl"></div>
989 @@ -70,7 +125,7 @@
990                                 </div>
991                         </div>-->
992                 
993 -                       <div id="soundselectrow" class="palm-row single" x-mojo-tap-highlight="momentary">
994 +<!--                   <div id="soundselectrow" class="palm-row single" x-mojo-tap-highlight="momentary">
995                                 <div class="palm-row-wrapper">
996                                         <div id="notificationSoundSelector" x-mojo-element="ListSelector"></div>
997                                 </div>
998 @@ -82,31 +137,92 @@
999                         </div>
1000                     </div>
1001         </div>
1002 +</div> -->
1003 +
1004 +<div id='reminder_view' style="display:none;">
1005 +       <div class="palm-page-header multi-line">
1006 +               <div class="palm-page-header-wrapper">
1007 +                 <div class="icon reminder"></div>
1008 +                       <div class="title" x-mojo-loc=''>
1009 +                               Event Reminder Settings
1010 +                       </div>   
1011 +               </div>   
1012 +       </div>
1013  </div>
1014  
1015 -<div id='pv_neweventduration_div' class="palm-group">
1016 -       <div class="palm-group-title" x-mojo-loc="">Default event duration</div>
1017 -       <div class="palm-list">
1018 -               <div class="palm-row single">
1019 -                       <div class="palm-row-wrapper">
1020 -                               <div class="title" id="pv_new_event_duration"></div>
1021 -                       </div>
1022 -               </div>
1023 -       </div>
1024 +<div id="reminder_options" style="display:none;">
1025 +               <div class="palm-group">
1026 +                       <div class="palm-group-title" x-mojo-loc=''>
1027 +                               Event Reminder
1028 +                       </div>
1029 +                       <div class="palm-list">
1030 +                               <div class="palm-row first">
1031 +                                       <div class="palm-row-wrapper">                    
1032 +                                               <div id="VisualNotification" x-mojo-element="ToggleButton"></div>
1033 +                                               <div class="title capitalize" x-mojo-loc=''>
1034 +                                                       Show notification
1035 +                                               </div>                                                               
1036 +                                       </div> 
1037 +                               </div>                
1038 +                               <div class="palm-row last" id="BlinkNotificationRow">
1039 +                                       <div class="palm-row-wrapper">
1040 +                                               <div id="BlinkNotification" x-mojo-element="ToggleButton"></div>
1041 +                                               <div class="title capitalize" x-mojo-loc="">Blink notification</div>
1042 +                                       </div>
1043 +                               </div>
1044 +                       </div>
1045 +               </div>
1046 +
1047 +       <div id="notificationprefs">
1048 +               <div class="palm-group">
1049 +                       <div class="palm-group-title">Notification Sound</div>
1050 +
1051 +                       <div class="palm-list">
1052 +                               <div id="soundselectrow" class="palm-row first" x-mojo-tap-highlight="momentary">
1053 +                                       <div class="palm-row-wrapper">
1054 +                                               <div id="notificationSoundSelector" x-mojo-element="ListSelector" class="right"></div>
1055 +                                       </div>
1056 +                               </div>
1057 +                               <div id="currentringtonerow" class="palm-row last" x-mojo-tap-highlight="momentary">
1058 +                                       <div class="palm-row-wrapper">
1059 +                                               <div id='currentringtone' class="label"></div>
1060 +                                               <div class="title" x-mojo-loc=''>Ringtone</div>
1061 +                                       </div>
1062 +                               </div>
1063 +                       </div>
1064 +               </div>
1065 +       
1066 +               <div class="palm-group">
1067 +                       <div class="palm-group-title">Notification Repeat</div>
1068 +
1069 +                       <div class="palm-list">
1070 +                               <div class="palm-row first" id="NotificationRepeatRow">
1071 +                                       <div class="palm-row-wrapper">
1072 +                                               <div id="NotificationRepeat" x-mojo-element="ListSelector" class="right"></div>
1073 +                                       </div>
1074 +                               </div>
1075 +                               <div class="palm-row last" id="NotificationLimitRow">
1076 +                                       <div class="palm-row-wrapper">
1077 +                                               <div id="NotificationLimit" x-mojo-element="ListSelector" class="right"></div>
1078 +                                       </div>
1079 +                               </div>
1080 +                       </div>
1081 +               </div>
1082 +       </div>
1083  </div>
1084         
1085  <!-- **Accounts and Default Account** -->
1086  
1087  <div id='pv_accounts_div'>
1088 -       <div id="pv_accounts_list_new" class="accounts-list" x-mojo-element="AccountsList"></div>
1089 -       <div id="pv_add_account_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1090 -               Add Account
1091 +       <div id="pv_default_option_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1092 +               Default Event Options
1093         </div>
1094 -       <div id="pv_view_option_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1095 -               Calendar View Options
1096 +       <div id="pv_reminder_option_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1097 +               Event Reminder Options
1098         </div>
1099 +       <div id="pv_accounts_list_new" x-mojo-element="AccountsList"></div>
1100         <div id="pv_default_calendar_div" class='palm-group'>
1101 -               <div class="palm-group-title" x-mojo-loc="">Default calendar</div>
1102 +               <div class="palm-group-title" x-mojo-loc="">Default Calendar</div>
1103                 <div class="palm-list">
1104                         <div class="palm-row single">
1105                                 <div class="palm-row-wrapper">
1106 @@ -119,9 +235,11 @@
1107         <div class="palm-info-text" x-mojo-loc="">
1108                 New events created in the “All Calendars” view will default to this calendar.
1109         </div>
1110 -       <div id="pv_sync_accounts_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1111 -               Sync now
1112 +       <div id="pv_add_account_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1113 +               Add Account
1114         </div>
1115  
1116 +       <div id="pv_view_option_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1117 +               Calendar View Options
1118         </div>
1119  </div>
1120 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
1121 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
1122 @@ -11,6 +11,8 @@
1123                 this.reminderManager            = getAppAssistant().getReminderManager();               
1124                 this.doThrob                            = needThrobbing;
1125                 this.reminder                           = reminder;             
1126 +               this.snoozeDuration             = 0;
1127 +               this.snoozeTimeout              = null;
1128         },
1129  
1130         activate:function(){
1131 @@ -26,12 +28,38 @@
1132                 this.onDismissHandler   = this.onDismiss.bindAsEventListener(this);
1133                 this.onEmailHandler             = this.onEmail  .bindAsEventListener(this);
1134                 this.onSnoozeHandler    = this.onSnooze .bindAsEventListener(this);
1135 +               this.onSnoozeSelectHandler      = this.onSnoozeSelect.bindAsEventListener(this);
1136 +               this.onSnoozePrevHandler        = this.onSnoozePrev.bindAsEventListener(this);
1137 +               this.onSnoozeNextHandler        = this.onSnoozeNext.bindAsEventListener(this);
1138                 this.reminderManager.observeReminders ('reminder-assistant', this);
1139                 this.reminderManager.observeRemindersDisplay ('reminder-assistant', this);
1140                 this.updateDisplay();
1141                 this.reminderManager.showCompleted('reminder-assistant', this.reminder._id);
1142                 Mojo.Log.info("========= RA: setup: out");
1143                                 
1144 +               var reminderTimeout = new Date();
1145 +               
1146 +               reminderTimeout = new Date(reminderTimeout.getTime() + 60000);
1147 +
1148 +               var month = reminderTimeout.getUTCMonth()+1;
1149 +               if(month < 10) month = "0" + month;
1150 +               var day = reminderTimeout.getUTCDate();
1151 +               if(day < 10) day = "0" + day;
1152 +               var year = reminderTimeout.getUTCFullYear();
1153 +
1154 +               var hours = reminderTimeout.getUTCHours();
1155 +               if(hours < 10) hours = "0" + hours;
1156 +               var minutes = reminderTimeout.getUTCMinutes();
1157 +               if(minutes < 10) minutes = "0" + minutes;
1158 +               var seconds = reminderTimeout.getUTCSeconds();
1159 +               if(seconds < 10) seconds = "0" + seconds;
1160 +
1161 +               var scheduledTimeStr = month + "/" + day + "/" + year + " " + hours + ":" + minutes + ":" + seconds;
1162 +
1163 +               this.controller.serviceRequest('palm://com.palm.power/timeout/', {'method': "set", 
1164 +                       'parameters': {'key': 'calendarReminderTimeout', 'wakeup': true, 'at': scheduledTimeStr, 
1165 +                       'uri': "palm://com.palm.applicationManager/open", 'params': {
1166 +                               'id': 'com.palm.app.calendar', 'params': {'closeReminderAlert': true}}} }); 
1167         },
1168      
1169         cleanup: function() {
1170 @@ -40,7 +68,7 @@
1171                 this.reminderManager.stopObservingRemindersDisplay('reminder-assistant');
1172                 this.reminderManager.showCompleted('reminder-assistant', undefined);
1173         },
1174 -               
1175 +
1176         updateDisplay: function() {
1177                 Mojo.Log.info("========= RA: updateDisplay: in");               
1178                 var data = {};
1179 @@ -122,6 +150,10 @@
1180                         this.controller.get('notification-event-subtitle').addEventListener(Mojo.Event.tap, this.onEventHandler);
1181                         this.controller.get('notification-event-icon').addEventListener(Mojo.Event.tap, this.onEventHandler);
1182                         this.controller.get('notification-event-location').addEventListener(Mojo.Event.tap, this.onEventHandler);
1183 +
1184 +                       this.controller.get('snooze-select').addEventListener(Mojo.Event.tap, this.onSnoozeSelectHandler);
1185 +                       this.controller.get('snooze-prev').addEventListener(Mojo.Event.tap, this.onSnoozePrevHandler);
1186 +                       this.controller.get('snooze-next').addEventListener(Mojo.Event.tap, this.onSnoozeNextHandler);
1187                 }
1188                 catch(e){
1189                         Mojo.Log.info("========= RA: addListeners: ARGH, FAIL");
1190 @@ -159,6 +191,18 @@
1191                 if (snooze) {
1192                         snooze.removeEventListener(Mojo.Event.tap, this.onSnoozeHandler);
1193                 }
1194 +               var select = this.controller.get('snooze-select');
1195 +               if (select) {
1196 +                       select.removeEventListener(Mojo.Event.tap, this.onSnoozeSelectHandler);
1197 +               }
1198 +               var prev = this.controller.get('snooze-prev');
1199 +               if (prev) {
1200 +                       prev.removeEventListener(Mojo.Event.tap, this.onSnoozePrevHandler);
1201 +               }
1202 +               var next = this.controller.get('snooze-next');
1203 +               if (next) {
1204 +                       next.removeEventListener(Mojo.Event.tap, this.onSnoozeNextHandler);
1205 +               }
1206                 Mojo.Log.info("========= RA: removeListeners: out");
1207         },
1208         
1209 @@ -244,10 +288,159 @@
1210  
1211         onSnooze: function(event) {
1212                 Mojo.Log.info("========= RA: onSnooze: "+this.reminder._id);
1213 -               this.showSnoozeBanner(this.DEFAULT_SNOOZE);
1214 -               this.reminderManager.snoozeReminder(this.reminder);
1215 +               this.snoozeTimeout = setTimeout(this.onSnoozeSelect.bind(this), 10000);
1216 +       
1217 +               var prefs = getAppAssistant().getPrefsManager().getPrefs();
1218 +               
1219 +               if(this.reminder.isAllDay)
1220 +                       this.snoozeDuration = prefs.snoozeAllDayEventReminder;
1221 +               else
1222 +                       this.snoozeDuration = prefs.snoozeEventReminder;
1223 +       
1224 +               this.controller.get("reminder-dismiss").hide();
1225 +               this.controller.get("reminder-snooze").hide();
1226 +
1227 +               this.controller.get("snooze-select").show();
1228 +               this.controller.get("snooze-prev").show();
1229 +               this.controller.get("snooze-next").show();
1230 +               
1231 +               this.updateSnoozeText();
1232         },
1233         
1234 +       onSnoozeSelect: function(event) {
1235 +               if(this.snoozeTimeout)
1236 +                       clearTimeout(this.snoozeTimeout);
1237 +       
1238 +               var duration = this.checkSnoozeDuration();
1239 +
1240 +               if(duration < 0) {
1241 +                       duration = 0;
1242 +               }
1243 +               else if(duration == 0) {
1244 +                       this.snoozeDuration = 0;
1245 +                       
1246 +                       this.updateSnoozeText();
1247 +                       
1248 +                       return;
1249 +               }
1250 +
1251 +               this.showSnoozeBanner(Math.round(duration / 1000 / 60));
1252 +               
1253 +               this.reminderManager.snoozeReminder(this.reminder, duration);
1254 +       },
1255 +       
1256 +       onSnoozePrev: function(event) {
1257 +               if(this.snoozeTimeout)
1258 +                       clearTimeout(this.snoozeTimeout);
1259 +
1260 +               if((this.snoozeDuration == -3600) && (this.reminder.isAllDay) && (this.checkSnoozeDuration(-86400) > 0))
1261 +                       this.snoozeDuration = -86400;
1262 +               else if((this.snoozeDuration == -1800) && (this.checkSnoozeDuration(-3200) > 0))
1263 +                       this.snoozeDuration = -3600;
1264 +               else if((this.snoozeDuration == -900) && (this.checkSnoozeDuration(-1800) > 0))
1265 +                       this.snoozeDuration = -1800;
1266 +               else if((this.snoozeDuration == -600) && (this.checkSnoozeDuration(-900) > 0))
1267 +                       this.snoozeDuration = -900;
1268 +               else if((this.snoozeDuration == -300) && (this.checkSnoozeDuration(-600) > 0))
1269 +                       this.snoozeDuration = -600;
1270 +               else if((this.snoozeDuration == 0) && (this.checkSnoozeDuration(-300) > 0))
1271 +                       this.snoozeDuration = -300;
1272 +               else if(this.snoozeDuration == 300)
1273 +                       this.snoozeDuration = 0;
1274 +               else if(this.snoozeDuration == 600)
1275 +                       this.snoozeDuration = 300;
1276 +               else if(this.snoozeDuration == 900)
1277 +                       this.snoozeDuration = 600;
1278 +               else if(this.snoozeDuration == 1800)
1279 +                       this.snoozeDuration = 900;
1280 +               else if(this.snoozeDuration == 3600)
1281 +                       this.snoozeDuration = 1800;
1282 +               else if(this.snoozeDuration == 86400)
1283 +                       this.snoozeDuration = 3600;
1284 +
1285 +               this.updateSnoozeText();
1286 +       },
1287 +       
1288 +       onSnoozeNext: function(event) {
1289 +               if(this.snoozeTimeout)
1290 +                       clearTimeout(this.snoozeTimeout);
1291 +
1292 +               if(this.snoozeDuration == -86400)
1293 +                       this.snoozeDuration = -3600;
1294 +               else if(this.snoozeDuration == -3600)
1295 +                       this.snoozeDuration = -1800;
1296 +               else if(this.snoozeDuration == -1800)
1297 +                       this.snoozeDuration = -900;
1298 +               else if(this.snoozeDuration == -900)
1299 +                       this.snoozeDuration = -600;
1300 +               else if(this.snoozeDuration == -600)
1301 +                       this.snoozeDuration = -300;
1302 +               else if(this.snoozeDuration == -300)
1303 +                       this.snoozeDuration = 0;
1304 +               else if((this.snoozeDuration == 0) && (this.checkSnoozeDuration(300) > 0))
1305 +                       this.snoozeDuration = 300;
1306 +               else if((this.snoozeDuration == 300) && (this.checkSnoozeDuration(600) > 0))
1307 +                       this.snoozeDuration = 600;
1308 +               else if((this.snoozeDuration == 600) && (this.checkSnoozeDuration(900) > 0))
1309 +                       this.snoozeDuration = 900;
1310 +               else if((this.snoozeDuration == 900) && (this.checkSnoozeDuration(1800) > 0))
1311 +                       this.snoozeDuration = 1800;
1312 +               else if((this.snoozeDuration == 1800) && (this.checkSnoozeDuration(3600) > 0))
1313 +                       this.snoozeDuration = 3600;
1314 +               else if((this.snoozeDuration == 3600) && (this.reminder.isAllDay) && (this.checkSnoozeDuration(86400) > 0))
1315 +                       this.snoozeDuration = 86400;
1316 +
1317 +               this.updateSnoozeText();
1318 +       },
1319 +                       
1320 +       updateSnoozeText: function() {
1321 +               if(this.snoozeDuration == -86400)
1322 +                       this.controller.get("snooze-text").update("1 day before");
1323 +               else if(this.snoozeDuration == -3600)
1324 +                       this.controller.get("snooze-text").update("1 hour before");
1325 +               else if(this.snoozeDuration == -1800)
1326 +                       this.controller.get("snooze-text").update("30 minutes before");
1327 +               else if(this.snoozeDuration == -900)
1328 +                       this.controller.get("snooze-text").update("15 minutes before");
1329 +               else if(this.snoozeDuration == -600)
1330 +                       this.controller.get("snooze-text").update("10 minutes before");
1331 +               else if(this.snoozeDuration == -300)
1332 +                       this.controller.get("snooze-text").update("5 minutes before");
1333 +               else if(this.snoozeDuration == 0)
1334 +                       this.controller.get("snooze-text").update("At start time");
1335 +               else if(this.snoozeDuration == 300)
1336 +                       this.controller.get("snooze-text").update("After 5 minutes");
1337 +               else if(this.snoozeDuration == 600)
1338 +                       this.controller.get("snooze-text").update("After 10 minutes");
1339 +               else if(this.snoozeDuration == 900)
1340 +                       this.controller.get("snooze-text").update("After 15 minutes");
1341 +               else if(this.snoozeDuration == 1800)
1342 +                       this.controller.get("snooze-text").update("After 30 minutes");
1343 +               else if(this.snoozeDuration == 3600)
1344 +                       this.controller.get("snooze-text").update("After 1 hour");
1345 +               else if(this.snoozeDuration == 86400)
1346 +                       this.controller.get("snooze-text").update("After 1 day");
1347 +       },
1348 +       
1349 +       checkSnoozeDuration: function(snoozeDuration) {
1350 +               var duration = 0;
1351 +
1352 +               var curTime = new Date();
1353 +               
1354 +               curTime.setMilliseconds(0);
1355 +               
1356 +               if(!snoozeDuration)
1357 +                       snoozeDuration = this.snoozeDuration;
1358 +               
1359 +               if(this.snoozeDuration == 0)
1360 +                       duration = this.reminder.startTime - curTime.getTime();
1361 +               else if((snoozeDuration > 0) && ((curTime.getTime() + (snoozeDuration * 1000)) < this.reminder.startTime))
1362 +                       duration = snoozeDuration * 1000;
1363 +               else if((snoozeDuration < 0) && ((snoozeDuration * 1000) + (this.reminder.startTime - curTime.getTime()) >= 60000))
1364 +                       duration = (snoozeDuration * 1000) + (this.reminder.startTime - curTime.getTime());
1365 +
1366 +               return duration;
1367 +       },
1368         
1369         showSnoozeBanner: function(minutes) {
1370                 var templateModel = {};
1371 --- .orig/usr/palm/applications/com.palm.app.calendar/app/models/reminder-manager.js
1372 +++ /usr/palm/applications/com.palm.app.calendar/app/models/reminder-manager.js
1373 @@ -176,13 +176,15 @@
1374         //called by the reminder assistant
1375         //sets the state of the reminder to snoozed, launches the service to update the snooze time, and 
1376         //displays the next reminder
1377 -       snoozeReminder: function(reminder){
1378 +       snoozeReminder: function(reminder, snoozeDuration){
1379 +               this.removePlayNotificationSoundTask();
1380 +
1381                 Mojo.Log.info("========= RM: snoozeReminder: in");
1382                 reminder.state = ReminderManager.SNOOZED;
1383                 Mojo.Log.info("========= RM: snoozeReminder: overwriting "+reminder._id);
1384                 this.reminders[reminder._id] = reminder;
1385                                 
1386 -               PalmCall.call("palm://com.palm.service.calendar.reminders", "onSnooze", {"reminderId": reminder._id});
1387 +               PalmCall.call("palm://com.palm.service.calendar.reminders", "onSnooze", {"reminderId": reminder._id, "snoozeDuration": snoozeDuration});
1388                 
1389                 var nextReminder = this.findAnotherReminder("show");
1390                 this.displayReminder(nextReminder);
1391 @@ -193,6 +195,8 @@
1392         //removes the reminder from the hash, launches the service to dismiss the reminder, and 
1393         //displays the next reminder
1394         dismissReminder: function(reminder){
1395 +               this.removePlayNotificationSoundTask();
1396 +
1397                 Mojo.Log.info("========= RM: dismissReminder: in");
1398                         
1399                 this.removeReminders([reminder._id]);
1400 @@ -420,6 +424,11 @@
1401         //launches the dashboard and the reminder dialog, and notifies observers.  If the dash or dialog already exist,
1402         //they will get updated as part of the notification.    
1403         displayReminder: function(reminder){
1404 +               var prefs = getAppAssistant().getPrefsManager().getPrefs();
1405 +
1406 +               if(!prefs.visualNotification)
1407 +                       return;
1408 +       
1409                 Mojo.Log.info("========= RM: displayReminder: in");
1410                 
1411                 if(!reminder){
1412 @@ -481,7 +490,7 @@
1413                 var sound;
1414                 var useSound = false;
1415                 var prefsMgr = getAppAssistant().getPrefsManager();
1416 -               var prefs = prefsMgr.getPrefs();
1417 +//             var prefs = prefsMgr.getPrefs();
1418                 var options = prefsMgr.getAlarmSoundOptions();
1419                 
1420                 //due to previous implementations, it's possible that in the db, alarmSoundOn is a string ("1", "2", etc.) 
1421 @@ -513,16 +522,17 @@
1422                 }
1423                                 
1424                 var soundfile   = (useSound ? sound: null);
1425 -               var soundclass  = (useSound ? null : sound);
1426 +               var soundclass  = (useSound ? "notifications" : sound);
1427                 var params;     
1428                 
1429                 //To just play sound: Mojo.Controller.getAppController().playSoundNotification(soundclass, soundfile, null, true);
1430                 
1431                 var reminderStageController = Mojo.Controller.getAppController().getStageController(stageName);
1432                 if(!reminderStageController){                   
1433 -                       var pushReminderScene = function(reminder, needThrob, stageController) {
1434 +                       var pushReminderScene = function(reminder, needThrob, soundclass, soundfile, stageController) {
1435                                 Mojo.Log.info("========= RM: pushReminderScene: in");
1436                                 stageController.pushScene('reminder', reminder, needThrob);                             
1437 +                               Mojo.Controller.getAppController().playSoundNotification(soundclass, soundfile, null, true);
1438                                 this.notifyDisplayObservers(reminder);
1439                                 Mojo.Log.info("========= RM: pushReminderScene: out");
1440                         };
1441 @@ -532,10 +542,11 @@
1442                         ,       lightweight                             : true
1443                         ,       applicationStylesheets  : [stylesheetName]
1444                         ,       height                                  : height
1445 +                       ,       soundclass                              : "none"
1446                         }; 
1447 -                       params [(useSound ? "sound" : "soundclass")] = sound;
1448 +//                     params [(useSound ? "sound" : "soundclass")] = sound;
1449                         Mojo.Log.info("========= RM: displayReminder: creating reminder assistant stage");
1450 -                       Mojo.Controller.getAppController().createStageWithCallback (params, pushReminderScene.bind (this, reminder, true), "popupalert");       
1451 +                       Mojo.Controller.getAppController().createStageWithCallback (params, pushReminderScene.bind (this, reminder, prefs.blinkNotification, soundclass, soundfile), "popupalert");
1452                 }
1453                 else{
1454                         Mojo.Log.info("========= RM: displayReminder: reusing reminder assistant stage");
1455 @@ -561,6 +572,62 @@
1456                 Mojo.Log.info("========= RM: displayReminder: out");
1457         },
1458         
1459 +       schedulePlayNotificationSoundTask: function(count) {
1460 +               var prefs = getAppAssistant().getPrefsManager().getPrefs();
1461 +
1462 +               if((prefs.alarmSoundOn == 0) || (prefs.notificationRepeatInterval == 0))
1463 +                       return;
1464 +
1465 +               if(count++ < prefs.notificationRepeatLimit) {
1466 +                       var currentTime = new Date();
1467 +                       
1468 +                       var repeatInterval = prefs.notificationRepeatInterval;
1469 +                       
1470 +                       if(count == 0)
1471 +                               var playSoundTime = new Date(currentTime.getTime() + (parseInt(repeatInterval) * 1000) - 60000);
1472 +                       else
1473 +                               var playSoundTime = new Date(currentTime.getTime() + (parseInt(repeatInterval) * 1000));
1474 +                       
1475 +                       var month = playSoundTime.getUTCMonth()+1;
1476 +                       if(month < 10) month = "0" + month;
1477 +                       var day = playSoundTime.getUTCDate();
1478 +                       if(day < 10) day = "0" + day;
1479 +                       var year = playSoundTime.getUTCFullYear();
1480 +
1481 +                       var hours = playSoundTime.getUTCHours();
1482 +                       if(hours < 10) hours = "0" + hours;
1483 +                       var minutes = playSoundTime.getUTCMinutes();
1484 +                       if(minutes < 10) minutes = "0" + minutes;
1485 +                       var seconds = playSoundTime.getUTCSeconds();
1486 +                       if(seconds < 10) seconds = "0" + seconds;
1487 +
1488 +                       var scheduledTimeStr = month + "/" + day + "/" + year + " " + hours + ":" + minutes + ":" + seconds;
1489 +
1490 +                       this.updateTimeoutRequest = new Mojo.Service.Request('palm://com.palm.power/timeout/', {
1491 +                               'method': "set", 'parameters': { 'key': 'calendarPlayNotificationSound',
1492 +                               'wakeup': true, 'at': scheduledTimeStr, 'uri': "palm://com.palm.applicationManager/open",
1493 +                               'params': {'id': 'com.palm.app.calendar', 'params': {'playNotificationSound': count}}} }); 
1494 +               }
1495 +       },
1496 +       
1497 +       removePlayNotificationSoundTask: function() {
1498 +               this.removeTimeoutRequest = new Mojo.Service.Request("palm://com.palm.power/timeout/", {
1499 +                       'method': "clear", 'parameters': {"key": 'calendarPlayNotificationSound'} });
1500 +       },
1501 +
1502 +       playNotificationSound: function() {
1503 +               var prefs = getAppAssistant().getPrefsManager().getPrefs();     
1504 +
1505 +               var options = getAppAssistant().getPrefsManager().getAlarmSoundOptions();
1506 +
1507 +               if(prefs.alarmSoundOn == options.ringtone)
1508 +                       Mojo.Controller.getAppController().playSoundNotification("notifications", prefs.ringtonePath);
1509 +               else if(prefs.alarmSoundOn == options.systemSound)
1510 +                       Mojo.Controller.getAppController().playSoundNotification("calendar");
1511 +               else if(prefs.alarmSoundOn == options.vibrate)
1512 +                       Mojo.Controller.getAppController().playSoundNotification("vibrate");
1513 +       },
1514 +
1515         // OBSERVERS
1516         
1517         //Notify if the reminder hash changes
1518 --- .orig/usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
1519 +++ /usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
1520 @@ -12,4 +12,11 @@
1521         <div id="reminder-email" style="display:none"><div x-mojo-loc="" class="button-wrapper">Contact meeting attendees</div></div>
1522         <div id="reminder-dismiss"><div x-mojo-loc="" class="button-wrapper">Dismiss</div></div>
1523         <div id="reminder-snooze"><div x-mojo-loc="" class="button-wrapper">Snooze</div></div>
1524 +
1525 +       <div style="align:center">
1526 +               <div id="snooze-select" style="display:none"><div x-mojo-loc="" class="button-wrapper" id="snooze-text">Snooze</div></div>
1527 +       </div>
1528 +
1529 +       <div id="snooze-prev" style="display:none"><div x-mojo-loc="" class="button-wrapper">-</div></div>
1530 +       <div id="snooze-next" style="display:none"><div x-mojo-loc="" class="button-wrapper">+</div></div>
1531  </div>
1532 --- .orig/usr/palm/applications/com.palm.app.calendar/sources.json
1533 +++ /usr/palm/applications/com.palm.app.calendar/sources.json
1534 @@ -12,6 +12,7 @@
1535  ,      {       "source": "javascripts\/accountLocalizations.js"}
1536  ,      {       "source": "javascripts\/confirm-deleteevent.js" }
1537  ,      {       "source": "javascripts\/formatting-utils.js"    }
1538 +,      {       "source": "javascripts\/date.js"        }
1539  
1540  ,      {       "source": "app\/models\/busy.free.manager.js"           }
1541  ,      {       "source": "app\/models\/calendar.event.js"                      }
1542 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/week-assistant.js
1543 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/week-assistant.js
1544 @@ -54,6 +54,10 @@
1545                 this.COL_POS                    = [0, 45, 91, 137, 183, 229, 275];
1546                 this.pendingRender              = false;
1547                 this.pendingCalendarSettingsUpdate = false;
1548 +
1549 +               var prefs = this.prefsManager.getPrefs();
1550 +               prefs.eventsViewDisplayType = "week";
1551 +               this.prefsManager.saveToDB(prefs);
1552         },
1553         
1554         databaseChanged: function (response) {
1555 @@ -137,8 +141,9 @@
1556         buildWeekTitle: function() {
1557                 var today = Date.today().clearTime();
1558                 var dayOfWeek = this.getFirstDayOfWeek(this.weekDate);
1559 +               var weekNumber = new Date(this.weekDate).getISO8601Week();
1560                 
1561 -               var template = new Template($L("Week of #{dateStr}"));
1562 +               var template = new Template($L("Week") + " #{weekStr}, " + $L("#{dateStr}"));
1563                 var templateModel = {};
1564                 var formatObj = {};
1565                 // formatString = "MMM d, yyyy";
1566 @@ -146,6 +151,7 @@
1567          formatObj.dateComponents = "mdy";
1568                 //templateModel.dateStr = Mojo.Format.formatDate(dayOfWeek, $L("MMM d, yyyy"));
1569                 templateModel.dateStr = Mojo.Format.formatDate(dayOfWeek, formatObj);
1570 +               templateModel.weekStr = weekNumber;
1571                 this.title.innerHTML = template.evaluate(templateModel);
1572                 
1573                 if (this.changingWeeks) {
1574 @@ -797,7 +803,7 @@
1575                 this.menuModel =
1576                 {       visible :       true
1577                 ,       items   :
1578 -                       [       {}
1579 +                       [       {label: $L('Event'), icon: 'new-timed', command: 'newtimed'}
1580                         ,       {       label           : $L('Views')
1581                                 ,       toggleCmd       : 'week'
1582                                 ,       items           :
1583 @@ -806,7 +812,7 @@
1584                                         ,       {       label: $L('Month')      , icon: 'menu-month', command: 'month'  }
1585                                         ]
1586                                 }
1587 -                       ,       {}
1588 +                       ,       {label: $L('All day event'), icon: 'new-allday', command: 'newallday'}
1589                         ]
1590                 };
1591  
1592 @@ -826,6 +832,30 @@
1593                 this.calendarsManager.syncAllCalendars (this.controller);
1594         }
1595  
1596 +,      getCalId :function(){
1597 +               var currentCal  = this.calendarsManager.getCurrentCal();
1598 +               var defaultCalId= currentCal;
1599 +
1600 +               if (currentCal === "all") {
1601 +                       // Create an event in the calendar specified by the defaultCalId preference
1602 +                       defaultCalId= this.prefsManager.getDefaultCalendar();
1603 +                       var manager     = this.calendarsManager;
1604 +
1605 +                       if (defaultCalId === 0) {
1606 +                               defaultCalId = manager.getLocalCalendarId();
1607 +                       }
1608 +
1609 +                       // Check to see if the calendarId is a valid one
1610 +                       if (manager.getCalName(defaultCalId) === undefined) {
1611 +                               // The default calendar doesn't exist anymore so let's just create it
1612 +                               // in Local
1613 +                               defaultCalId = manager.getLocalCalendarId();
1614 +                       }
1615 +               }
1616 +
1617 +               return defaultCalId;
1618 +       }
1619 +       
1620  ,      handleCommand: function(event) {
1621                 if(event.type == Mojo.Event.command) {
1622                         if (event.command == 'month') {
1623 @@ -837,6 +867,10 @@
1624                         } else if (event.command == 'day') {
1625                                 Mojo.Event.stop (event);
1626                                 this.handleDayView();
1627 +                       } else if (event.command == 'newtimed') {
1628 +                               this.controller.stageController.pushScene('edit', 0, 0, false,this.getCalId()/*calendarId*/,0/*subject*/);
1629 +                       } else if (event.command == 'newallday') {
1630 +                               this.controller.stageController.pushScene('edit', 0, 0, true,this.getCalId()/*calendarId*/,0/*subject*/);
1631                         } else if (event.command == Mojo.Menu.prefsCmd) {
1632                                 Mojo.Event.stop (event);
1633                                 this.controller.stageController.pushScene('prefs');
1634 --- .orig/usr/palm/applications/com.palm.app.calendar/resources/es/views/prefs/prefs-scene.html
1635 +++ /usr/palm/applications/com.palm.app.calendar/resources/es/views/prefs/prefs-scene.html
1636 @@ -8,6 +8,19 @@
1637                 </div>                                                                                                                                                                         
1638         </div>
1639         
1640 +<div id="calendar_options">
1641 +       <div class="palm-group">
1642 +               <div class="palm-group-title">Default Calendar View</div>
1643 +
1644 +               <div class="palm-list">
1645 +                       <div class="palm-row single" x-mojo-tap-highlight="momentary">
1646 +                               <div class="palm-row-wrapper">
1647 +                                       <div id="defaultCalendarView" x-mojo-element="ListSelector"></div>
1648 +                               </div>
1649 +                       </div>
1650 +               </div>
1651 +       </div>
1652 +
1653         <div id='pv_startofweek_div' class="palm-group">
1654                 <div class="palm-group-title">
1655                         Primer día de la semana
1656 @@ -15,7 +28,7 @@
1657                 <div class="palm-list">
1658                         <div class="palm-row single ">
1659                                 <div class="palm-row-wrapper">
1660 -                                       <div class="title" id="pv_start_of_week"></div>
1661 +                                       <div id="pv_start_of_week" x-mojo-element="ListSelector"></div>
1662                                 </div>
1663                         </div>
1664                 </div>
1665 @@ -41,28 +54,70 @@
1666                 </div>
1667         </div>
1668  </div>
1669 +</div>
1670 +
1671 +<div id='event_view' style="display:none;">
1672 +       <div class="palm-page-header multi-line">
1673 +               <div class="palm-page-header-wrapper">
1674 +                 <div class="icon prefs"></div>
1675 +                       <div class="title" x-mojo-loc=''>
1676 +                               Default Event Settings
1677 +                       </div>   
1678 +               </div>   
1679 +       </div>
1680 +</div>
1681
1682 +<div id="event_options" style="display:none;">
1683 +<div id='pv_neweventduration_div' class="palm-group">
1684 +       <div class="palm-group-title" x-mojo-loc="">Default event duration</div>
1685 +       <div class="palm-list">
1686 +               <div class="palm-row single">
1687 +                       <div class="palm-row-wrapper">
1688 +                               <div class="title" id="pv_new_event_duration"></div>
1689 +                       </div>
1690 +               </div>
1691 +       </div>
1692 +</div>
1693  
1694  <div id='pv_defaulteventalarm_div' class="palm-group">
1695         <div class="palm-group-title">Recordatorio predeterminado</div>
1696                 <div class="palm-list">
1697                         <div id="pv_default_evt_alarm" class="palm-row first">
1698                                 <div class="palm-row-wrapper">
1699 -                                               <div class="label">Con hora</div>
1700 -                                               <div id="pv_default_evt_alarm_value" class="title"></div>
1701 +                                               <div id="pv_default_evt_alarm_value" class="label" x-mojo-loc=""></div>
1702 +                                               <div class="title">Timed</div>
1703                                 </div>
1704                         </div>
1705         
1706                         <div id="pv_default_allday_evt_alarm" class="palm-row last">
1707                                 <div class="palm-row-wrapper">
1708 -                                       <div class="label">Todo el día</div>
1709 -                                       <div id="pv_default_allday_evt_alarm_value" class="title"></div>
1710 +                                       <div id="pv_default_allday_evt_alarm_value" class="label" x-mojo-loc=""></div>
1711 +                                       <div class="title">All day</div>
1712                                 </div>
1713                         </div>
1714                 </div>
1715  </div>
1716 -<div id='pv_alarmsound_div' class='palm-group'>
1717 +
1718 +<div class="palm-group">
1719 +       <div class="palm-group-title">Snooze Event Reminder</div>
1720 +
1721 +       <div class="palm-list">
1722 +               <div class="palm-row first" x-mojo-tap-highlight="momentary">
1723 +                       <div class="palm-row-wrapper">
1724 +                               <div id="notificationSnoozeEvent" x-mojo-element="ListSelector" class="right"></div>
1725 +                       </div>
1726 +               </div>
1727 +               <div class="palm-row last" x-mojo-tap-highlight="momentary">
1728 +                       <div class="palm-row-wrapper">
1729 +                               <div id="notificationSnoozeAllDay" x-mojo-element="ListSelector" class="right"></div>
1730 +                       </div>
1731 +               </div>
1732 +       </div>
1733 +</div>
1734 +</div>
1735 +<!--<div id='pv_alarmsound_div' class='palm-group'>
1736         <div class="palm-group-title">Recordatorios del evento</div>
1737 -               <div class="palm-list">
1738 +               <div class="palm-list"> -->
1739                         <!--<div class="palm-row">
1740                                 <div class="palm-row-wrapper">
1741                                         <div x-mojo-element="ToggleButton" id="pv_alarmsound_tgl" name="pv_alarmsound_tgl"></div>
1742 @@ -70,7 +125,7 @@
1743                                 </div>
1744                         </div>-->
1745                 
1746 -                       <div id="soundselectrow" class="palm-row single" x-mojo-tap-highlight="momentary">
1747 +<!--                   <div id="soundselectrow" class="palm-row single" x-mojo-tap-highlight="momentary">
1748                                 <div class="palm-row-wrapper">
1749                                         <div id="notificationSoundSelector" x-mojo-element="ListSelector"></div>
1750                                 </div>
1751 @@ -82,31 +137,92 @@
1752                         </div>
1753                     </div>
1754         </div>
1755 +</div> -->
1756 +
1757 +<div id='reminder_view' style="display:none;">
1758 +       <div class="palm-page-header multi-line">
1759 +               <div class="palm-page-header-wrapper">
1760 +                 <div class="icon reminder"></div>
1761 +                       <div class="title" x-mojo-loc=''>
1762 +                               Event Reminder Settings
1763 +                       </div>   
1764 +               </div>   
1765 +       </div>
1766  </div>
1767  
1768 -<div id='pv_neweventduration_div' class="palm-group">
1769 -       <div class="palm-group-title">Duración predeterminada del evento</div>
1770 -       <div class="palm-list">
1771 -               <div class="palm-row single">
1772 -                       <div class="palm-row-wrapper">
1773 -                               <div class="title" id="pv_new_event_duration"></div>
1774 -                       </div>
1775 -               </div>
1776 -       </div>
1777 +<div id="reminder_options" style="display:none;">
1778 +               <div class="palm-group">
1779 +                       <div class="palm-group-title" x-mojo-loc=''>
1780 +                               Event Reminder
1781 +                       </div>
1782 +                       <div class="palm-list">
1783 +                               <div class="palm-row first">
1784 +                                       <div class="palm-row-wrapper">                    
1785 +                                               <div id="VisualNotification" x-mojo-element="ToggleButton"></div>
1786 +                                               <div class="title capitalize" x-mojo-loc=''>
1787 +                                                       Show notification
1788 +                                               </div>                                                               
1789 +                                       </div> 
1790 +                               </div>                
1791 +                               <div class="palm-row last" id="BlinkNotificationRow">
1792 +                                       <div class="palm-row-wrapper">
1793 +                                               <div id="BlinkNotification" x-mojo-element="ToggleButton"></div>
1794 +                                               <div class="title capitalize" x-mojo-loc="">Blink notification</div>
1795 +                                       </div>
1796 +                               </div>
1797 +                       </div>
1798 +               </div>
1799 +
1800 +       <div id="notificationprefs">
1801 +               <div class="palm-group">
1802 +                       <div class="palm-group-title">Notification Sound</div>
1803 +
1804 +                       <div class="palm-list">
1805 +                               <div id="soundselectrow" class="palm-row first" x-mojo-tap-highlight="momentary">
1806 +                                       <div class="palm-row-wrapper">
1807 +                                               <div id="notificationSoundSelector" x-mojo-element="ListSelector" class="right"></div>
1808 +                                       </div>
1809 +                               </div>
1810 +                               <div id="currentringtonerow" class="palm-row last" x-mojo-tap-highlight="momentary">
1811 +                                       <div class="palm-row-wrapper">
1812 +                                               <div id='currentringtone' class="label"></div>
1813 +                                               <div class="title" x-mojo-loc=''>Ringtone</div>
1814 +                                       </div>
1815 +                               </div>
1816 +                       </div>
1817 +               </div>
1818 +       
1819 +               <div class="palm-group">
1820 +                       <div class="palm-group-title">Notification Repeat</div>
1821 +
1822 +                       <div class="palm-list">
1823 +                               <div class="palm-row first" id="NotificationRepeatRow">
1824 +                                       <div class="palm-row-wrapper">
1825 +                                               <div id="NotificationRepeat" x-mojo-element="ListSelector" class="right"></div>
1826 +                                       </div>
1827 +                               </div>
1828 +                               <div class="palm-row last" id="NotificationLimitRow">
1829 +                                       <div class="palm-row-wrapper">
1830 +                                               <div id="NotificationLimit" x-mojo-element="ListSelector" class="right"></div>
1831 +                                       </div>
1832 +                               </div>
1833 +                       </div>
1834 +               </div>
1835 +       </div>
1836  </div>
1837         
1838  <!-- **Accounts and Default Account** -->
1839  
1840  <div id='pv_accounts_div'>
1841 -       <div id="pv_accounts_list_new" class="accounts-list" x-mojo-element="AccountsList"></div>
1842 -       <div id="pv_add_account_btn" class="palm-button" x-mojo-tap-highlight="momentary">
1843 -               Añadir cuenta
1844 +       <div id="pv_default_option_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1845 +               Default Event Options
1846         </div>
1847 -       <div id="pv_view_option_btn" class="palm-button" x-mojo-tap-highlight="momentary">
1848 -               Opciones vista de calendario
1849 +       <div id="pv_reminder_option_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1850 +               Event Reminder Options
1851         </div>
1852 +       <div id="pv_accounts_list_new" x-mojo-element="AccountsList"></div>
1853         <div id="pv_default_calendar_div" class='palm-group'>
1854 -               <div class="palm-group-title">Calendario predeterminado</div>
1855 +               <div class="palm-group-title" x-mojo-loc="">Default Calendar</div>
1856                 <div class="palm-list">
1857                         <div class="palm-row single">
1858                                 <div class="palm-row-wrapper">
1859 @@ -119,9 +235,11 @@
1860         <div class="palm-info-text">
1861                 Los nuevos eventos creados en la vista “Todos los calendarios” pasarán de manera predeterminada a este calendario.
1862         </div>
1863 -       <div id="pv_sync_accounts_btn" class="palm-button" x-mojo-tap-highlight="momentary">
1864 -               Sincronizar ahora
1865 +       <div id="pv_add_account_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1866 +               Add Account
1867         </div>
1868  
1869 +       <div id="pv_view_option_btn" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1870 +               Calendar View Options
1871         </div>
1872  </div>
1873 --- .orig/usr/palm/applications/com.palm.app.calendar/resources/es/views/reminder/reminder-scene.html
1874 +++ /usr/palm/applications/com.palm.app.calendar/resources/es/views/reminder/reminder-scene.html
1875 @@ -12,4 +12,11 @@
1876         <div id="reminder-email" style="display:none"><div class="button-wrapper">Contactar asistentes a reunión</div></div>
1877         <div id="reminder-dismiss"><div class="button-wrapper">Ignorar</div></div>
1878         <div id="reminder-snooze"><div class="button-wrapper">Posponer</div></div>
1879 +
1880 +       <div style="align:center">
1881 +               <div id="snooze-select" style="display:none"><div x-mojo-loc="" class="button-wrapper" id="snooze-text">Snooze</div></div>
1882 +       </div>
1883 +
1884 +       <div id="snooze-prev" style="display:none"><div x-mojo-loc="" class="button-wrapper">-</div></div>
1885 +       <div id="snooze-next" style="display:none"><div x-mojo-loc="" class="button-wrapper">+</div></div>
1886  </div>
1887 --- .orig/usr/palm/applications/com.palm.app.calendar/resources/es/strings.json
1888 +++ /usr/palm/applications/com.palm.app.calendar/resources/es/strings.json
1889 @@ -138,5 +138,38 @@
1890         "st": "º",
1891         "th": "º",
1892         "week(s)": "semana(s)",
1893 -       "year(s)": "año(s)"
1894 +       "year(s)": "año(s)",
1895 +       "1 day before": "",
1896 +       "1 hour before": "",
1897 +       "30 minutes before": "",
1898 +       "15 minutes before": "",
1899 +       "10 minutes before": "",
1900 +       "5 minutes before": "",
1901 +       "At start time": "",
1902 +       "After 5 minutes": "",
1903 +       "After 10 minutes": "",
1904 +       "After 15 minutes": "",
1905 +       "After 30 minutes": "",
1906 +       "After 1 hour": "",
1907 +       "After 1 day": "",
1908 +       "Timed": "",
1909 +       "All Day": "",
1910 +       "No Default View": "",
1911 +       "Day View": "",
1912 +       "Week View": "",
1913 +       "Month View": "",
1914 +       "Disabled": "",
1915 +       "Every 2 minutes": "",
1916 +       "Every 5 minutes": "",
1917 +       "Every 15 minutes": "",
1918 +       "Every 30 minutes": "",
1919 +       "Every 60 minutes": "",
1920 +       "Repeat": "",
1921 +       "Repeat infinitely": "",
1922 +       "Repeat 3 times": "",
1923 +       "Repeat 5 times": "",
1924 +       "Repeat 10 times": "",
1925 +       "Repeat 15 times": "",
1926 +       "Repeat 30 times": "",
1927 +       "Limitation": ""
1928  }