Creating calendar reminder notification repeat patch.
[webos-internals:lclarkjrs-modifications.git] / calendar / calendar-notification-repeat.patch
1 This patch will repeat the reminder notification every 2 minutes until you either dismiss or snooze the reminder.
2 Index: /usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
3 ===================================================================
4 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
5 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
6 @@ -95,6 +95,9 @@ var AppAssistant = Class.create({
7                 } 
8                 else if (launchParams.alarmclose){
9                         this.closeReminder(launchParams.alarmclose);
10 +               }
11 +               else if (launchParams.playalarmsound){
12 +                       this.playAlarmSound();
13                 } 
14                 else if (launchParams.dayChange){
15                         this.dayChange();
16 @@ -236,6 +239,13 @@ var AppAssistant = Class.create({
17                 }
18         },
19         
20 +       playAlarmSound: function() {
21 +               if (this.openReminderAlert) {
22 +                       this.openReminderAlert.playAlarmSound();
23 +                       this.openReminderAlert = null;
24 +               }
25 +       },
26 +       
27         scheduleNextReminder: function(eventId) {
28                 new Mojo.Service.Request('palm://com.palm.calendar', {
29                         method: 'scheduleNextReminder',
30 Index: /usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
31 ===================================================================
32 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
33 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
34 @@ -49,6 +49,9 @@ var ReminderAssistant = Class.create({
35                         this.removeAutoCloseTask();
36                         
37                 }
38 +               
39 +               //remove the Notification repeat task
40 +               this.removePlayAlarmSoundTask();
41         },
42  
43         remindersUpdated: function() {
44 @@ -67,6 +70,9 @@ var ReminderAssistant = Class.create({
45                 this.reminder = this.reminders.getMostRecentReminder();
46                 this.scheduleAutoCloseTask();
47                 this.updateDisplay();
48 +               
49 +               //setup the notification repeat task
50 +               this.schedulePlayAlarmSoundTask();
51         },
52  
53         updateDisplay: function() {
54 @@ -269,6 +275,14 @@ var ReminderAssistant = Class.create({
55                 this.dismissed = true; // prevent snooze
56                 this.closeAlert();
57         },
58 +       
59 +       playAlarmSound: function() {
60 +               //temporarily set the snooze to 0 will immediately re-trigger allert to get our attention.
61 +               this.dismissed = false;
62 +               this.DEFAULT_SNOOZE = 0;
63 +               this.closeAlert();
64 +       },
65 +                                       
66         specialCleanup:function(){
67                 Mojo.Log.info("****************in special cleanup");
68                 this.shuttingDown =true;
69 @@ -308,6 +322,29 @@ var ReminderAssistant = Class.create({
70                                                                 });
71         },
72         
73 +       schedulePlayAlarmSoundTask: function() {
74 +               //retrigger reminder every two minutes until we acknowledge it.
75 +               //change the value in addMinutes to a value other than 2 if you prefer a different time span for the notification repeat.
76 +               //ultimatly it would be best to add this to the preferences page.
77 +               var playSoundTime = new Date().addMinutes(2);
78 +               
79 +               this.controller.serviceRequest('palm://com.palm.taskScheduler', {
80 +                                       method: 'updateTask',
81 +                                       parameters: {uri: 'palm://com.palm.applicationManager/open',
82 +                                       arguments: {'id': 'com.palm.app.calendar',
83 +                                               'params': {'playalarmsound': 'true'}},
84 +                                       key: 'calendar-playalarmsound',
85 +                                       start: {date: playSoundTime.toUTCString()}}
86 +                                       });
87 +       },
88 +
89 +       removePlayAlarmSoundTask: function() {
90 +               this.controller.serviceRequest('palm://com.palm.taskScheduler', {
91 +                       method: 'removeTask',
92 +                       parameters: {key: 'calendar-playalarmsound'}
93 +                       });
94 +       },                                                                                                                                                                              
95 +       
96         replaceHTML: function(element, content) {
97         var range = element.ownerDocument.createRange();
98         range.selectNode(element);