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