Merge commit 'refs/merge-requests/1818' of git://gitorious.org/webos-internals/modifi...
[webos-internals:skurriers-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 This patch is currently only compatible with 1.2.1. It will need to be udpated with each new WebOS update due to the import of the base stylesheets.
4 Index: /usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
5 ===================================================================
6 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
7 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js
8 @@ -314,9 +314,9 @@ var AppAssistant = Class.create({
9                 var height;
10                 var reminder = getReminderManager().getReminder(eventId);
11                 if (reminder.attendees.length > 1 /*now we include the organizer in attendee list*/)
12 -                       height = 183;
13 +                       height = 237;//183_orig;
14                 else
15 -                       height = 129;
16 +                       height = 183;//129_orig;
17                 
18                 var needThrobbing =(hasNewContent || !isSnoozedReminder) ? true:false;
19                 
20 Index: /usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
21 ===================================================================
22 --- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
23 +++ /usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js
24 @@ -3,7 +3,7 @@
25  
26  var ReminderAssistant = Class.create({
27         initialize: function(needThrobbing) {
28 -               this.DEFAULT_SNOOZE = 5;
29 +               this.DEFAULT_SNOOZE = 30;
30                 this.reminders = getReminderManager();
31                 getAppAssistant().openReminderAlert = this;
32                 this.requests = [];
33 @@ -20,7 +20,54 @@ var ReminderAssistant = Class.create({
34                         this.controller.stageController.indicateNewContent(true);
35                 }
36         },
37 +       
38 +       //Until i figure out (or someone) how to get the scrolling of the list selection to work reduce this
39 +       //list to your favorite three
40 +       //Make sure you update the default snooze value to respectively
41 +       //The options set in these instructions will give you a 30 min default value and the options for 1hr,
42 +       //2hrs and 1day. 
43 +       //Note that the 30min option is added to the top so we can use it as a default but is left in the
44 +       //correct location commented out for when the scrolling is working.
45 +       snoozeOptions: [
46 +               {label:$L('30 Minutes'), value:'30'},
47 +               //{label:$L('5 Minutes'), value:'5'},
48 +               //{label:$L('10 Minutes'), value:'10'},
49 +               //{label:$L('15 Minutes'), value:'15'},
50 +               //{label:$L('30 Minutes'), value:'30'},
51 +               {label:$L('1 Hour'), value:'60'},
52 +               {label:$L('2 Hours'), value:'120'},
53 +               //{label:$L('4 Hours'), value:'240'},
54 +               //{label:$L('8 Hours'), value:'480'},
55 +               //{label:$L('10 Hours'), value:'600'},
56 +               //{label:$L('12 Hours'), value:'720'},
57 +               {label:$L('1 Day'), value:'1440'},
58 +               //{label:$L('2 Days'), value:'2880'},
59 +               //{label:$L('3 Days'), value:'4320'},
60 +               //{label:$L('4 Days'), value:'5760'},
61 +               //{label:$L('5 Days'), value:'7200'},
62 +               //{label:$L('6 Days'), value:'8640'},
63 +               //{label:$L('1 Week'), value:'10080'},
64 +               //{label:$L('2 Weeks'), value:'20160'}
65 +               ],
66 +               
67         setup: function() {
68 +               this.controller.setupWidget('myscroller',
69 +               {
70 +                   mode:'vertical'
71 +               });
72 +       
73 +               //setup the snooze duration selector list
74 +               this.selectorChoices = this.snoozeOptions;
75 +               this.selectorAttributes = { label: "Snooze Duration", labelPlacement: "left", choices: this.selectorChoices, modelProperty:'value' };
76 +               
77 +               //Need to figure out how to remember previous selected snooze value.
78 +               //set the default duration to match the default snooze value
79 +               this.selectorModel = {value:'30'};
80 +               this.selectorModel.value = '30'; 
81 +               this.controller.setupWidget('snoozeSelector', this.selectorAttributes, this.selectorModel);
82 +               
83 +               this.onSnoozeDurationChangedHandler = this.onSnoozeDurationChanged.bindAsEventListener(this);
84 +       
85                 this.service = getCalendarService();
86  
87                 this.reminders.observeReminders('alert', this);
88 @@ -124,6 +171,9 @@ var ReminderAssistant = Class.create({
89                 
90                 this.controller.get('reminder-dismiss').addEventListener(Mojo.Event.tap, this.onDismissHandler);
91                 this.controller.get('reminder-snooze').addEventListener(Mojo.Event.tap, this.onSnoozeHandler);
92 +               
93 +               //add snoozeDuration event listners
94 +               this.controller.get('snoozeSelector').addEventListener(Mojo.Event.propertyChange, this.onSnoozeDurationChangedHandler);
95         },
96  
97         removeListeners: function() {
98 @@ -139,6 +189,10 @@ var ReminderAssistant = Class.create({
99                 if (email) email.removeEventListener(Mojo.Event.tap, this.onEmailHandler);
100                 var snooze = this.controller.get('reminder-snooze');
101                 if (snooze) snooze.removeEventListener(Mojo.Event.tap, this.onSnoozeHandler);
102 +               
103 +               //remove snoozeDuration event listners
104 +               var snoozeDuration = this.controller.get('snoozeSelector');
105 +               if (snoozeDuration) snoozeDuration.removeEventListener(Mojo.Event.propertyChange, this.onSnoozeDurationChangedHandler);
106         },
107         
108         
109 @@ -229,7 +283,15 @@ var ReminderAssistant = Class.create({
110                 this.snoozed =true;
111                 this.closeAlert();
112         },
113 -       
114 +
115 +       //handle the change event for the snooze duration.
116 +       //set the default snooze value to the selection value
117 +       //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
118 +       onSnoozeDurationChanged: function(value) {
119 +               this.DEFAULT_SNOOZE = this.selectorModel.value;
120 +               this.closeAlert();               
121 +       },
122 +                               
123         removeReminder: function() {
124                 this.reminders.removeReminder(this.reminder.id);
125         },
126 Index: /usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
127 ===================================================================
128 --- .orig/usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
129 +++ /usr/palm/applications/com.palm.app.calendar/app/views/reminder/reminder-scene.html
130 @@ -5,6 +5,15 @@
131                 </div>
132                 <div id="reminder-event"  class="palm-dashboard-text-container"></div>
133         </div>
134 +       <div class="palm-dashboard-text-container">
135 +               <div class="palm-row" x-mojo-tap-highlight="momentary">
136 +                       <div class="palm-row-wrapper">
137 +                               <div id="myscroller" class="snoozeScroller" x-mojo-element="Scroller">
138 +                                       <div id="snoozeSelector" class="dashboard-event-snooze-duration" x-mojo-element="ListSelector"></div>
139 +                               </div>
140 +                       </div>
141 +               </div>
142 +       </div>
143         <div id="reminder-email" class="reminder-button-contact" style="display:none" x-mojo-loc="">Contact meeting attendees</div>
144         <div id="reminder-dismiss" class="reminder-button-dismiss" x-mojo-loc="">Dismiss</div>
145         <div id="reminder-snooze" class="reminder-button-snooze" x-mojo-loc="">Snooze</div>
146 Index: /usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
147 ===================================================================
148 --- .orig/usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
149 +++ /usr/palm/applications/com.palm.app.calendar/stylesheets/notification.css
150 @@ -2,6 +2,10 @@
151   * Copyright 2008 Palm Inc. Confidential until public release.
152   */
153  
154 +/*@import url(global.css);*/
155 +/*Note the version needs to be updated to match the latest mojo framework on your device.*/
156 +@import url(/usr/palm/frameworks/mojo/submissions/200.18/stylesheets/global.css);
157 +
158  /* event popup notifications */
159  
160  .notification-panel    {
161 @@ -215,4 +219,29 @@ div#remindersScroller {
162         width: 320px;
163  }
164  
165 +//added to support snooze duration
166 +.dashboard-event-snooze-duration {
167 +       width: 320px;
168 +       margin-left: -15px;
169 +}
170 +               
171 +.dashboard-event-snooze-duration .label{
172 +       font-size: 12px;
173 +}
174  
175 +.dashboard-event-snooze-duration .title{
176 +       font-size: 16px;
177 +}
178 +       
179 +.dashboard-event-snooze-duration .palm-popup-content .title {
180 +       font-size: 8px;
181 +}
182 +
183 +.snoozeScroller {
184 +       margin-left: auto;
185 +       margin-right: auto;
186 +       width: 320px;
187 +       height: 335px;
188 +       border-style: none;
189 +       border-width: 0;
190 +}