1 new, 5 updated patches.
[webos-internals:modifications.git] / calendar / calendar-snooze-duration-selection.patch
1 diff --git a/usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js b/usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
2 index 5375929..3509e2a 100644
3 --- a/usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
5 @@ -399,9 +399,9 @@ var AppAssistant = Class.create({
6                 var reminder = getReminderManager().getReminder(eventId);
7                 reminder.userClosed = false;
8                 if (reminder.attendees.length > 1 /*now we include the organizer in attendee list*/)
9 -                       height = 203;
10 +                       height = 280; //203 orig; 74 + a couple to get more choices
11                 else
12 -                       height = 149;
13 +                       height = 226; //149 orig;
14                 
15                 var needThrobbing =(hasNewContent || !isSnoozedReminder) ? true:false;
16                 Mojo.Log.info("$$$$$$$$ AppAssistant doAlarm:createStageWithCallback for stage: "+this.createAlarmStageName(eventId)+", stage height is: "+height);
17 diff --git a/usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js b/usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
18 index d190fd1..a02bf7c 100644
19 --- a/usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
20 +++ b/usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
21 @@ -4,7 +4,7 @@
22  var ReminderAssistant = Class.create({
23         initialize: function(eventId,needThrobbing) {
24                 Mojo.Log.info("$$$$$$$$ Reminder-assistant initialize: start: "+eventId);
25 -               this.DEFAULT_SNOOZE = 5;
26 +               this.DEFAULT_SNOOZE = -15;
27                 this.reminders = getReminderManager();
28                 getAppAssistant().openReminderAlert = this;
29                 this.requests = [];
30 @@ -26,7 +26,49 @@ var ReminderAssistant = Class.create({
31                 Mojo.Log.info("$$$$$$$$ Reminder-assistant activate:end");
32         },
33         
34 +       snoozeOptions: [
35 +               {label:$L('5 Minutes before start'), value:'-5'},
36 +               {label:$L('10 Minutes before start'), value:'-10'},
37 +               {label:$L('15 Minutes before start'), value:'-15'},
38 +               {label:$L('30 Minutes before start'), value:'-30'},
39 +               {label:$L('5 Minutes'), value:'5'},
40 +               {label:$L('10 Minutes'), value:'10'},
41 +               {label:$L('15 Minutes'), value:'15'},
42 +               {label:$L('30 Minutes'), value:'30'},
43 +               {label:$L('1 Hour'), value:'60'},
44 +               {label:$L('2 Hours'), value:'120'},
45 +               {label:$L('4 Hours'), value:'240'},
46 +               {label:$L('8 Hours'), value:'480'},
47 +               {label:$L('10 Hours'), value:'600'},
48 +               {label:$L('12 Hours'), value:'720'},
49 +               {label:$L('1 Day'), value:'1440'},
50 +               {label:$L('2 Days'), value:'2880'},
51 +               {label:$L('3 Days'), value:'4320'},
52 +               {label:$L('4 Days'), value:'5760'},
53 +               {label:$L('5 Days'), value:'7200'},
54 +               {label:$L('6 Days'), value:'8640'},
55 +               {label:$L('1 Week'), value:'10080'},
56 +               {label:$L('2 Weeks'), value:'20160'}
57 +       ],
58 +
59         setup: function() {
60 +               this.controller.setupWidget('myscroller',
61 +               {
62 +                       mode:'vertical'
63 +               });
64 +
65 +               //setup the snooze duration selector list
66 +               this.selectorChoices = this.snoozeOptions;
67 +               this.selectorAttributes = { label: "Snooze Duration", labelPlacement: "left", choices: this.selectorChoices, modelProperty:'value' };
68 +
69 +               //Need to figure out how to remember previous selected snooze value.
70 +               //set the default duration to match the default snooze value
71 +               this.selectorModel = {value:'-15'};
72 +               this.selectorModel.value = '-15'; 
73 +               this.controller.setupWidget('snoozeSelector', this.selectorAttributes, this.selectorModel);
74 +
75 +               this.onSnoozeDurationChangedHandler = this.onSnoozeDurationChanged.bindAsEventListener(this);
76 +
77                 Mojo.Log.info("$$$$$$$$ Reminder-assistant setup:start");
78                 this.service = getCalendarService();
79  
80 @@ -150,6 +192,9 @@ var ReminderAssistant = Class.create({
81                 
82                 this.controller.get('reminder-dismiss').addEventListener(Mojo.Event.tap, this.onDismissHandler);
83                 this.controller.get('reminder-snooze').addEventListener(Mojo.Event.tap, this.onSnoozeHandler);
84 +
85 +               //add snoozeDuration event listners
86 +               this.controller.get('snoozeSelector').addEventListener(Mojo.Event.propertyChange, this.onSnoozeDurationChangedHandler);
87         },
88  
89         removeListeners: function() {
90 @@ -167,6 +212,10 @@ var ReminderAssistant = Class.create({
91                 if (email) email.removeEventListener(Mojo.Event.tap, this.onEmailHandler);
92                 var snooze = this.controller.get('reminder-snooze');
93                 if (snooze) snooze.removeEventListener(Mojo.Event.tap, this.onSnoozeHandler);
94 +
95 +               //remove snoozeDuration event listners
96 +               var snoozeDuration = this.controller.get('snoozeSelector');
97 +               if (snoozeDuration) snoozeDuration.removeEventListener(Mojo.Event.propertyChange, this.onSnoozeDurationChangedHandler);
98         },
99         
100         
101 @@ -307,6 +356,16 @@ var ReminderAssistant = Class.create({
102                 Mojo.Log.info("$$$$$$$$ Reminder-assistant onSnooze: end: " + this.reminder.id);
103         },
104         
105 +       /* handle the change event for the snooze duration.
106 +        * set the default snooze value to the selection value
107 +        * need to figure out how to save this value for reuse when the snooze duration
108 +        * expires so that we can set the selection to the same value prevously selected
109 +        */
110 +       onSnoozeDurationChanged: function(value) {
111 +               this.DEFAULT_SNOOZE = this.selectorModel.value;
112 +               this.closeAlert();
113 +       },
114 +
115         removeReminder: function() {
116                 Mojo.Log.info("$$$$$$$$ Reminder-assistant removeReminder: start: " + this.reminder.id);
117                 this.reminders.removeReminder(this.reminder.id);
118 @@ -342,7 +401,17 @@ var ReminderAssistant = Class.create({
119                         return;
120                 }       
121                 
122 -               var snooze = new Date().addMinutes(minutes);
123 +               var snooze;
124 +               
125 +               if( minutes >=0 )
126 +               {
127 +                       snooze = new Date().addMinutes(minutes);
128 +               }
129 +               else
130 +               {
131 +                       snooze = new Date(this.reminder.time).addMinutes(minutes);
132 +               }
133 +               
134                 Mojo.Log.info("$$$$$$$$ Reminder-assistant snooze: updateTask: calendar-snooze-" + this.reminder.id + "   date = " + snooze.toUTCString());
135                 
136                 this.controller.serviceRequest('palm://com.palm.taskScheduler', {
137 diff --git a/usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html b/usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
138 index c3ca688..d2915a6 100644
139 --- a/usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
140 +++ b/usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
141 @@ -9,6 +9,15 @@
142                         <div id="reminder-event"  class="palm-dashboard-text-wrapper"></div>
143                 </div>
144         </div>
145 +       <div class="palm-dashboard-text-container" style="width:auto;max-width:none">
146 +               <div class="palm-row" x-mojo-tap-highlight="momentary">
147 +                       <div class="palm-row-wrapper">
148 +                               <div id="myscroller" class="snoozeScroller" style="width:100%;height:100%" x-mojo-element="Scroller">
149 +                                       <div id="snoozeSelector" class="dashboard-event-snooze-duration" x-mojo-element="ListSelector"></div>
150 +                               </div>
151 +                       </div>
152 +               </div>
153 +       </div>
154         <div id="reminder-email" style="display:none"><div x-mojo-loc="" class="button-wrapper">Contact meeting attendees</div></div>
155         <div id="reminder-dismiss"><div x-mojo-loc="" class="button-wrapper">Dismiss</div></div>
156         <div id="reminder-snooze"><div x-mojo-loc="" class="button-wrapper">Snooze</div></div>
157 diff --git a/usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css b/usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
158 index 4a84218..cf2901d 100644
159 --- a/usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
160 +++ b/usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
161 @@ -2,6 +2,10 @@
162   * Copyright 2008 Palm Inc. Confidential until public release.
163   */
164  
165 +/*@import url(global.css);*/
166 +/*Note the version needs to be updated to match the latest mojo framework on your device.*/
167 +@import url(/usr/palm/frameworks/mojo/submissions/330/stylesheets/global.css);
168 +
169  .notification-panel    {
170      background: #000;
171      color: #fff;
172 @@ -223,3 +227,7 @@
173      margin-top: 0px;
174         height: 70px;
175  }
176 +
177 +.palm-popup-content {
178 +       color: black;
179 +}