updates
[webos-internals:djcin7s-modifications.git] / system / system-devicemenu-maxed-out-ultra.patch
1 diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
2 index 335a73c..683eaf1 100644
3 --- a/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
4 +++ b/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
5 @@ -36,12 +36,19 @@ var DevicemenuAssistant = Class.create({
6                 this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '}) +  Mojo.Format.formatDate(date,{date:'long'});
7                 var msg = $L("Battery: #{batlevel}");
8                 this.controller.get('dm_battery').innerHTML = new Template(msg).evaluate({"batlevel": Mojo.Format.formatPercent(this.barAssistant.getBatteryLevel())});
9 -                                               
10 +               this.controller.setupWidget('brightSlider', {minValue: 1, maxValue: 100}, this.brightModel = { value: 50});
11 +               this.controller.setupWidget('mvolSlider', {minValue: 0, maxValue: 100}, this.mvolModel = { value: 50});
12 +               this.controller.setupWidget('svolSlider', {minValue: 0, maxValue: 100}, this.svolModel = { value: 50});         
13 +               
14                 this.modesModel = {scrollbars: false, mode: "vertical"},
15                 this.controller.setupWidget('devicescroller', {}, this.modesModel);
16                 this.menuscroller = this.controller.get('devicescroller');
17                 
18                 this.drawerModel = {myOpenProperty:false};
19 +               this.controller.setupWidget('brightdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
20 +               this.controller.setupWidget('mvoldetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
21 +               this.controller.setupWidget('svoldetails', {modelProperty:'myOpenProperty'}, this.drawerModel);         
22 +               this.controller.setupWidget('phonedetails', {modelProperty:'myOpenProperty'}, this.drawerModel);                
23                 this.controller.setupWidget('wifidetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
24                 this.controller.setupWidget('btdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
25                 this.wifidrawer = this.controller.get('wifidetails');
26 @@ -112,6 +119,12 @@ var DevicemenuAssistant = Class.create({
27                         this.controller.hideWidgetContainer(this.controller.get('dm_wifi'));
28                 }
29                 
30 +               //setup battery temperature label
31 +               var battery = this.controller.get("dm_battery");
32 +               battery.id = "batteryRow";
33 +               battery.innerHTML = '<span id="dm_battery">' + battery.innerHTML + '</span>' +
34 +                               '<div class="label right" id="tempmsg" style="font-size:0.9em;">&nbsp;</div>';
35 +                               
36                 //set up the the menu div
37                 this.scrim = this.controller.sceneElement.querySelector('div[x-mojo-scrim]');
38                 this.systemmenu = this.controller.sceneElement.querySelector('div[x-mojo-dialog]');
39 @@ -122,6 +135,18 @@ var DevicemenuAssistant = Class.create({
40         
41         activate: function() {
42                 this.controller.get('dm_airplanemode').addEventListener(Mojo.Event.tap, this.toggleAirplaneMode.bindAsEventListener(this));
43 +               this.controller.get('brightSlider').addEventListener(Mojo.Event.propertyChange, this.handleBrightSlider.bindAsEventListener(this));
44 +               this.controller.get('brightRow').addEventListener(Mojo.Event.tap, this.handleBrightTap.bindAsEventListener(this));
45 +               this.controller.get('mvolSlider').addEventListener(Mojo.Event.propertyChange, this.handleMvolSlider.bindAsEventListener(this));
46 +               this.controller.get('mvolRow').addEventListener(Mojo.Event.tap, this.handleMvolTap.bindAsEventListener(this));
47 +               this.controller.get('svolSlider').addEventListener(Mojo.Event.propertyChange, this.handleSvolSlider.bindAsEventListener(this));
48 +               this.controller.get('svolRow').addEventListener(Mojo.Event.tap, this.handleSvolTap.bindAsEventListener(this));          
49 +               this.controller.get('phoneRow').addEventListener(Mojo.Event.tap, this.handlePhoneTap.bindAsEventListener(this));
50 +               this.controller.get('phone_radio').addEventListener(Mojo.Event.tap, this.togglePhone.bindAsEventListener(this));
51 +               this.controller.get('phone_data').addEventListener(Mojo.Event.tap, this.toggleData.bindAsEventListener(this));
52 +               this.controller.get('phone_roam').addEventListener(Mojo.Event.tap, this.toggleRoam.bindAsEventListener(this));
53 +               this.controller.get('dm_gps').addEventListener(Mojo.Event.tap, this.toggleGPS.bindAsEventListener(this));
54 +               this.controller.get('dm_flash').addEventListener(Mojo.Event.tap, this.toggleFlash.bindAsEventListener(this));           
55                 this.controller.get('wifilist').addEventListener(Mojo.Event.listTap,this.handleWiFiTap.bindAsEventListener(this));
56                 this.controller.get('btlist').addEventListener(Mojo.Event.listTap,this.handleBTTap.bindAsEventListener(this));          
57                 this.controller.get('dm_wifi').addEventListener(Mojo.Event.tap, this.togglewifiList.bindAsEventListener(this));
58 @@ -137,7 +162,167 @@ var DevicemenuAssistant = Class.create({
59                 
60         cleanup: function() {
61                 Mojo.Log.error("Device Menu - Clean up called");                                
62 +       },
63 +       
64 +       handleBrightTap: function(event) {
65 +               this.controller.get('brightdetails').mojo.setOpenState(!this.controller.get('brightdetails').mojo.getOpenState());
66 +       },
67 +
68 +       handleBrightSlider: function(event) {
69 +               this.controller.serviceRequest('palm://com.palm.display/control', {
70 +                       method: 'setProperty',
71 +                       parameters:{maximumBrightness:Math.round(event.value)}
72 +               });
73 +               this.controller.get('dm_brightness').innerText = "Brightness: " + Math.round(event.value) + "%";
74 +       },
75 +       
76 +       handleMvolTap: function(event) {
77 +               this.controller.get('mvoldetails').mojo.setOpenState(!this.controller.get('mvoldetails').mojo.getOpenState());
78 +       },
79 +       
80 +       handleMvolSlider: function(event) {
81 +               this.controller.serviceRequest('palm://com.palm.audio/media', {
82 +                       method: 'setVolume',
83 +                       parameters:{volume:Math.round(event.value)}
84 +               });
85 +               this.controller.get('dm_mvol').innerText = "Media Volume = " + Math.round(event.value);
86 +       },
87 +
88 +       handleSvolTap: function(event) {
89 +               this.controller.get('svoldetails').mojo.setOpenState(!this.controller.get('svoldetails').mojo.getOpenState());
90 +       },
91 +       
92 +       handleSvolSlider: function(event) {
93 +               this.controller.serviceRequest('palm://com.palm.audio/system', {
94 +                       method: 'setVolume',
95 +                       parameters:{volume:Math.round(event.value)}
96 +               });
97 +               this.controller.get('dm_svol').innerText = "System Volume = " + Math.round(event.value);
98         },      
99 +       
100 +       handlePhoneTap: function(event) {
101 +               this.controller.get('phonedetails').mojo.setOpenState(!this.controller.get('phonedetails').mojo.getOpenState());
102 +       },
103 +       
104 +       togglePhone: function(event) {
105 +               if(this.phoneState=="on") {
106 +                       this.phoneState = "off";
107 +               } else {
108 +                       this.phoneState = "on";
109 +               }
110 +               this.controller.serviceRequest('palm://com.palm.telephony', {
111 +                       method: 'powerSet',
112 +                       parameters: {
113 +                               state: this.phoneState
114 +                       }
115 +               });
116 +               this.setPhoneLabel();
117 +       },
118 +
119 +       setPhoneLabel: function() {
120 +               this.controller.get('phoneStatus').innerText = this.phoneState;
121 +       },
122 +       
123 +       toggleData: function(event) {
124 +               if(this.phoneState=="on") {
125 +                       if(this.dataDisabled=="on") {
126 +                               this.dataDisabled = "off";
127 +                       } else {
128 +                               this.dataDisabled = "on";
129 +                       }
130 +                       this.controller.serviceRequest('palm://com.palm.wan', {
131 +                               method: 'set',
132 +                               parameters: {
133 +                                       disablewan: this.dataDisabled
134 +                               }
135 +                       });
136 +                       this.setDataLabel();
137 +               } else {
138 +                       Mojo.Controller.errorDialog("Error: Phone radio needs to be on and "
139 +                                       + "connected for this function");
140 +               }
141 +       },
142 +
143 +       setDataLabel: function() {
144 +               if(this.dataDisabled=="off") {
145 +                       this.controller.get('dataStatus').innerText = "on";
146 +               } else {
147 +                       this.controller.get('dataStatus').innerText = "off";
148 +               }
149 +       },
150 +       
151 +       toggleRoam: function(event) {
152 +               if(this.phoneState=="on") {
153 +                       if(this.roamStatus=="roamonly") {
154 +                               this.roamStatus="any";
155 +                       } else {
156 +                               this.roamStatus="roamonly";
157 +                       }
158 +                       this.controller.serviceRequest('palm://com.palm.telephony', {
159 +                               method: 'roamModeSet',
160 +                               parameters: {
161 +                                       mode: this.roamStatus,
162 +                                       client: Mojo.appName
163 +                               }
164 +                       });
165 +                       this.setRoamLabel();
166 +               } else {
167 +                       Mojo.Controller.errorDialog("Error: Phone radio needs to be on and "
168 +                                       + "connected for this function");
169 +               }
170 +       },
171 +
172 +       setRoamLabel: function() {
173 +               if(this.roamStatus=="roamonly") {
174 +                       this.controller.get('roamStatus').innerText = "on";
175 +               } else {
176 +                       this.controller.get('roamStatus').innerText = "off";
177 +               }
178 +       },
179 +       
180 +       toggleGPS: function(event) {
181 +               this.gpsEnabled = !this.gpsEnabled;
182 +               this.controller.serviceRequest('palm://com.palm.location', {
183 +                       method: 'setUseGps',
184 +                       parameters: {
185 +                               useGps: this.gpsEnabled
186 +                       }
187 +               });
188 +               this.setGPSLabel();
189 +       },
190 +
191 +       setGPSLabel: function() {
192 +               if(this.gpsEnabled) {
193 +                       this.controller.get('gpsStatus').innerText = "On";
194 +               } else {
195 +                       this.controller.get('gpsStatus').innerText = "Off";
196 +               }
197 +       },
198 +       
199 +       toggleFlash: function() {
200 +               if(this.flashVal==0) {
201 +                       this.flashVal = 100;
202 +               } else {
203 +                       this.flashVal = 0;
204 +               }
205 +               this.controller.serviceRequest('palm://ca.canucksoftware.systoolsmgr', {
206 +                       method: 'flashOn',
207 +                       parameters: {
208 +                               value: this.flashVal
209 +                       },
210 +                       onSuccess: function() {
211 +                               this.setFlashLabel();
212 +                       }.bind(this)
213 +               });
214 +       },
215 +       
216 +       setFlashLabel: function() {
217 +               if(this.flashVal==0) {
218 +                       this.controller.get('flashStatus').innerText = "Off";
219 +               } else {
220 +                       this.controller.get('flashStatus').innerText = "On";
221 +               }
222 +       },
223                         
224         wifiAPList: [],
225         btdeviceList: [],
226 @@ -1027,7 +1212,11 @@ var DevicemenuAssistant = Class.create({
227                         this.clearWiFiList();
228                         this.controller.hideWidgetContainer(this.controller.get('wifidetails'));
229                         this.wifidrawer.mojo.setOpenState(false);
230 -               }               
231 +               }
232 +               this.controller.get('brightdetails').mojo.setOpenState(false);
233 +               this.controller.get('mvoldetails').mojo.setOpenState(false);
234 +               this.controller.get('svoldetails').mojo.setOpenState(false);            
235 +               this.controller.get('phonedetails').mojo.setOpenState(false);           
236                 //this.isVisible = false;
237                 if(this.isVisible){
238                         this.toggleDeviceMenu();
239 @@ -1073,11 +1262,123 @@ var DevicemenuAssistant = Class.create({
240                         this.isVisible = true;
241                         var date = new Date();          
242                         this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '})  +  Mojo.Format.formatDate(date,{date:'long'});
243 +                       this.controller.serviceRequest('palm://com.palm.display/control', {
244 +                               method: 'getProperty',
245 +                               parameters:{properties:['maximumBrightness']},
246 +                               onSuccess: function(response) {
247 +                                       if(response.maximumBrightness != undefined) {
248 +                                               this.brightModel.value = parseInt(response.maximumBrightness);
249 +                                               this.controller.modelChanged(this.brightModel);
250 +                                               this.controller.get('dm_brightness').innerText = "Brightness: " + response.maximumBrightness + "%";
251 +                                       } else {
252 +                                               this.controller.get('dm_brightness').innerText = "Brightness: ??%";
253 +                                       }
254 +                               }.bind(this)
255 +                       });
256 +                       this.controller.serviceRequest('palm://com.palm.audio/media', {
257 +                               method: 'getVolume',
258 +                               parameters:{},
259 +                               onSuccess: function(response) {
260 +                                       if(response.volume != undefined) {
261 +                                               this.mvolModel.value = parseInt(response.volume);
262 +                                               this.controller.modelChanged(this.mvolModel);
263 +                                               this.controller.get('dm_mvol').innerText = "Media Volume = " + response.volume;
264 +                                       } else {
265 +                                               this.controller.get('dm_mvol').innerText = "Media Volume = unknown";
266 +                                       }
267 +                               }.bind(this)
268 +                       });
269 +                       this.controller.serviceRequest('palm://com.palm.audio/system', {
270 +                               method: 'getVolume',
271 +                               parameters:{},
272 +                               onSuccess: function(response) {
273 +                                       if(response.volume != undefined) {
274 +                                               this.svolModel.value = parseInt(response.volume);
275 +                                               this.controller.modelChanged(this.svolModel);
276 +                                               this.controller.get('dm_svol').innerText = "System Volume = " + response.volume;
277 +                                       } else {
278 +                                               this.controller.get('dm_svol').innerText = "System Volume = unknown";
279 +                                       }
280 +                               }.bind(this)
281 +                       });                     
282 +                       this.controller.serviceRequest('palm://com.palm.telephony', {
283 +                               method: 'powerQuery',
284 +                               parameters: {},
285 +                               onSuccess: function(response) {
286 +                                       this.phoneState = response.extended.powerState;
287 +                                       this.setPhoneLabel();
288 +                               }.bind(this)
289 +                       });                     
290 +                       this.controller.serviceRequest('palm://com.palm.connectionmanager', {
291 +                               method: 'getstatus',
292 +                               parameters: {},
293 +                               onSuccess: function(response) {
294 +                                       if(response.wan.state === "disconnected") {
295 +                                               this.dataDisabled = "on";
296 +                                       } else if(response.wan.state === "connected") {
297 +                                               this.dataDisabled = "off";
298 +                                       }
299 +                                       this.setDataLabel();
300 +                               }.bind(this)
301 +                       });
302 +                       this.controller.serviceRequest('palm://com.palm.telephony', {
303 +                               method: 'roamModeQuery',
304 +                               parameters: {},
305 +                               onSuccess: function(response) {
306 +                                       this.roamStatus = response.extended.mode;
307 +                                       this.setRoamLabel();
308 +                               }.bind(this)
309 +                       });
310 +                       this.controller.serviceRequest('palm://com.palm.location', {
311 +                               method: 'getUseGps',
312 +                               parameters: {},
313 +                               onSuccess: function(response) {
314 +                                       this.gpsEnabled = response.useGps;
315 +                                       this.setGPSLabel();
316 +                               }.bind(this)
317 +                       });
318 +                       this.flashVal = 0;
319 +                       this.controller.serviceRequest('palm://ca.canucksoftware.systoolsmgr', {
320 +                               method: 'flashState',
321 +                               parameters: {},
322 +                               onSuccess: function(response) {
323 +                                       this.flashVal = response.value;
324 +                                       this.setFlashLabel();
325 +                               }.bind(this),
326 +                               onFailure: function(err) {
327 +                                       this.controller.get('flashStatus').innerText = "Error";
328 +                               }.bind(this)
329 +                       });                     
330                         
331                         if(this.turningOnBtRadio) {
332                                 this.btspinnerModel.spinning = true;
333                                 this.controller.modelChanged(this.btspinnerModel);
334                         }
335 +                       this.controller.serviceRequest('palm://ca.canucksoftware.systoolsmgr', {
336 +                               method: 'cpuTemperature',
337 +                               onSuccess: function(payload) {
338 +                                       if(payload.value) {
339 +                                               this.controller.get("tempmsg").innerHTML = payload.value + "&deg;C";
340 +                                       }
341 +                               }.bind(this),
342 +                               onFailure: function(err) {
343 +                                       this.controller.serviceRequest('palm://com.palm.bus/signal/', {
344 +                                               method: 'addmatch',
345 +                                               parameters: {
346 +                                                       "category":"/com/palm/power",
347 +                                                       "method":"batteryStatus"
348 +                                               },
349 +                                               onSuccess: function(payload2) {
350 +                                                       if(payload2.temperature_C) {
351 +                                                               this.controller.get("tempmsg").innerHTML = payload2.temperature_C + "&deg;C";
352 +                                                       }
353 +                                               }.bind(this)
354 +                                       });
355 +                                       this.controller.serviceRequest('palm://com.palm.power/com/palm/power/', {
356 +                                               method: 'batteryStatusQuery'
357 +                                       });
358 +                               }.bind(this)
359 +                       });                     
360                         this.controller.stageController.activate();
361                         
362                         var animateDialog = function(){
363 diff --git a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
364 index d153a8d..21118ca 100644
365 --- a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
366 +++ b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
367 @@ -15,19 +15,77 @@
368                         <div class="palm-list">          
369                                 
370                                 <div class="palm-row first"><div class="palm-row-wrapper">
371 -                                       <div id="dm_date" class="title dim"></div>
372 +                                       <div id="dm_date" class="title"></div>
373                                 </div></div>
374                                 
375                                 <div class="palm-section-divider">
376                                 </div> 
377                                 
378                                 <div class="palm-row"><div class="palm-row-wrapper">
379 -                                       <div id="dm_battery" class="title dim"></div>
380 +                                       <div id="dm_battery" class="title"></div>
381                                 </div></div> 
382 -                               
383 +
384 +                               <div class="palm-row first" id="brightRow" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
385 +                                       <div id="dm_brightness" class="title">&nbsp;
386 +                                       </div>
387 +                               </div></div>
388 +
389 +                               <div id="brightdetails" x-mojo-element="Drawer">
390 +                                       <div class="palm-row first"><div class="palm-row-wrapper">
391 +                                               <div x-mojo-element="Slider" id="brightSlider" style="padding-top: 30px; height: 50px;"></div>
392 +                                       </div></div>
393 +                               </div>
394 +
395                                 <div class="palm-section-divider">
396 -                               </div>               
397 +                               </div> 
398 +
399 +                               <div class="palm-row first" id="mvolRow" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
400 +                                       <div id="dm_mvol" class="title">&nbsp;
401 +                                       </div>
402 +                               </div></div>
403 +
404 +                               <div id="mvoldetails" x-mojo-element="Drawer">
405 +                                       <div class="palm-row first"><div class="palm-row-wrapper">
406 +                                               <div x-mojo-element="Slider" id="mvolSlider" style="padding-top: 30px; height: 50px;"></div>
407 +                                       </div></div>
408 +                               </div>                          
409                                 
410 +                               <div class="palm-section-divider">
411 +                               </div>  
412 +
413 +                               <div class="palm-row first" id="svolRow" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
414 +                                       <div id="dm_svol" class="title">&nbsp;
415 +                                       </div>
416 +                               </div></div>
417 +
418 +                               <div id="svoldetails" x-mojo-element="Drawer">
419 +                                       <div class="palm-row first"><div class="palm-row-wrapper">
420 +                                               <div x-mojo-element="Slider" id="svolSlider" style="padding-top: 30px; height: 50px;"></div>
421 +                                       </div></div>
422 +                               </div>
423 +
424 +                               <div class="palm-section-divider">
425 +                               </div>                  
426 +
427 +                               <div class="palm-row first" id="phoneRow" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
428 +                                       <div id="dm_phone" class="title">Phone</div>
429 +                               </div></div>
430 +
431 +                               <div id="phonedetails" x-mojo-element="Drawer">
432 +                                       <div class="palm-row first" id="phone_radio" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
433 +                                               <div id="phoneStatus" class="label right">&nbsp;</div>
434 +                                               <div class="title">Phone Radio</div>
435 +                                       </div></div>
436 +                                       <div class="palm-row" id="phone_data" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
437 +                                               <div id="dataStatus" class="label right">&nbsp;</div>
438 +                                               <div class="title">Data Usage</div>
439 +                                       </div></div>
440 +                                       <div class="palm-row last" id="phone_roam" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
441 +                                               <div id="roamStatus" class="label right">&nbsp;</div>
442 +                                               <div class="title">Roam Only</div>
443 +                                       </div></div>
444 +                               </div>  
445 +                       
446                                 <div class="palm-row" id="dm_wifi" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
447                                         <div class="title truncating-text">
448                                                 <div class="label right" id="wifimsg">&nbsp;</div>                               
449 @@ -92,10 +150,21 @@
450                                                         <span x-mojo-loc=''>Bluetooth Preferences</span>
451                                                 </div>
452                                         </div></div>
453 -                                       
454 -                               </div>  
455 -                               
456 -                               <div class="palm-section-divider"></div>
457 +                                </div> 
458 +                                <div class="palm-section-divider"></div>
459 +                                
460 +                                 <div class="palm-row" id="dm_gps" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
461 +                                       <div class="title truncating-text">
462 +                                               <div class="label right" id="gpsStatus">&nbsp;</div>
463 +                                               <span x-mojo-loc=''>GPS</span>
464 +                                       </div>
465 +                               </div></div>
466 +                               <div class="palm-row last menu-end" id="dm_flash"><div class="palm-row-wrapper">
467 +                                       <div class="title truncating-text">
468 +                                               <div class="label right" id="flashStatus">&nbsp;</div>
469 +                                               <span x-mojo-loc=''>Flashlight</span>
470 +                                       </div>
471 +                               </div></div>                             
472                                 
473                                 <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
474                                         <div id="dm_airplanemode_status" class="title truncating-text">