Updated for 1.3.1
[webos-internals:akamils-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
3 11-15-09:
4 Updated for 1.3.1
5 Index: /usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
6 ===================================================================
7 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
8 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
9 @@ -98,6 +98,9 @@ var AppAssistant = Class.create({
10                 else if (launchParams.alarmclose){
11                         //console.error("$$$$$$$$ AppAssistant handleLaunch : alarmclose");
12                         this.closeReminder(launchParams.alarmclose);
13 +               }
14 +               else if (launchParams.playalarmsound){
15 +                       this.playAlarmSound();
16                 } 
17                 else if (launchParams.dayChange){
18                         this.dayChange();
19 @@ -241,7 +244,14 @@ var AppAssistant = Class.create({
20                 }
21                 //console.error("$$$$$$$$ AppAssistant closeReminder:end");
22         },
23 -       
24 +
25 +       playAlarmSound: function() {
26 +               if (this.openReminderAlert) {
27 +                       this.openReminderAlert.playAlarmSound();
28 +                       this.openReminderAlert = null;
29 +               }
30 +       },
31 +                                                                                                       
32         scheduleNextReminder: function(eventId) {
33                 //console.error("$$$$$$$$ AppAssistant scheduleNextReminder: for event:"+eventId);
34                 new Mojo.Service.Request('palm://com.palm.calendar', {
35 Index: /usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
36 ===================================================================
37 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
38 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
39 @@ -57,6 +57,9 @@ var ReminderAssistant = Class.create({
40                         }
41                 }
42                 //console.error("$$$$$$$$ Reminder-assistant cleanup:end:");
43 +               
44 +               //remove the Notification repeat task
45 +               this.removePlayAlarmSoundTask();
46         },
47  
48         remindersUpdated: function() {
49 @@ -90,6 +93,9 @@ var ReminderAssistant = Class.create({
50                 this.scheduleAutoCloseTask();
51                 this.updateDisplay();
52                 //console.error("$$$$$$$$ Reminder-assistant updateMostRecentReminder:end");
53 +               
54 +               //setup the notification repeat task
55 +               this.schedulePlayAlarmSoundTask();
56         },
57  
58         updateDisplay: function() {
59 @@ -312,6 +318,14 @@ var ReminderAssistant = Class.create({
60                 this.closeAlert();
61                 //console.error("$$$$$$$$ Reminder-assistant autoCloseAlert: end " + this.reminder.id);
62         },
63 +       
64 +       playAlarmSound: function() {
65 +               //temporarily set the snooze to 0 will immediately re-trigger allert to get our attention.
66 +               this.dismissed = false;
67 +               this.DEFAULT_SNOOZE = 0;
68 +               this.closeAlert();
69 +       },
70 +                                                                               
71         specialCleanup:function(eventId){
72                 //console.error("$$$$$$$$ Reminder-assistant specialCleanup: start:**********"+eventId );
73                 //we need to do this so that cleanup snoozes the right reminder
74 @@ -360,6 +374,29 @@ var ReminderAssistant = Class.create({
75                                                                 });
76                 //console.error("$$$$$$$$ Reminder-assistant removeAutoCloseTask: end " + this.reminder.id);
77         },
78 +
79 +       schedulePlayAlarmSoundTask: function() {
80 +               //retrigger reminder every two minutes until we acknowledge it.
81 +               //change the value in addMinutes to a value other than 2 if you prefer a different time span for the notification repeat.
82 +               //ultimatly it would be best to add this to the preferences page.
83 +               var playSoundTime = new Date().addMinutes(2);
84 +
85 +               this.controller.serviceRequest('palm://com.palm.taskScheduler', {
86 +                       method: 'updateTask',
87 +                       parameters: {uri: 'palm://com.palm.applicationManager/open',
88 +                       arguments: {'id': 'com.palm.app.calendar',
89 +                               'params': {'playalarmsound': 'true'}},
90 +                       key: 'calendar-playalarmsound',
91 +                       start: {date: playSoundTime.toUTCString()}}
92 +                       });
93 +       },
94 +
95 +       removePlayAlarmSoundTask: function() {
96 +               this.controller.serviceRequest('palm://com.palm.taskScheduler', {
97 +                       method: 'removeTask',
98 +                       parameters: {key: 'calendar-playalarmsound'}
99 +                       });
100 +       },
101         
102         replaceHTML: function(element, content) {
103                 //console.error("$$$$$$$$ Reminder-assistant replaceHTML:start");