Fixed 4 more patches for new release
[webos-internals:modifications.git] / calendar / calendar-snooze-duration-selection.patch
1 This patch adds a snooze duration selection to the reminder notification. 
2 Currently i cannot get the snooze duration list to scroll so the snooze duration options are limited to 4 options.
3
4 11-15-09:
5 Updated for 1.3.1
6 Index: /usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
7 ===================================================================
8 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
9 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
10 @@ -343,9 +343,9 @@ var AppAssistant = Class.create({
11                 var height;
12                 var reminder = getReminderManager().getReminder(eventId);
13                 if (reminder.attendees.length > 1 /*now we include the organizer in attendee list*/)
14 -                       height = 203;
15 +                       height = 280;//203 orig; 74 + a couple to get more choices
16                 else
17 -                       height = 149;
18 +                       height = 226;//149 orig;
19                 
20                 var needThrobbing =(hasNewContent || !isSnoozedReminder) ? true:false;
21                 //console.error("$$$$$$$$ AppAssistant doAlarm:createStageWithCallback for stage: "+this.createAlarmStageName(eventId));
22 Index: /usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
23 ===================================================================
24 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
25 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
26 @@ -4,7 +4,7 @@
27  var ReminderAssistant = Class.create({
28         initialize: function(needThrobbing) {
29                 //console.error("$$$$$$$$ Reminder-assistant initialize:start");
30 -               this.DEFAULT_SNOOZE = 5;
31 +               this.DEFAULT_SNOOZE = 30;
32                 this.reminders = getReminderManager();
33                 getAppAssistant().openReminderAlert = this;
34                 this.requests = [];
35 @@ -23,7 +23,54 @@ var ReminderAssistant = Class.create({
36                 }
37                 //console.error("$$$$$$$$ Reminder-assistant activate:end");
38         },
39 +       
40 +       //Until i figure out (or someone) how to get the scrolling of the list selection to work reduce this
41 +               //list to your favorite three
42 +                       //Make sure you update the default snooze value to respectively
43 +                               //The options set in these instructions will give you a 30 min default value and the options for 1hr,
44 +                                       //2hrs and 1day. 
45 +                                               //Note that the 30min option is added to the top so we can use it as a default but is left in the
46 +                                                       //correct location commented out for when the scrolling is working.
47 +       snoozeOptions: [
48 +               {label:$L('30 Minutes'), value:'30'},
49 +               //{label:$L('5 Minutes'), value:'5'},
50 +               //{label:$L('10 Minutes'), value:'10'},
51 +               {label:$L('15 Minutes'), value:'15'},
52 +               //{label:$L('30 Minutes'), value:'30'},
53 +               {label:$L('1 Hour'), value:'60'},
54 +               {label:$L('2 Hours'), value:'120'},
55 +               //{label:$L('4 Hours'), value:'240'},
56 +               //{label:$L('8 Hours'), value:'480'},
57 +               //{label:$L('10 Hours'), value:'600'},
58 +               //{label:$L('12 Hours'), value:'720'},
59 +               {label:$L('1 Day'), value:'1440'},
60 +               {label:$L('2 Days'), value:'2880'},
61 +               //{label:$L('3 Days'), value:'4320'},
62 +               //{label:$L('4 Days'), value:'5760'},
63 +               //{label:$L('5 Days'), value:'7200'},
64 +               //{label:$L('6 Days'), value:'8640'},
65 +               //{label:$L('1 Week'), value:'10080'},
66 +               //{label:$L('2 Weeks'), value:'20160'}
67 +       ],
68 +       
69         setup: function() {
70 +               this.controller.setupWidget('myscroller',
71 +               {
72 +                       mode:'vertical'
73 +               });
74 +
75 +               //setup the snooze duration selector list
76 +               this.selectorChoices = this.snoozeOptions;
77 +               this.selectorAttributes = { label: "Snooze Duration", labelPlacement: "left", choices: this.selectorChoices, modelProperty:'value' };
78 +
79 +               //Need to figure out how to remember previous selected snooze value.
80 +               //set the default duration to match the default snooze value
81 +               this.selectorModel = {value:'30'};
82 +               this.selectorModel.value = '30'; 
83 +               this.controller.setupWidget('snoozeSelector', this.selectorAttributes, this.selectorModel);
84 +
85 +               this.onSnoozeDurationChangedHandler = this.onSnoozeDurationChanged.bindAsEventListener(this);
86 +               
87                 //console.error("$$$$$$$$ Reminder-assistant setup:start");
88                 this.service = getCalendarService();
89  
90 @@ -145,6 +192,9 @@ var ReminderAssistant = Class.create({
91                 
92                 this.controller.get('reminder-dismiss').addEventListener(Mojo.Event.tap, this.onDismissHandler);
93                 this.controller.get('reminder-snooze').addEventListener(Mojo.Event.tap, this.onSnoozeHandler);
94 +               
95 +               //add snoozeDuration event listners
96 +               this.controller.get('snoozeSelector').addEventListener(Mojo.Event.propertyChange, this.onSnoozeDurationChangedHandler);
97         },
98  
99         removeListeners: function() {
100 @@ -162,6 +212,10 @@ var ReminderAssistant = Class.create({
101                 if (email) email.removeEventListener(Mojo.Event.tap, this.onEmailHandler);
102                 var snooze = this.controller.get('reminder-snooze');
103                 if (snooze) snooze.removeEventListener(Mojo.Event.tap, this.onSnoozeHandler);
104 +               
105 +               //remove snoozeDuration event listners
106 +               var snoozeDuration = this.controller.get('snoozeSelector');
107 +               if (snoozeDuration) snoozeDuration.removeEventListener(Mojo.Event.propertyChange, this.onSnoozeDurationChangedHandler);
108         },
109         
110         
111 @@ -260,7 +314,15 @@ var ReminderAssistant = Class.create({
112                 this.closeAlert();
113                 //console.error("$$$$$$$$ Reminder-assistant onSnooze: end: " + this.reminder.id);
114         },
115 -       
116 +
117 +       //handle the change event for the snooze duration.
118 +       //set the default snooze value to the selection value
119 +       //need to figure out how to save this value for reuse when the snooze duration expires so that we can set the selection to the same value prevously selected
120 +       onSnoozeDurationChanged: function(value) {
121 +               this.DEFAULT_SNOOZE = this.selectorModel.value;
122 +               this.closeAlert();
123 +       },
124 +               
125         removeReminder: function() {
126                 //console.error("$$$$$$$$ Reminder-assistant removeReminder: start: " + this.reminder.id);
127                 this.reminders.removeReminder(this.reminder.id);
128 Index: /usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
129 ===================================================================
130 --- .orig/usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
131 +++ /usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
132 @@ -9,6 +9,15 @@
133                         <div id="reminder-event"  class="palm-dashboard-text-wrapper"></div>
134                 </div>
135         </div>
136 +       <div class="palm-dashboard-text-container">
137 +               <div class="palm-row" x-mojo-tap-highlight="momentary">
138 +                       <div class="palm-row-wrapper">
139 +                               <div id="myscroller" class="snoozeScroller" x-mojo-element="Scroller">
140 +                                       <div id="snoozeSelector" class="dashboard-event-snooze-duration" x-mojo-element="ListSelector"></div>
141 +                               </div>
142 +                       </div>
143 +               </div>
144 +       </div>
145         <div id="reminder-email" style="display:none" ><div class="button-wrapper" x-mojo-loc="">Contact meeting attendees</div></div>
146         <div id="reminder-dismiss" ><div class="button-wrapper" x-mojo-loc="">Dismiss</div></div>
147         <div id="reminder-snooze" ><div class="button-wrapper" x-mojo-loc="">Snooze</div></div>
148 Index: /usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
149 ===================================================================
150 --- .orig/usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
151 +++ /usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
152 @@ -2,6 +2,10 @@
153   * Copyright 2008 Palm Inc. Confidential until public release.
154   */
155  
156 +/*@import url(global.css);*/
157 +/*Note the version needs to be updated to match the latest mojo framework on your device.*/
158 +@import url(/usr/palm/frameworks/mojo/submissions/200.72/stylesheets/global.css);
159 +
160  .notification-panel    {
161      background: #000;
162      color: #fff;