Added verizon versions of system menu patches
[webos-internals:imagineer1981s-modifications.git] / advanced / advanced-system-menus-device-menu-vzw.patch
1 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
2 +++ /usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
3 @@ -1,6 +1,10 @@
4  /* Copyright 2009 Palm, Inc.  All rights reserved. */
5  
6 -var RadioState = new Hash({wifi: undefined, bluetooth: undefined});
7 +var ConnState = new Hash({phone: undefined, data: undefined});
8 +
9 +var RoamState = new Hash({phone: undefined, data: undefined});
10 +
11 +var RadioState = new Hash({wifi: undefined, bluetooth: undefined, gps: undefined});
12  
13  var DevicemenuAssistant = Foundations.Class.create({
14         
15 @@ -21,6 +25,27 @@
16                 this.btProfileStatus = btProfileStatus; 
17                 this.turningOnBtRadio = false;
18                 this._stageRef = 0;
19 +               
20 +               this.isVisible = true;
21 +               this.noClosing = false;
22 +               this.isEditing = false;
23 +               
24 +               this.prevDrawer = null;
25 +               
26 +               this.editItems = new Array();
27 +               
28 +               this.volumeSlider = "ringtone";
29 +               
30 +               this.quickAction = "LED Flashlight";
31 +               this.hiddenItems = new Array("Device", "Security", "Network", "Phone", "Data", "VPN");
32 +               
33 +               this.menus = ["Device", "Security", "Network", "Phone", "Data", "Wi-Fi", "Bluetooth", "GPS", "VPN"];
34 +               
35 +               this.item_ids = ["dm_device", "dm_security", "dm_network", "dm_phone", "dm_data", "dm_wifi", 
36 +                       "dm_bluetooth", "dm_gps", "dm_vpn"];
37 +               
38 +               this.menuActions = ["LED Flashlight", "Phone Connection", "Voice Roaming", "Data Connection", 
39 +                       "Data Roaming", "Wi-Fi Connection", "BT Connection", "GPS Connection", "Airplane Mode"];
40         },
41         
42         setup: function() {
43 @@ -28,20 +53,50 @@
44                 //Add a touchable row class
45                 this.controller.get('palm-device-menu').addClassName('palm-touch-rows-'+Mojo.Environment.DeviceInfo.touchableRows);
46                         
47 -               var date = new Date();
48 +/*             var date = new Date();
49                 this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '}) +  Mojo.Format.formatDate(date,{date:'long'});
50                 var msg = $L("Battery: #{batlevel}");
51 -               this.controller.get('dm_battery').innerHTML = new Template(msg).evaluate({"batlevel": Mojo.Format.formatPercent(this.barAssistant.getBatteryLevel())});
52 +               this.controller.get('dm_battery').innerHTML = new Template(msg).evaluate({"batlevel": Mojo.Format.formatPercent(this.barAssistant.getBatteryLevel())}); */
53                                                 
54                 this.modesModel = {scrollbars: false, mode: "vertical"},
55                 this.controller.setupWidget('devicescroller', {}, this.modesModel);
56                 this.menuscroller = this.controller.get('devicescroller');
57                 
58 +               this.modelFlashlight = {value: false, disabled: false};
59 +               
60 +               this.controller.setupWidget("flashlight_toggle", {falseValue: false, trueValue: true}, this.modelFlashlight);
61 +               
62 +               this.modelBrightness = {value: 50};
63 +               
64 +               this.controller.setupWidget('brightness_slider', {minValue: 0, maxValue: 100}, this.modelBrightness);
65 +               
66 +               this.modelVolume = {value: 50};
67 +               
68 +               this.controller.setupWidget('volume_slider', {minValue: 0, maxValue: 100}, this.modelVolume);
69 +               
70 +               this.modelEditItems = {'items': this.editItems};
71 +               
72 +               this.controller.setupWidget('edit_items', 
73 +                       {itemTemplate:'devicemenu/listitem-edit'}, 
74 +                       this.modelEditItems);
75 +               
76                 this.drawerModel = {myOpenProperty:false};
77 +               this.controller.setupWidget('devicedetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
78 +               this.controller.setupWidget('securitydetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
79 +               this.controller.setupWidget('networkdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
80 +               this.controller.setupWidget('phonedetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
81 +               this.controller.setupWidget('datadetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
82 +               this.controller.setupWidget('gpsdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
83                 this.controller.setupWidget('imedetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
84                 this.controller.setupWidget('wifidetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
85                 this.controller.setupWidget('btdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
86                 this.controller.setupWidget('vpndetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
87 +               this.devicedrawer = this.controller.get('devicedetails');
88 +               this.securitydrawer = this.controller.get('securitydetails');
89 +               this.networkdrawer = this.controller.get('networkdetails');
90 +               this.phonedrawer = this.controller.get('phonedetails');
91 +               this.datadrawer = this.controller.get('datadetails');
92 +               this.gpsdrawer = this.controller.get('gpsdetails');
93                 this.imedrawer = this.controller.get('imedetails');
94                 this.wifidrawer = this.controller.get('wifidetails');
95                 this.btdrawer = this.controller.get('btdetails');
96 @@ -91,7 +146,7 @@
97                 //Spinner for BT
98                 this.controller.setupWidget('btSpinner', this.spinnerAttrs, this.btspinnerModel);
99                         
100 -               if(this.barAssistant.getAirplaneMode())                         
101 +/*             if(this.barAssistant.getAirplaneMode())                         
102                         this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn off Airplane Mode');
103                 else
104                         this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn on Airplane Mode');
105 @@ -122,7 +177,7 @@
106                         else
107                                 this.controller.get('wifimsg').innerHTML = wifistate.escapeHTML();                      
108                 }               
109 -               this.isVisible = true;
110 +               this.isVisible = true; */
111                 
112                 //Hide WiFi Menu if WiFi is not present.
113                 if(!Mojo.Environment.DeviceInfo.wifiAvailable) {
114 @@ -147,10 +202,56 @@
115                                 setText: this.altCharSelected.bind(this)
116                         };
117                 }
118 +
119 +               this.controller.listen(this.controller.document, Mojo.Event.deactivate, this.close.bindAsEventListener(this));
120 +               
121 +               // Load preferences for the menu
122 +
123 +               this.cookieContainer = new Mojo.Model.Cookie("deviceMenu");
124 +               
125 +               var cookie = this.cookieContainer.get();
126 +
127 +               if(cookie) {
128 +                       this.hiddenItems = cookie.hiddenItems;
129 +                       this.quickAction = cookie.quickAction;
130 +                       this.volumeSlider = cookie.volumeSlider;
131 +               }
132         },
133         
134         activate: function() {
135 -               this.controller.get('dm_airplanemode').addEventListener(Mojo.Event.tap, this.toggleAirplaneMode.bind(this));
136 +               this.controller.get('menu_action').addEventListener(Mojo.Event.tap, this.handleActionTap.bindAsEventListener(this));
137 +               this.controller.get('edit_items').addEventListener(Mojo.Event.listTap, this.handleItemTap.bindAsEventListener(this));
138 +               
139 +               this.controller.get('dm_device').addEventListener(Mojo.Event.tap, this.toggleDeviceList.bindAsEventListener(this));
140 +               this.controller.get('volume_toggle').addEventListener(Mojo.Event.tap, this.handleVolumeToggle.bindAsEventListener(this));                                               
141 +               this.controller.get('flashlight_toggle').addEventListener(Mojo.Event.propertyChange, this.handleFlashlightToggle.bindAsEventListener(this));
142 +               this.controller.get('brightness_slider').addEventListener(Mojo.Event.propertyChange, this.handleBrightnessSlider.bindAsEventListener(this));
143 +               this.controller.get('volume_slider').addEventListener(Mojo.Event.propertyChange, this.handleVolumeSlider.bindAsEventListener(this));
144 +               
145 +               this.controller.get('dm_security').addEventListener(Mojo.Event.tap, this.toggleSecurityList.bindAsEventListener(this));
146 +               this.controller.get('security_none').addEventListener(Mojo.Event.tap, this.changeSecurityState.bindAsEventListener(this));
147 +               this.controller.get('security_pin').addEventListener(Mojo.Event.tap, this.changeSecurityState.bindAsEventListener(this));
148 +               this.controller.get('security_pw').addEventListener(Mojo.Event.tap, this.changeSecurityState.bindAsEventListener(this));
149 +               
150 +               this.controller.get('dm_network').addEventListener(Mojo.Event.tap, this.toggleNetworkList.bindAsEventListener(this));
151 +               this.controller.get('network_2g').addEventListener(Mojo.Event.tap, this.changeNetworkState.bindAsEventListener(this));
152 +               this.controller.get('network_3g').addEventListener(Mojo.Event.tap, this.changeNetworkState.bindAsEventListener(this));
153 +               this.controller.get('network_auto').addEventListener(Mojo.Event.tap, this.changeNetworkState.bindAsEventListener(this));
154 +               
155 +               this.controller.get('dm_phone').addEventListener(Mojo.Event.tap, this.togglePhoneList.bindAsEventListener(this));
156 +               this.controller.get('phone_conn').addEventListener(Mojo.Event.tap, this.togglePhoneConn.bindAsEventListener(this));
157 +               this.controller.get('phone_roam').addEventListener(Mojo.Event.tap, this.togglePhoneRoam.bindAsEventListener(this));
158 +               this.controller.get('phone_pref').addEventListener(Mojo.Event.tap,this.handlePhoneLaunch.bindAsEventListener(this));
159 +               
160 +               this.controller.get('dm_data').addEventListener(Mojo.Event.tap, this.toggleDataList.bindAsEventListener(this));
161 +               this.controller.get('data_conn').addEventListener(Mojo.Event.tap, this.toggleDataConn.bindAsEventListener(this));
162 +               this.controller.get('data_roam').addEventListener(Mojo.Event.tap, this.toggleDataRoam.bindAsEventListener(this));
163 +               this.controller.get('data_pref').addEventListener(Mojo.Event.tap,this.handlePhoneLaunch.bindAsEventListener(this));
164 +               
165 +               this.controller.get('dm_gps').addEventListener(Mojo.Event.tap, this.toggleGpsList.bindAsEventListener(this));
166 +               this.controller.get('gps_radio').addEventListener(Mojo.Event.tap, this.toggleGpsRadio.bindAsEventListener(this));
167 +               this.controller.get('gps_pref').addEventListener(Mojo.Event.tap,this.handleGpsLaunch.bindAsEventListener(this));
168 +               
169                 this.controller.get('wifilist').addEventListener(Mojo.Event.listTap,this.handleWiFiTap.bind(this));
170                 this.controller.get('btlist').addEventListener(Mojo.Event.listTap,this.handleBTTap.bind(this));
171                 this.controller.get('vpnlist').addEventListener(Mojo.Event.listTap,this.handleVPNTap.bind(this));               
172 @@ -188,64 +289,934 @@
173          * The Airplan Mode setting gets stored in the System Preferences.
174          */      
175         
176 -       toggleAirplaneMode: function() {
177 +       toggleAirplaneMode: function(event) {
178                 
179                 //Ignore the tap event if Airplane Mode is in Progress
180 -               if(this.apModeInProgress)
181 -                       return;
182 +//             if(this.apModeInProgress)
183 +//                     return;
184                 
185                 //this.apSpinnerModel.spinning = true;
186                 //this.controller.modelChanged(this.apSpinnerModel);    
187                                 
188                 if(this.barAssistant.getAirplaneMode()) {
189                         Mojo.Log.info("SystemUI - Turning off Airplane Mode - Device Menu");
190 +                       if(this.quickAction == "Airplane Mode")
191 +                               this.controller.get('menu_action').innerHTML = $L('Turning off Airplane Mode');                 
192                         this.barAssistant.setAirplaneMode(false);
193 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turning off Airplane Mode');                      
194                 }                       
195                 else {
196                         Mojo.Log.info("SystemUI - Turning on Airplane Mode - Device Menu");
197 +                       if(this.quickAction == "Airplane Mode")
198 +                               this.controller.get('menu_action').innerHTML = $L('Turning on Airplane Mode');
199                         this.barAssistant.setAirplaneMode(true);
200 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turning on Airplane Mode');
201                 }
202 -               this.apModeInProgress = true;
203 -               this.toggleDeviceMenu.delay(0.2);               
204 +//             this.apModeInProgress = true;
205 +
206 +               if((!event.up) || (!event.up.altKey && !event.up.metaKey))
207 +                       this.toggleDeviceMenu.delay(0.2);               
208         },
209 -       
210
211         updateAirplaneModeSettings: function() {
212 +
213 +               if(this.quickAction != "Airplane Mode")
214 +                       return;
215                 
216                 //this.apSpinnerModel.spinning = false;
217                 //this.controller.modelChanged(this.apSpinnerModel);
218                 
219                 if(this.barAssistant.getAirplaneMode()) {
220 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn off Airplane Mode');                 
221 +                       this.controller.get('menu_action').innerHTML = $L('Turn off Airplane Mode');                    
222                 }                       
223                 else {                  
224 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn on Airplane Mode');
225 +                       this.controller.get('menu_action').innerHTML = $L('Turn on Airplane Mode');
226                 }
227 -               this.apModeInProgress = false;
228 +//             this.apModeInProgress = false;
229         },
230         
231         updateAirplaneModeProgress: function() {
232 +               if(this.quickAction != "Airplane Mode")
233 +                       return;
234 +
235                 if(this.barAssistant.getAirplaneMode()) {
236 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turning on Airplane Mode');
237 +                       this.controller.get('menu_action').innerHTML = $L('Turning on Airplane Mode');
238                 }                       
239                 else {
240 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turning off Airplane Mode');
241 +                       this.controller.get('menu_action').innerHTML = $L('Turning off Airplane Mode');
242 +               }
243 +//             this.apModeInProgress = true;
244 +       }, 
245 +       
246 +       savePreferences: function() {
247 +               this.hiddenItems.clear();
248 +       
249 +               for(var i = 0; i < this.editItems.length ; i++) {
250 +                       if(this.editItems[i].label == "hide")
251 +                               this.hiddenItems.push(this.editItems[i].title);
252 +               }
253 +       
254 +               var cookie = {
255 +                       version: 1,
256 +                       hiddenItems: this.hiddenItems,
257 +                       quickAction: this.quickAction,
258 +                       volumeSlider: this.volumeSlider
259 +               };
260 +
261 +               this.cookieContainer.put(cookie);
262 +       },
263 +       
264 +       handlePreferences: function(payload) {
265 +               if(payload != undefined) {
266 +                       if(payload.deviceMenuCfg != undefined) {
267 +                               this.hiddenItems = payload.deviceMenuCfg.hidden;
268 +                               this.quickAction = payload.deviceMenuCfg.action;
269 +                       }
270 +               }
271 +       },
272 +       
273 +       handleActionTap: function(event) {
274 +               if(this.isEditing) {
275 +                       if((event.up) && ( event.up.altKey || event.up.metaKey))
276 +                               this.menuActions.reverse();
277 +
278 +                       for(var i = 0; i < this.menuActions.length; i++) {
279 +                               if(this.menuActions[i] == this.quickAction) {
280 +                                       if((i+1) < this.menuActions.length)
281 +                                               this.quickAction = this.menuActions[i+1];
282 +                                       else
283 +                                               this.quickAction = this.menuActions[0];
284 +                                               
285 +                                       break;
286 +                               }
287 +                       }
288 +
289 +                       if((event.up) && ( event.up.altKey || event.up.metaKey))
290 +                               this.menuActions.reverse();
291 +                       this.controller.get('menu_action').innerHTML = $L("Toggle " + this.quickAction);
292 +
293 +                       this.savePreferences();
294 +               }
295 +               else {
296 +                       if(this.quickAction == "LED Flashlight")
297 +                               this.toggleFlashlightLed(event);
298 +                       else if(this.quickAction == "Phone Connection")
299 +                               this.togglePhoneConn(event);
300 +                       else if(this.quickAction == "Voice Roaming")
301 +                               this.togglePhoneRoam(event);
302 +                       else if(this.quickAction == "Data Connection")
303 +                               this.toggleDataConn(event);
304 +                       else if(this.quickAction == "Data Roaming") 
305 +                               this.toggleDataRoam(event);
306 +                       else if(this.quickAction == "Wi-Fi Connection") 
307 +                               this.toggleWifiRadio(event);
308 +                       else if(this.quickAction == "BT Connection") 
309 +                               this.toggleBTRadio(event);
310 +                       else if(this.quickAction == "GPS Connection")
311 +                               this.toggleGpsRadio(event);
312 +                       else if(this.quickAction == "Airplane Mode")
313 +                               this.toggleAirplaneMode(event);
314 +               }
315 +       },
316 +       
317 +       handleItemTap: function(event) {
318 +               if(this.isEditing) {
319 +                       var index = this.modelEditItems.items.indexOf(event.item);
320 +                       
321 +                       if(this.modelEditItems.items[index].label == "hide")
322 +                               this.modelEditItems.items[index].label = "show";
323 +                       else
324 +                               this.modelEditItems.items[index].label = "hide";
325 +                       
326 +                       this.controller.modelChanged(this.modelEditItems, this);
327 +                       
328 +                       this.savePreferences();
329 +               }
330 +       },
331 +
332 +       toggleDeviceList: function(event) {     
333 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
334 +                       this.toggleFlashlightLed(event);
335 +               else {
336 +                       if(this.devicedrawer.mojo.getOpenState()) {
337 +                               this.prevDrawer = null;
338 +               
339 +                               this.controller.hideWidgetContainer(this.controller.get('devicedetails'));
340 +                       }
341 +                       else {
342 +                               if(this.prevDrawer)
343 +                                       this.prevDrawer.mojo.setOpenState(false);
344 +               
345 +                               this.prevDrawer = this.devicedrawer;
346 +               
347 +                               this.controller.showWidgetContainer(this.controller.get('devicedetails'));      
348 +                       }
349 +       
350 +                       this.devicedrawer.mojo.setOpenState(!this.devicedrawer.mojo.getOpenState());                                            
351 +               }
352 +       },
353 +       
354 +       toggleFlashlightLed: function(event) {
355 +               if(!this.modelFlashlight.value) {
356 +                       var ledState = "enabled";
357 +                       this.modelFlashlight.value = true;
358 +               }
359 +               else {
360 +                       var ledState = "disabled";              
361 +                       this.modelFlashlight.value = false;
362 +               }
363 +
364 +               this.controller.modelChanged(this.modelFlashlight, this);
365 +
366 +               this.controller.serviceRequest('palm://org.e.lnx.wee.ledctl.service/', {
367 +                       method: 'ledState', parameters: {state: ledState}});
368 +               
369 +               if((!event.up) || (!event.up.altKey && !event.up.metaKey))
370 +                       this.toggleDeviceMenu.bind(this).delay(0.2);
371 +               else {
372 +                       if(this.quickAction == "LED Flashlight") {
373 +                               if(ledState == "disabled")
374 +                                       this.controller.get('menu_action').innerHTML = $L('Turn on LED Flashlight');
375 +                               else
376 +                                       this.controller.get('menu_action').innerHTML = $L('Turn off LED Flashlight');
377 +                       }
378 +               }
379 +       },
380 +       
381 +       handleFlashlightToggle: function(event) {
382 +               // BUG in toggle button widget!
383 +       
384 +               if(this.modelFlashlight.value)
385 +                       var ledState = "enabled";
386 +               else
387 +                       var ledState = "disabled";
388 +
389 +               if(this.quickAction == "LED Flashlight") {
390 +                       if(ledState == "disabled")
391 +                               this.controller.get('menu_action').innerHTML = $L('Turn on LED Flashlight');
392 +                       else
393 +                               this.controller.get('menu_action').innerHTML = $L('Turn off LED Flashlight');
394 +               }
395 +       
396 +               this.controller.serviceRequest('palm://org.e.lnx.wee.ledctl.service/', {
397 +                       method: 'ledState', parameters: {state: ledState}
398 +               });
399 +       },
400 +       
401 +       handleBrightnessSlider: function(event) {
402 +               this.controller.serviceRequest('palm://com.palm.display/control', {
403 +                       method: 'setProperty', parameters:{maximumBrightness: Math.round(event.value)}
404 +               });
405 +               
406 +               this.controller.get('dm_brightness').innerHTML = Math.round(event.value);
407 +       },
408 +       
409 +       handleVolumeSlider: function(event) {
410 +               this.controller.serviceRequest('palm://com.palm.audio/' + this.volumeSlider, {
411 +                       method: 'setVolume', parameters:{volume: Math.round(event.value)}
412 +               });
413 +               
414 +               this.controller.get('dm_volume').innerHTML = Math.round(event.value);
415 +       },
416 +       
417 +       handleVolumeToggle: function(event) {
418 +               if(this.controller.get('volume_toggle').innerHTML == $L("Ringtone Volume"))
419 +                       this.volumeSlider = "system";
420 +               else if(this.controller.get('volume_toggle').innerHTML == $L("System Volume"))
421 +                       this.volumeSlider = "media";
422 +               else
423 +                       this.volumeSlider = "ringtone";
424 +               
425 +               this.updateVolumeState();
426 +       },
427 +       
428 +       updateFlashState: function() {
429 +               if(this.quickAction == "LED Flashlight")
430 +                       this.controller.get('menu_action').innerHTML = $L('Turn on LED Flashlight');
431 +
432 +               this.controller.serviceRequest('palm://org.e.lnx.wee.ledctl.service/', {
433 +                       method: 'ledState',
434 +                       parameters: {},
435 +                       onSuccess: function(response) {
436 +                               if(response.state == "enabled") {
437 +                                       this.modelFlashlight.value = true;
438 +
439 +                                       if(this.quickAction == "LED Flashlight")
440 +                                               this.controller.get('menu_action').innerHTML = $L('Turn off LED Flashlight');
441 +                               }
442 +                               else
443 +                                       this.modelFlashlight.value = false;
444 +
445 +                               this.controller.modelChanged(this.modelFlashlight, this);
446 +                       }.bind(this),
447 +               });
448 +       },
449 +       
450 +       updateScreenState: function() {
451 +               this.controller.serviceRequest('palm://com.palm.display/control', {
452 +                       method: 'getProperty',
453 +                       parameters:{properties:['maximumBrightness']},
454 +                       onSuccess: function(response) {
455 +                               if(response.maximumBrightness != undefined) {
456 +                                       this.modelBrightness.value = parseInt(response.maximumBrightness);
457 +                                       this.controller.modelChanged(this.modelBrightness);
458 +
459 +                                       this.controller.get('dm_brightness').innerHTML = response.maximumBrightness;
460 +                               } else {
461 +                                       this.controller.get('dm_brightness').innerHTML = "??";
462 +                               }
463 +                       }.bind(this)
464 +               });
465 +       },
466 +       
467 +       updateVolumeState: function() {
468 +               if(this.volumeSlider == "ringtone")
469 +                       this.controller.get('volume_toggle').innerHTML = $L("Ringtone Volume");
470 +               else if(this.volumeSlider == "system")
471 +                       this.controller.get('volume_toggle').innerHTML = $L("System Volume");
472 +               else if(this.volumeSlider == "media")
473 +                       this.controller.get('volume_toggle').innerHTML = $L("Media Volume");
474 +
475 +               this.controller.serviceRequest('palm://com.palm.audio/' + this.volumeSlider, {
476 +                       method: 'getVolume',
477 +                       parameters:{},
478 +                       onSuccess: function(response) {
479 +                               if(response.volume != undefined) {
480 +                                       this.modelVolume.value = parseInt(response.volume);
481 +                                       this.controller.modelChanged(this.modelVolume);
482 +       
483 +                                       this.controller.get('dm_volume').innerHTML = response.volume;
484 +                               } else {
485 +                                       this.controller.get('dm_volume').innerHTML = "??";
486 +                               }
487 +                       }.bind(this)
488 +               });
489 +       },
490 +
491 +       toggleSecurityList: function(event) {
492 +               if((event.up) && ( event.up.altKey || event.up.metaKey)) {
493 +                       this.serviceRequest = new Mojo.Service.Request('palm://com.palm.applicationManager', {
494 +                               method: 'open',
495 +                               parameters: {'id': 'com.palm.app.screenlock','params':{mode: "none"}}
496 +                       });
497 +               }
498 +               else {
499 +                       if(this.securitydrawer.mojo.getOpenState()) {
500 +                               this.prevDrawer = null;
501 +               
502 +                               this.controller.hideWidgetContainer(this.controller.get('securitydetails'));
503 +                       }
504 +                       else {
505 +                               if(this.prevDrawer)
506 +                                       this.prevDrawer.mojo.setOpenState(false);
507 +               
508 +                               this.prevDrawer = this.securitydrawer;
509 +               
510 +                               this.controller.showWidgetContainer(this.controller.get('securitydetails'));    
511 +                       }
512 +       
513 +                       this.securitydrawer.mojo.setOpenState(!this.securitydrawer.mojo.getOpenState());                                                
514 +               }
515 +       },
516 +
517 +       changeSecurityState: function(event) {
518 +               if(event.target.id == "security_pin")
519 +                       var security = "pin";
520 +               else if(event.target.id == "security_pw")
521 +                       var security = "password";                      
522 +               else 
523 +                       var security = "none";
524 +               
525 +               this.serviceRequest = new Mojo.Service.Request('palm://com.palm.applicationManager', {
526 +                       method: 'open',
527 +                       parameters: {'id': 'com.palm.app.screenlock','params':{mode: security}}
528 +               });
529 +       },
530 +       
531 +       updateSecurityState: function() {
532 +               this.controller.serviceRequest('palm://com.palm.systemmanager/', {
533 +                       method: "getDeviceLockMode", 
534 +                       onComplete: function(response) {
535 +                               if(response && response.lockMode) {
536 +                                       if(response.lockMode === 'pin')
537 +                                               this.controller.get('securitymsg').innerHTML = $L('PIN');
538 +                                       else if(response.lockMode === 'password')
539 +                                               this.controller.get('securitymsg').innerHTML = $L('PW');
540 +                                       else
541 +                                               this.controller.get('securitymsg').innerHTML = $L('None');
542 +                               }
543 +                       }.bind(this)
544 +               });
545 +       },
546 +
547 +       toggleNetworkList: function(event) {    
548 +               if((event.up) && ( event.up.altKey || event.up.metaKey)) {
549 +                       this.controller.serviceRequest('palm://com.palm.telephony/', {
550 +                               method: "ratSet", parameters: {"mode": "automatic"}
551 +                       });
552 +               }
553 +               else {
554 +                       if(this.networkdrawer.mojo.getOpenState()) {
555 +                               this.prevDrawer = null;
556 +               
557 +                               this.controller.hideWidgetContainer(this.controller.get('networkdetails'));
558 +                       }
559 +                       else {
560 +                               if(this.prevDrawer)
561 +                                       this.prevDrawer.mojo.setOpenState(false);
562 +               
563 +                               this.prevDrawer = this.networkdrawer;
564 +               
565 +                               this.controller.showWidgetContainer(this.controller.get('networkdetails'));     
566 +                       }
567 +       
568 +                       this.networkdrawer.mojo.setOpenState(!this.networkdrawer.mojo.getOpenState());                                          
569                 }
570 -               this.apModeInProgress = true;
571 +       },
572 +
573 +       changeNetworkState: function(event) {
574 +               if(event.target.id == "network_2g")
575 +                       var network = "gsm";
576 +               else if(event.target.id == "network_3g") 
577 +                       var network = "umts";
578 +               else
579 +                       var network = "automatic";
580 +
581 +               this.controller.serviceRequest('palm://com.palm.telephony/', {
582 +                       method: "ratSet", parameters: {"mode": network},
583 +                       onComplete: this.updateNetworkState.bind(this) });
584 +
585 +               this.toggleDeviceMenu.bind(this).delay(0.2);
586 +       },
587 +       
588 +       updateNetworkState: function() {
589 +               this.controller.serviceRequest('palm://com.palm.telephony/', {
590 +                       method: "ratQuery", 
591 +                       onComplete: function(response) {
592 +                               if(response && response.extended && response.extended.mode) {
593 +                                       if(response.extended.mode === 'gsm')
594 +                                               this.controller.get('networkmsg').innerHTML = $L('2G');
595 +                                       else if(response.extended.mode === 'umts')
596 +                                               this.controller.get('networkmsg').innerHTML = $L('3G');
597 +                                       else
598 +                                               this.controller.get('networkmsg').innerHTML = $L('Auto');
599 +                               }
600 +                               else
601 +                                       this.controller.get('networkmsg').innerHTML = $L('Auto');
602 +                       }.bind(this)
603 +               });
604         },
605         
606 +       togglePhoneList: function(event) {      
607 +               //Ignore the tap event if Airplane Mode is on
608 +               if(this.barAssistant.getAirplaneMode())
609 +                       return;
610 +
611 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
612 +                       this.togglePhoneConn(event);
613 +               else {
614 +                       if(this.phonedrawer.mojo.getOpenState()) {
615 +                               this.prevDrawer = null;
616 +               
617 +                               this.controller.hideWidgetContainer(this.controller.get('phonedetails'));
618 +                       }
619 +                       else {
620 +                               if(this.prevDrawer)
621 +                                       this.prevDrawer.mojo.setOpenState(false);
622 +               
623 +                               this.prevDrawer = this.phonedrawer;
624 +               
625 +                               this.controller.showWidgetContainer(this.controller.get('phonedetails'));       
626 +                       }
627 +       
628 +                       this.phonedrawer.mojo.setOpenState(!this.phonedrawer.mojo.getOpenState());                                              
629 +               }
630 +       },
631 +       
632 +       togglePhoneConn: function(event) {
633 +               if((!event.up) || (!event.up.altKey && !event.up.metaKey))
634 +                       this.toggleDeviceMenu.bind(this).delay(0.2);
635 +               else {
636 +                       if(ConnState.get('phone')) {
637 +                               this.controller.get('phone_conn').innerHTML = $L('Turning off Phone');                                  
638 +
639 +                               if(this.quickAction == "Phone Connection")
640 +                                       this.controller.get('menu_action').innerHTML = $L('Turning off Phone Connection');
641 +                       }
642 +                       else {
643 +                               this.controller.get('phone_conn').innerHTML = $L('Turning on Phone');                                   
644 +
645 +                               if(this.quickAction == "Phone Connection")
646 +                                       this.controller.get('menu_action').innerHTML = $L('Turning on Phone Connection');
647 +                       }
648 +               }
649 +
650 +               if(ConnState.get('phone')) {
651 +                       this.controller.serviceRequest("palm://com.palm.telephony", {'method': "powerSet", 
652 +                               'parameters': {'state': "off"}});
653 +               }
654 +               else {
655 +                       this.controller.serviceRequest("palm://com.palm.telephony", {'method': "powerSet", 
656 +                               'parameters': {'state': "on"}});
657 +               }
658 +       },
659 +       
660 +       togglePhoneRoam: function(event) {
661 +               var roamstate = RoamState.get('phone');
662 +
663 +               if((event.up) && ( event.up.altKey || event.up.metaKey)) {      
664 +                       if(roamstate === 'any')
665 +                               var state = 'roamonly';
666 +                       else
667 +                               var state = 'any';
668 +               }
669 +               else {
670 +                       if(roamstate === 'any')
671 +                               var state = 'homeonly';
672 +                       else
673 +                               var state = 'any';
674 +               }
675 +
676 +               this.controller.serviceRequest('palm://com.palm.telephony', {
677 +                       method: 'roamModeSet', 
678 +                       parameters: {mode: state, client: Mojo.appName}
679 +               });
680 +
681 +               this.toggleDeviceMenu.bind(this).delay(0.2);            
682 +       },
683 +       
684 +       handlePhoneLaunch: function(event) {
685 +               this.launchPhonePrefs.bind(this).delay(0.2);
686 +       },
687 +
688 +       launchPhonePrefs: function(toggleMenu) {
689 +               this.serviceRequest = new Mojo.Service.Request('palm://com.palm.applicationManager', {
690 +                       method: 'open',
691 +                       parameters: {'id': 'com.palm.app.phoneprefs','params':{}}
692 +               });
693 +
694 +               this.toggleDeviceMenu();
695 +       },
696 +       
697 +       updatePhoneState: function() {
698 +               var phonestate = this.barAssistant.getCurrentPhoneState();
699 +
700 +               if(phonestate === 'Off') {
701 +                       ConnState.set('phone', false);
702 +
703 +                       this.controller.get('phonemsg').innerHTML = $L('Off');
704 +
705 +                       this.controller.get('phone_conn').innerHTML = $L('Turn on Phone');                                      
706 +
707 +                       if(this.quickAction == "Phone Connection")
708 +                               this.controller.get('menu_action').innerHTML = $L('Turn on Phone Connection');
709 +               }
710 +               else {
711 +                       ConnState.set('phone', true);
712 +
713 +                       if(phonestate === 'On')
714 +                               this.controller.get('phonemsg').innerHTML = $L('On');
715 +                       else
716 +                               this.controller.get('phonemsg').innerHTML = phonestate.escapeHTML();
717 +
718 +                       this.controller.get('phone_conn').innerHTML = $L('Turn off Phone');                                     
719 +
720 +                       if(this.quickAction == "Phone Connection")
721 +                               this.controller.get('menu_action').innerHTML = $L("Turn off Phone Connection");
722 +               }
723 +               
724 +               this.controller.get('phone_roam').innerHTML = $L('Roaming Enabled');
725 +               
726 +               this.controller.serviceRequest('palm://com.palm.telephony/', {
727 +                       method: 'roamModeQuery', parameters: {},
728 +                       onSuccess: function(response) {
729 +                               RoamState.set('phone', response.extended.mode);
730 +
731 +                               var roamstate = RoamState.get('phone');
732 +
733 +                               if(roamstate=='roamonly') {
734 +                                       this.controller.get('phone_roam').innerHTML = $L('Roaming Forced');
735 +                                       
736 +                                       if(this.quickAction == "Voice Roaming")
737 +                                               this.controller.get('menu_action').innerHTML = $L("Enable Voice Roaming");
738 +                               }
739 +                               else if (roamstate=="homeonly") {
740 +                                       this.controller.get('phone_roam').innerHTML = $L('Roaming Disabled');
741 +                                       
742 +                                       if(this.quickAction == "Voice Roaming")
743 +                                               this.controller.get('menu_action').innerHTML = $L("Enable Voice Roaming");
744 +                               }
745 +                               else {
746 +                                       this.controller.get('phone_roam').innerHTML = $L('Roaming Enabled');
747 +                                       
748 +                                       if(this.quickAction == "Voice Roaming")
749 +                                               this.controller.get('menu_action').innerHTML = $L("Disable Voice Roaming");
750 +                               }
751 +                       }.bind(this)
752 +               });
753 +       },
754 +       
755 +       toggleDataList: function(event) {       
756 +               //Ignore the tap event if Airplane Mode is on
757 +               if(this.barAssistant.getAirplaneMode())
758 +                       return;
759 +
760 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
761 +                       this.toggleDataConn(event);
762 +               else {
763 +                       if(this.datadrawer.mojo.getOpenState()) {
764 +                               this.prevDrawer = null;
765 +               
766 +                               this.controller.hideWidgetContainer(this.controller.get('datadetails'));
767 +                       }
768 +                       else {
769 +                               if(this.prevDrawer)
770 +                                       this.prevDrawer.mojo.setOpenState(false);
771 +               
772 +                               this.prevDrawer = this.datadrawer;
773 +               
774 +                               this.controller.showWidgetContainer(this.controller.get('datadetails'));        
775 +                       }
776 +       
777 +                       this.datadrawer.mojo.setOpenState(!this.datadrawer.mojo.getOpenState());                                                
778 +               }
779 +       },
780 +       
781 +       toggleDataConn: function(event) {
782 +               if((!event.up) || (!event.up.altKey && !event.up.metaKey))
783 +                       this.toggleDeviceMenu.bind(this).delay(0.2);            
784 +               else {
785 +                       if(ConnState.get('data')) {
786 +                               this.controller.get('data_conn').innerHTML = $L('Turning off Data');                                    
787 +
788 +                               if(this.quickAction == "Data Connection")
789 +                                       this.controller.get('menu_action').innerHTML = $L('Turn off Data Connection');
790 +                       }
791 +                       else {
792 +                               this.controller.get('data_conn').innerHTML = $L('Turn on Data');                                        
793 +
794 +                               if(this.quickAction == "Data Connection")
795 +                                       this.controller.get('menu_action').innerHTML = $L('Turn on Data Connection');
796 +                       }
797 +               }
798 +
799 +               if(ConnState.get('data'))
800 +                       var state = "on";
801 +               else
802 +                       var state = "off";
803 +                       
804 +               this.controller.serviceRequest('palm://com.palm.wan/', {
805 +                       method: 'set', parameters: {disablewan: state} });
806 +       },
807 +       
808 +       toggleDataRoam: function(event) {
809 +               var roamstate = RoamState.get('data');
810 +
811 +               if(roamstate === true)
812 +                       var state = "enable";
813 +               else
814 +                       var state = "disable";
815 +               
816 +               this.controller.serviceRequest('palm://com.palm.wan/', {
817 +                       method: 'set',
818 +                       parameters: {roamguard: state},
819 +               });
820 +
821 +               this.toggleDeviceMenu.bind(this).delay(0.2);            
822 +       },
823 +       
824 +       updateDataState: function() {
825 +               var datastate = this.barAssistant.getCurrentDataState();
826 +               
827 +               if(datastate === 'Off') {
828 +                       ConnState.set('data', false);
829 +
830 +                       this.controller.get('datamsg').innerHTML = $L('Off');
831 +
832 +                       this.controller.get('data_conn').innerHTML = $L('Turn on Data');                                        
833 +
834 +                       if(this.quickAction == "Data Connection")
835 +                               this.controller.get('menu_action').innerHTML = $L('Turn on Data Connection');
836 +               }
837 +               else {
838 +                       ConnState.set('data', true);
839 +
840 +                       if(datastate === 'On')
841 +                               this.controller.get('datamsg').innerHTML = $L('On');
842 +                       else
843 +                               this.controller.get('datamsg').innerHTML = datastate.escapeHTML();
844 +
845 +                       this.controller.get('data_conn').innerHTML = $L('Turn off Data');                                       
846 +
847 +                       if(this.quickAction == "Data Connection")
848 +                               this.controller.get('menu_action').innerHTML = $L("Turn off Data Connection");
849 +               }
850 +
851 +               var roamstate = this.barAssistant.getRoamingDataState();
852 +               
853 +               if(roamstate === 'Off') {
854 +                       RoamState.set('data', false);
855 +                       
856 +                       this.controller.get('data_roam').innerHTML = $L('Roaming Disabled');
857 +                       
858 +                       if(this.quickAction == "Data Roaming")
859 +                               this.controller.get('menu_action').innerHTML = $L("Enable Data Roaming");
860 +               }
861 +               else {
862 +                       RoamState.set('data', true);
863 +
864 +                       this.controller.get('data_roam').innerHTML = $L('Roaming Enabled');
865 +
866 +                       if(this.quickAction == "Data Roaming")
867 +                               this.controller.get('menu_action').innerHTML = $L("Disable Data Roaming");
868 +               }
869 +       },
870 +       
871 +       updateWiFiState: function() {
872 +               var wifistate = this.barAssistant.getCurrentWiFiState();
873 +               
874 +               if(wifistate === 'Off') {
875 +                       RadioState.set('wifi',false);
876 +
877 +                       this.controller.get('wifimsg').innerHTML = $L('Off');
878 +
879 +                       this.controller.get('wifi_radio').innerHTML = $L('Turn on Wi-Fi');      
880 +
881 +                       if(this.quickAction == "Wi-Fi Connection")
882 +                               this.controller.get('menu_action').innerHTML = $L("Turn on Wi-Fi Connection");
883 +               }                       
884 +               else {
885 +                       RadioState.set('wifi',true);
886 +                       
887 +                       if(wifistate === 'On')
888 +                               this.controller.get('wifimsg').innerHTML = $L('On');
889 +                       else
890 +                               this.controller.get('wifimsg').innerHTML = wifistate.escapeHTML();                      
891 +
892 +                       this.controller.get('wifi_radio').innerHTML = $L('Turn off Wi-Fi');     
893 +
894 +                       if(this.quickAction == "Wi-Fi Connection")
895 +                               this.controller.get('menu_action').innerHTML = $L("Turn off Wi-Fi Connection");
896 +               }
897 +       },
898 +       
899 +       updateBTState: function() {
900 +               var btstate = this.barAssistant.getCurrentBluetoothState();
901 +               
902 +               if(btstate === 'Off') {
903 +                       RadioState.set('bluetooth',false);
904 +
905 +                       this.controller.get('btmsg').innerHTML = $L('Off');
906 +
907 +                       this.controller.get('bt_radio').innerHTML = $L('Turn on Bluetooth');    
908 +
909 +                       if(this.quickAction == "BT Connection")
910 +                               this.controller.get('menu_action').innerHTML = $L("Turn on BT Connection");
911 +               }                       
912 +               else {
913 +                       RadioState.set('bluetooth',true);
914 +                                       
915 +                       if(btstate === 'On')
916 +                               this.controller.get('btmsg').innerHTML = $L('On');
917 +                       else
918 +                               this.controller.get('btmsg').innerHTML = btstate.escapeHTML();                  
919 +
920 +                       this.controller.get('bt_radio').innerHTML = $L('Turn off Bluetooth');   
921 +
922 +                       if(this.quickAction == "BT Connection")
923 +                               this.controller.get('menu_action').innerHTML = $L("Turn off BT Connection");
924 +               }                       
925 +               
926 +               if(this.turningOnBtRadio) {
927 +                       this.btspinnerModel.spinning = true;
928 +                       this.controller.modelChanged(this.btspinnerModel);
929 +               }
930 +       },
931 +       
932 +       updateGPSState: function() {
933 +               var gpsstate = this.barAssistant.getCurrentGpsState();
934 +
935 +               if(gpsstate === 'Off') {
936 +                       RadioState.set('gps',false);
937 +                       
938 +                       this.controller.get('gpsmsg').innerHTML = $L('Off');
939 +
940 +                       this.controller.get('gps_radio').innerHTML = $L('Turn on GPS');
941 +
942 +                       if(this.quickAction == "GPS Connection")
943 +                               this.controller.get('menu_action').innerHTML = $L("Turn on GPS Connection");
944 +               }                       
945 +               else {
946 +                       RadioState.set('gps',true);
947 +                                       
948 +                       if(gpsstate === 'On')
949 +                               this.controller.get('gpsmsg').innerHTML = $L('On');
950 +                       else
951 +                               this.controller.get('gpsmsg').innerHTML = gpsstate.escapeHTML();        
952 +               
953 +                       this.controller.get('gps_radio').innerHTML = $L('Turn off GPS');                                        
954 +                       
955 +                       if(this.quickAction == "GPS Connection")
956 +                               this.controller.get('menu_action').innerHTML = $L("Turn off GPS Connection");
957 +               }
958 +       },
959 +       
960 +       updateMenuItems: function() {
961 +               var msg = $L("Battery: #{batlevel}, #{batstate}");
962 +               
963 +               this.controller.get('menu_header').innerHTML = new Template(msg).evaluate({"batlevel": Mojo.Format.formatPercent(this.barAssistant.getBatteryLevel()), "batstate": this.barAssistant.getBatteryState()});
964 +       
965 +               for(var i = 0; i < this.menus.length; i++) {
966 +                       if(this.hiddenItems.indexOf(this.menus[i]) == -1)
967 +                               this.controller.get(this.item_ids[i]).show();
968 +                       else 
969 +                               this.controller.get(this.item_ids[i]).hide();
970 +               }
971 +               
972 +               this.controller.modelChanged(this.modesModel, this);
973 +       
974 +               var temp = this.barAssistant.getBatteryTemp();
975 +
976 +               this.controller.get("devicemsg").innerHTML = temp + "&deg;C";
977 +
978 +               this.updateFlashState();
979 +               this.updateScreenState();
980 +               this.updateVolumeState();
981 +
982 +               this.updateSecurityState();
983 +
984 +               this.updateNetworkState();
985 +                                               
986 +               this.updatePhoneState();
987 +
988 +               this.updateDataState();
989 +               
990 +               this.updateWiFiState();
991 +               
992 +               this.updateBTState();
993 +               
994 +               this.updateGPSState();
995 +
996 +               this.updateAirplaneModeSettings();
997 +       },
998 +       
999 +       updateEditItems: function() {
1000 +               this.controller.get('menu_header').innerHTML = $L("Menu Content Settings");
1001 +               
1002 +               this.controller.get('menu_action').innerHTML = $L("Toggle " + this.quickAction);
1003 +
1004 +               this.editItems.clear();
1005 +
1006 +               for(var i = 0; i < this.menus.length; i++) {
1007 +                       if(this.hiddenItems.indexOf(this.menus[i]) == -1)
1008 +                               this.editItems.push({title: this.menus[i], label: "show"});
1009 +                       else
1010 +                               this.editItems.push({title: this.menus[i], label: "hide"});
1011 +               }
1012 +               
1013 +               this.controller.modelChanged(this.modelEditItems, this);
1014 +       },
1015 +       
1016 +       toggleGpsRadio: function(event) {
1017 +               if((!event.up) || (!event.up.altKey && !event.up.metaKey))
1018 +                       this.toggleDeviceMenu.bind(this).delay(0.2);            
1019 +               else {
1020 +                       if(RadioState.get('gps')) {
1021 +                               this.controller.get('gps_radio').innerHTML = $L('Turning off GPS');                                     
1022 +                       
1023 +                               if(this.quickAction == "GPS Connection")
1024 +                                       this.controller.get('menu_action').innerHTML = $L("Turning off GPS Connection");
1025 +                       }
1026 +                       else {
1027 +                               this.controller.get('gps_radio').innerHTML = $L('Turning on GPS');                                      
1028 +                       
1029 +                               if(this.quickAction == "GPS Connection")
1030 +                                       this.controller.get('menu_action').innerHTML = $L("Turning on GPS Connection");
1031 +                       }
1032 +               }
1033 +               
1034 +               if(RadioState.get('gps')) {
1035 +                       this.controller.serviceRequest('palm://com.palm.location/', {
1036 +                               method: 'setUseGps', parameters: {useGps: false},
1037 +                               onSuccess: this.barAssistant.gpsGetRadioStatus.bind(this)});
1038 +               }                       
1039 +               else {
1040 +                       this.controller.serviceRequest('palm://com.palm.location/', {
1041 +                               method: 'setUseGps',    parameters: {useGps: true},
1042 +                               onSuccess: this.barAssistant.gpsGetRadioStatus.bind(this)});
1043 +               }
1044 +       },
1045 +       
1046 +       /*
1047 +        * Toggles the GPS List to show and hide when tapping on the GPS Row.
1048 +        */
1049 +
1050 +       toggleGpsList: function(event) {
1051 +               
1052 +               //Ignore the tap event if Airplane Mode is on
1053 +               if(this.barAssistant.getAirplaneMode())
1054 +                       return;
1055 +
1056 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
1057 +                       this.toggleGpsRadio(event);
1058 +               else {                          
1059 +                       if (this.gpsdrawer.mojo.getOpenState()) {                       
1060 +                               this.prevDrawer = null;
1061 +               
1062 +                               this.controller.hideWidgetContainer(this.controller.get('gpsdetails')); 
1063 +                       }
1064 +                       else {
1065 +                               if(this.prevDrawer)
1066 +                                       this.prevDrawer.mojo.setOpenState(false);
1067 +               
1068 +                               this.prevDrawer = this.gpsdrawer;
1069 +                                               
1070 +                               this.controller.showWidgetContainer(this.controller.get('gpsdetails'));                 
1071 +                       }       
1072 +                       this.gpsdrawer.mojo.setOpenState(!this.gpsdrawer.mojo.getOpenState());                                          
1073 +               }
1074 +       },
1075 +
1076 +       handleGpsLaunch: function(event) {
1077 +               this.launchGps.bind(this).delay(0.2,true);
1078 +       },
1079 +
1080 +       launchGps: function(toggleMenu) {
1081 +               this.serviceRequest = new Mojo.Service.Request('palm://com.palm.applicationManager', {
1082 +                               method: 'open',
1083 +                               parameters: {'id': 'com.palm.app.location','params':{}}
1084 +               });
1085 +               if(toggleMenu)
1086 +                       this.toggleDeviceMenu();
1087 +       },
1088 +
1089         toggleBTRadio: function(event) {
1090                 
1091                 if(this.turningOnBtRadio)
1092                         return;
1093                         
1094                 if(RadioState.get('bluetooth')) {
1095 +                       if((!event.up) || (!event.up.altKey && !event.up.metaKey))
1096 +                               this.toggleDeviceMenu.delay(0.2);                       
1097 +                       else {
1098 +                               this.controller.get('bt_radio').innerHTML = $L('Turning off Bluetooth');        
1099 +
1100 +                               if(this.quickAction == "BT Connection")
1101 +                                       this.controller.get('menu_action').innerHTML = $L("Turning off BT Connection");
1102 +                       }
1103 +                       
1104                         BtService.radiooff(null,null);
1105 -                       this.toggleDeviceMenu.delay(0.2);                       
1106                 }                       
1107 -               else
1108 +               else {
1109 +                       if((event.up) && (event.up.altKey || event.up.metaKey))
1110 +                               this.noClosing = true;
1111 +                       else {
1112 +                               this.controller.get('bt_radio').innerHTML = $L('Turning on Bluetooth'); 
1113 +
1114 +                               if(this.quickAction == "BT Connection")
1115 +                                       this.controller.get('menu_action').innerHTML = $L("Turning on BT Connection");
1116 +                       }
1117 +                       
1118                         this.btRadioOnServiceReq = BtService.radioon(this.btRadioTurnedOn.bind(this),null);             
1119 +               }
1120         },
1121         
1122         btRadioTurnedOn: function(payload) {
1123 @@ -262,10 +1233,49 @@
1124         togglebluetoothList: function(event) {
1125                 
1126                 //Ignore the tap event if Airplane Mode is in Progress
1127 -               if(this.apModeInProgress)
1128 +               if(this.barAssistant.getAirplaneMode())
1129                         return;
1130 +
1131 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
1132 +                       this.toggleBTRadio(event);
1133 +               else {
1134 +                       this.clearBTList();
1135 +                       if (this.btdrawer.mojo.getOpenState()) {                        
1136 +                               this.prevDrawer = null;
1137 +                       
1138 +                               this.controller.get('btlist').hide();
1139 +                               this.controller.hideWidgetContainer(this.controller.get('btdetails'));  
1140 +                       }
1141 +                       else {
1142 +                               if(this.prevDrawer)
1143 +                                       this.prevDrawer.mojo.setOpenState(false);
1144 +                                               
1145 +                               this.prevDrawer = this.btdrawer;
1146 +                                               
1147 +                               if (RadioState.get('bluetooth')) {
1148 +                                       this.controller.get('bt_radio').innerHTML = $L('Turn off Bluetooth');
1149 +                                       if (this.btTrustedListReq) {
1150 +                                               this.btTrustedListReq.cancel();
1151 +                                               this.btTrustedListReq = undefined;
1152 +                                       }       
1153 +                                       this.btTrustedListReq = BtService.getTrustedList(this.BtDevicesHandler.bind(this), this.BtDevicesHandler.bind(this));
1154 +                               }
1155 +                               else {
1156 +                                       this.getNumBTProfileReq = BtService.getNumOfProfiles(this.gotNumOfProfiles.bind(this));
1157 +                                       if(this.turningOnBtRadio) {
1158 +                                               this.controller.get('bt_radio').innerHTML = $L('Turning on Bluetooth');
1159 +                                       }
1160 +                                       else 
1161 +                                               this.controller.get('bt_radio').innerHTML = $L('Turn on Bluetooth');
1162 +                               }       
1163 +                                       
1164 +                               this.controller.get('btlist').show();
1165 +                               this.controller.showWidgetContainer(this.controller.get('btdetails'));                  
1166 +                       }       
1167 +                       this.btdrawer.mojo.setOpenState(!this.btdrawer.mojo.getOpenState());                                            
1168 +               }
1169                                 
1170 -               this.clearBTList();
1171 +/*             this.clearBTList();
1172                 if (this.btdrawer.mojo.getOpenState()) {                        
1173                         this.controller.get('btlist').hide();
1174                         this.controller.hideWidgetContainer(this.controller.get('btdetails'));  
1175 @@ -292,7 +1302,7 @@
1176                         this.controller.get('btlist').show();
1177                         this.controller.showWidgetContainer(this.controller.get('btdetails'));                  
1178                 }       
1179 -               this.btdrawer.mojo.setOpenState(!this.btdrawer.mojo.getOpenState());                                            
1180 +               this.btdrawer.mojo.setOpenState(!this.btdrawer.mojo.getOpenState());                                            */
1181         },
1182         
1183         //Clear the Bluetooth List Array and List Model.        
1184 @@ -343,7 +1353,7 @@
1185                                 device.CONNECTSTATE = 'disconnected';
1186                                 device.showConnected = 'none';
1187                                 this.btListWidget.mojo.invalidateItems(deviceIndex,1);
1188 -                               if(this.isVisible)
1189 +                               if((this.isVisible) && (!this.noClosing))
1190                                         this.toggleDeviceMenu();                
1191                                 break;
1192                                 
1193 @@ -469,6 +1479,7 @@
1194                 if(!payload || !payload.returnValue ||!payload.trusteddevices)
1195                         return;
1196                 
1197 +               if(payload.trusteddevices) {
1198                 for (var i = 0; i < payload.trusteddevices.length; i++) {                       
1199                         var device = {
1200                                 DISPNAME: payload.trusteddevices[i].name,
1201 @@ -503,6 +1514,7 @@
1202                                 this.btListWidget.mojo.noticeAddedItems(this.btListWidget.mojo.getLength(), items);                                                     
1203                         }               
1204                 }                               
1205 +               }
1206         },
1207         
1208         /*
1209 @@ -581,7 +1593,7 @@
1210                                                         }
1211                                                 }
1212                                         }                                       
1213 -                                       if(this.isVisible && this.btConnectedDeviceAddr != payload.address)
1214 +                                       if(this.isVisible && !this.noClosing && this.btConnectedDeviceAddr != payload.address)
1215                                                 this.toggleDeviceMenu.delay(1); 
1216                                         this.btConnectedDeviceAddr = payload.address;   
1217                                         break;
1218 @@ -680,7 +1692,7 @@
1219                         }
1220                         else if(value === 'turningon') {
1221                                 this.turningOnBtRadio = true;
1222 -                               this.controller.get('bt_radio').innerHTML = $L('Turning on Bluetooth...');
1223 +                               this.controller.get('bt_radio').innerHTML = $L('Turning on Bluetooth');
1224                                 if (this.isVisible) {
1225                                         this.btspinnerModel.spinning = true;
1226                                         this.controller.modelChanged(this.btspinnerModel);
1227 @@ -724,11 +1736,29 @@
1228         
1229         toggleWifiRadio: function(event) {
1230                 if(RadioState.get('wifi')) {
1231 +                       if((!event.up) || (!event.up.altKey && !event.up.metaKey))
1232 +                               this.toggleDeviceMenu.delay(0.2);       
1233 +                       else {
1234 +                               this.controller.get('wifi_radio').innerHTML = $L('Turning off Wi-Fi');  
1235 +
1236 +                               if(this.quickAction == "Wi-Fi Connection")
1237 +                                       this.controller.get('menu_action').innerHTML = $L("Turning off Wi-Fi Connection");
1238 +                       }               
1239 +
1240                         WiFiService.setState("disabled",null,null);     
1241 -                       this.toggleDeviceMenu.delay(0.2);                       
1242                 }                       
1243                 else {
1244                         this.spinOn();
1245 +                       
1246 +                       if((event.up) && (event.up.altKey || event.up.metaKey))
1247 +                               this.noClosing = true;
1248 +                       else {
1249 +                               this.controller.get('wifi_radio').innerHTML = $L('Turning on Wi-Fi');   
1250 +
1251 +                               if(this.quickAction == "Wi-Fi Connection")
1252 +                                       this.controller.get('menu_action').innerHTML = $L("Turning on Wi-Fi Connection");
1253 +                       }
1254 +                       
1255                         WiFiService.setState("enabled",null,null);      
1256                 }               
1257         },
1258 @@ -737,10 +1767,43 @@
1259         togglewifiList: function(event) {       
1260                 
1261                 //Ignore the tap event if Airplane Mode is in Progress
1262 -               if(this.apModeInProgress)
1263 +               if(this.barAssistant.getAirplaneMode())
1264                         return;
1265                 
1266 -               this.clearWiFiList();
1267 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
1268 +                       this.toggleWifiRadio(event);
1269 +               else {
1270 +                       this.clearWiFiList();
1271 +                       if(this.wifidrawer.mojo.getOpenState()) {
1272 +                               this.prevDrawer = null;
1273 +                       
1274 +                               this.clearWiFiList();
1275 +                               this.controller.get('wifilist').hide();
1276 +                               this.controller.hideWidgetContainer(this.controller.get('wifidetails'));
1277 +                       }
1278 +                       else {
1279 +                               if(this.prevDrawer)
1280 +                                       this.prevDrawer.mojo.setOpenState(false);
1281 +               
1282 +                               this.prevDrawer = this.wifidrawer;
1283 +                       
1284 +                               if(RadioState.get('wifi')) {
1285 +                                       this.spinOn();  
1286 +                               
1287 +                                       if(this.wifiFindNetworksReq) {
1288 +                                               this.wifiFindNetworksReq.cancel();
1289 +                                               this.wifiFindNetworksReq = undefined;
1290 +                                       }
1291 +                                       this.wifiFindNetworksReq = WiFiService.findNetworks(this.wifiListCb.bind(this),this.wifiListCb.bind(this));
1292 +                               }                               
1293 +                                       
1294 +                               this.controller.get('wifilist').show(); 
1295 +                               this.controller.showWidgetContainer(this.controller.get('wifidetails'));        
1296 +                       }               
1297 +                       this.wifidrawer.mojo.setOpenState(!this.wifidrawer.mojo.getOpenState());                                                
1298 +               }
1299 +
1300 +/*             this.clearWiFiList();
1301                 if(this.wifidrawer.mojo.getOpenState()) {
1302                         this.clearWiFiList();
1303                         this.controller.get('wifilist').hide();
1304 @@ -763,7 +1826,7 @@
1305                         this.controller.get('wifilist').show(); 
1306                         this.controller.showWidgetContainer(this.controller.get('wifidetails'));        
1307                 }               
1308 -               this.wifidrawer.mojo.setOpenState(!this.wifidrawer.mojo.getOpenState());                                                
1309 +               this.wifidrawer.mojo.setOpenState(!this.wifidrawer.mojo.getOpenState());                                                */
1310         },
1311         
1312         /*
1313 @@ -1124,6 +2187,9 @@
1314         },
1315         
1316         handleVPNTap: function(event) {
1317 +               if((event.up) && (event.up.altKey || event.up.metaKey))
1318 +                       this.noClosing = true;
1319 +       
1320                 var item = event.item;
1321                 var itemIndex = event.index;
1322                 if(!item.info)
1323 @@ -1392,12 +2458,19 @@
1324  
1325         //IME 
1326         
1327 -       toggleDeviceMenu: function() {
1328 +       toggleDeviceMenu: function(edit) {
1329 +               this.noClosing = false;
1330 +       
1331 +               this.barAssistant.gpsGetRadioStatus();
1332 +       
1333                 this.clearAllAnimations();
1334                 var self = this;
1335                 if(this.isVisible) {
1336                         this.isVisible = false;
1337                         
1338 +                       if(this.prevDrawer)
1339 +                               this.prevDrawer.mojo.setOpenState(false);
1340 +                       
1341                         if (this.btspinnerModel.spinning) {
1342                                 this.btspinnerModel.spinning = false;
1343                                 this.controller.modelChanged(this.btspinnerModel);
1344 @@ -1405,8 +2478,8 @@
1345                         //animate the submenu onto the scene
1346                         var animateScrim = function(){
1347                                 Mojo.Animation.animateStyle(this.scrim, 'opacity', 'bezier', {
1348 -                                                       from: 0,
1349 -                                                       to: 1,
1350 +                                                       from: 1,
1351 +                                                       to: 0,
1352                                                         duration: .10,
1353                                                         curve:'over-easy',
1354                                                         reverse:true,
1355 @@ -1435,13 +2508,31 @@
1356                 }
1357                 else {
1358                         this.isVisible = true;
1359 -                       var date = new Date();          
1360 +/*                     var date = new Date();          
1361                         this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '})  +  Mojo.Format.formatDate(date,{date:'long'});
1362                         
1363                         if(this.turningOnBtRadio) {
1364                                 this.btspinnerModel.spinning = true;
1365                                 this.controller.modelChanged(this.btspinnerModel);
1366 +                       } */
1367 +
1368 +                       if(edit) {
1369 +                               this.isEditing = true;
1370 +                               
1371 +                               this.controller.get('menu_items').hide();
1372 +                               this.controller.get('edit_items').show();
1373 +                               
1374 +                               this.updateEditItems();
1375 +                       }
1376 +                       else {
1377 +                               this.isEditing = false;
1378 +       
1379 +                               this.controller.get('menu_items').show();
1380 +                               this.controller.get('edit_items').hide();
1381 +
1382 +                               this.updateMenuItems();
1383                         }
1384 +                       
1385                         this.activateStage();
1386                         
1387                         var animateDialog = function(){
1388 @@ -1504,12 +2595,22 @@
1389                 }
1390         },
1391  
1392 -       updateBatteryLevel: function(batlevel) {
1393 +/*     updateBatteryLevel: function(batlevel) {
1394                 var msg = $L("Battery: #{batlevel}");
1395                 this.controller.get('dm_battery').innerHTML = new Template(msg).evaluate({
1396                         "batlevel": Mojo.Format.formatPercent(batlevel)
1397                 });
1398 -       },
1399 +       }, */
1400 +
1401 +       updateBatteryInfo: function(batlevel, batstate) {
1402 +               if(!this.isEditing) {
1403 +                       var msg = $L("Battery: #{batlevel}, #{batstate}");
1404 +                       this.controller.get('menu_header').innerHTML = new Template(msg).evaluate({
1405 +                               "batlevel": Mojo.Format.formatPercent(batlevel),
1406 +                               "batstate": batstate
1407 +                       });             
1408 +               }
1409 +       },
1410  
1411         appMenuClosed: function(e) {
1412                 this.deactivateStage();
1413 --- .orig/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
1414 +++ /usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
1415 @@ -14,16 +14,70 @@
1416                 <div id="devicescroller" class="palm-popup-content" x-mojo-element="Scroller">       
1417                         <div class="palm-list">          
1418                                 
1419 -                               <div class="palm-row first"><div class="palm-row-wrapper">
1420 -                                       <div id="dm_date" class="title dim"></div>
1421 +                               <div class="palm-row first menu-start"><div class="palm-row-wrapper">
1422 +                                       <div id="menu_header" class="title dim"></div>
1423 +                               </div></div> 
1424 +                               
1425 +                               <div class="palm-section-divider"></div>               
1426 +                               
1427 +                               <div id="menu_items">
1428 +                               
1429 +                               <div class="palm-row" id="dm_device" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1430 +                                       <div class="title truncating-text">
1431 +                                               <div class="label right" id="devicemsg">&nbsp;</div>       
1432 +                                               <span x-mojo-loc=''>Device</span>                          
1433 +                                       </div>
1434                                 </div></div>
1435 +
1436 +                               <div id='devicedetails' x-mojo-element="Drawer">
1437 +                               
1438 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1439 +                                       <div style="padding: 5px 0px 5px 0px;">
1440 +                                               <div id="flashlight_toggle" class="right" x-mojo-element="ToggleButton"></div>
1441 +                                               <div class="title truncating-text" >LED Flashlight</div>
1442 +                                       </div>
1443 +                                       </div></div> 
1444 +                                       
1445 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1446 +                                               <div id="dm_brightness" style="float:right;padding-top:16px;padding-right: 22px;font-weight:bold;">50</div>
1447 +                                               <div class="title">Screen Brightness</div>
1448 +
1449 +                                               <div x-mojo-element="Slider" id="brightness_slider" style="padding: 1px 3px 0px 0px; height: 40px;"></div>
1450 +                                       </div></div>
1451                                 
1452 +                                       <div class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1453 +                                               <div id="dm_volume" style="float:right;padding-top:16px;padding-right: 22px;font-weight:bold;">50</div>
1454 +                                               <div id="volume_toggle" class="title">Ringtone Volume</div>
1455 +                                               
1456 +                                               <div x-mojo-element="Slider" id="volume_slider" style="padding-top: 1px 3px 0px 0px; height: 40px;"></div>
1457 +                                       </div></div>
1458 +                               </div>
1459 +
1460                                 <div class="palm-section-divider">
1461                                 </div> 
1462                                 
1463 -                               <div class="palm-row"><div class="palm-row-wrapper">
1464 -                                       <div id="dm_battery" class="title dim"></div>
1465 -                               </div></div> 
1466 +                               <div class="palm-row" id="dm_security" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1467 +                                       <div class="title truncating-text">
1468 +                                               <div class="label right" id="securitymsg">&nbsp;</div>       
1469 +                                               <span x-mojo-loc=''>Security</span>                          
1470 +                                       </div>
1471 +                               </div></div>
1472 +
1473 +                               <div id="securitydetails" x-mojo-element="Drawer">
1474 +                                       
1475 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1476 +                                               <div id="security_none" class="title truncating-text">Secure Unlock Off</div>
1477 +                                       </div></div>
1478 +
1479 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1480 +                                               <div id="security_pin" class="title truncating-text">Simple PIN Unlock</div>
1481 +                                       </div></div>
1482 +
1483 +                                       <div class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1484 +                                               <div id="security_pw" class="title truncating-text">Password Unlock</div>
1485 +                                       </div></div>
1486 +                                       
1487 +                               </div>
1488  
1489                                 <div class="palm-section-divider"></div>
1490                                 
1491 @@ -31,7 +85,7 @@
1492                                         <div class="title truncating-text">
1493                                                 <div class="label right" id="imemsg">&nbsp;</div>
1494                                                 <div class="ime-container">                                                     
1495 -                                                       <span x-mojo-loc=''>Input Methods</span>    
1496 +                                                       <span x-mojo-loc=''>Input</span>    
1497                                                 </div>
1498                                         </div>
1499                                 </div></div>   
1500 @@ -59,6 +113,89 @@
1501                                         
1502                                 </div> 
1503                                 
1504 +                               <div class="palm-section-divider"></div>
1505 +                               
1506 +                               <div class="palm-row" id="dm_network" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1507 +                                       <div class="title truncating-text">
1508 +                                               <div class="label right" id="networkmsg">&nbsp;</div>       
1509 +                                               <span x-mojo-loc=''>Network</span>                          
1510 +                                       </div>
1511 +                               </div></div>
1512 +
1513 +                               <div id="networkdetails" x-mojo-element="Drawer">
1514 +                                       
1515 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1516 +                                               <div id="network_auto" class="title truncating-text">
1517 +                                                       Automatic Network
1518 +                                               </div>                                                          
1519 +                                       </div></div>
1520 +
1521 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1522 +                                               <div id="network_2g" class="title truncating-text">
1523 +                                                       Only 2G Networks
1524 +                                               </div>                                                          
1525 +                                       </div></div>
1526 +
1527 +                                       <div class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1528 +                                               <div id="network_3g" class="title truncating-text">
1529 +                                                       Only 3G Networks
1530 +                                               </div>                                                          
1531 +                                       </div></div>
1532 +                                       
1533 +                               </div>
1534 +
1535 +                               <div class="palm-row" id="dm_phone" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1536 +                                       <div class="title truncating-text">
1537 +                                               <div class="label right" id="phonemsg">&nbsp;</div>       
1538 +                                               <span x-mojo-loc=''>Phone</span>                          
1539 +                                       </div>
1540 +                               </div></div>
1541 +
1542 +                               <div id="phonedetails" x-mojo-element="Drawer">
1543 +                                       
1544 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1545 +                                               <div id="phone_conn" class="title truncating-text"></div>                                                               
1546 +                                       </div></div>
1547 +
1548 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1549 +                                               <div id="phone_roam" class="title truncating-text"></div>                                                               
1550 +                                       </div></div>
1551 +                                       
1552 +                                       <div id="phone_pref" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1553 +                                               <div class="title truncating-text">
1554 +                                                       <span x-mojo-loc=''>Phone Preferences</span>
1555 +                                               </div>
1556 +                                       </div></div>
1557 +                                       
1558 +                               </div>
1559 +
1560 +                               <div class="palm-section-divider"></div>
1561 +                               
1562 +                               <div class="palm-row" id="dm_data" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1563 +                                       <div class="title truncating-text">
1564 +                                               <div class="label right" id="datamsg">&nbsp;</div>       
1565 +                                               <span x-mojo-loc=''>Data</span>                          
1566 +                                       </div>
1567 +                               </div></div>
1568 +
1569 +                               <div id="datadetails" x-mojo-element="Drawer">
1570 +                                       
1571 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1572 +                                               <div id="data_conn" class="title truncating-text"></div>                                                                
1573 +                                       </div></div>
1574 +                                       
1575 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1576 +                                               <div id="data_roam" class="title truncating-text"></div>                                                                
1577 +                                       </div></div>
1578 +                                       
1579 +                                       <div id="data_pref" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1580 +                                               <div class="title truncating-text">
1581 +                                                       <span x-mojo-loc=''>Data Preferences</span>
1582 +                                               </div>
1583 +                                       </div></div>
1584 +                                       
1585 +                               </div>
1586 +                                                               
1587                                 <div class="palm-section-divider">
1588                                 </div>               
1589                                 
1590 @@ -95,34 +232,6 @@
1591                                         
1592                                 </div> 
1593                                 
1594 -                               <div class="palm-section-divider"></div>
1595 -                               
1596 -                               <div class="palm-row" id="dm_vpn" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1597 -                                       <div class="title truncating-text">
1598 -                                               <div class="label right" id="vpnmsg">&nbsp;</div>                               
1599 -                                               <div class="vpn-container">            
1600 -                                                       <span x-mojo-loc=''>VPN</span>                                          
1601 -                                               </div>
1602 -                                       </div>   
1603 -                               </div></div>     
1604 -                               
1605 -                               <div id='vpndetails' x-mojo-element="Drawer">
1606 -                                                                       
1607 -                                       <div id="vpnlist" x-mojo-element="IndexedList" class="in-drawer-list">
1608 -                                       </div>
1609 -                                       
1610 -                                       <div class="palm-section-divider"></div>                                
1611 -                                       
1612 -                                       
1613 -                                       <div id="vpn_pref" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">   
1614 -                                               <div class="title truncating-text">
1615 -                                                       <span x-mojo-loc=''>VPN Preferences</span> 
1616 -                                               </div>
1617 -                                       </div></div>  
1618 -                                       
1619 -                               </div> 
1620 -                                                          
1621 -                               
1622                                 <div class="palm-section-divider"></div> 
1623                                 
1624                                 <div class="palm-row" id="dm_bluetooth" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1625 @@ -159,9 +268,63 @@
1626                                 
1627                                 <div class="palm-section-divider"></div>
1628                                 
1629 -                               <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1630 -                                       <div id="dm_airplanemode_status" class="title truncating-text">
1631 -                                        </div>
1632 +                               <div class="palm-row" id="dm_gps" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1633 +                                               <div class="title truncating-text">
1634 +                                                       <div class="label right" id="gpsmsg">&nbsp;</div>
1635 +                                                       <span x-mojo-loc=''>GPS</span>                                  
1636 +                                               </div>                          
1637 +                               </div></div>
1638 +                               
1639 +                               <div id="gpsdetails" x-mojo-element="Drawer">
1640 +                                       
1641 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1642 +                                               <div id="gps_radio" class="title truncating-text">
1643 +                                               </div>                                                          
1644 +                                       </div></div>
1645 +                                       
1646 +                                       <div id="gps_pref" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1647 +                                               <div class="title truncating-text">
1648 +                                                       <span x-mojo-loc=''>GPS Preferences</span>
1649 +                                               </div>
1650 +                                       </div></div>
1651 +                                       
1652 +                               </div>
1653 +
1654 +                               <div class="palm-section-divider"></div>
1655 +                               
1656 +                               <div class="palm-row" id="dm_vpn" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1657 +                                       <div class="title truncating-text">
1658 +                                               <div class="label right" id="vpnmsg">&nbsp;</div>                               
1659 +                                               <div class="vpn-container">            
1660 +                                                       <span x-mojo-loc=''>VPN</span>                                          
1661 +                                               </div>
1662 +                                       </div>   
1663 +                               </div></div>     
1664 +                               
1665 +                               <div id='vpndetails' x-mojo-element="Drawer">
1666 +                                                                       
1667 +                                       <div id="vpnlist" x-mojo-element="IndexedList" class="in-drawer-list">
1668 +                                       </div>
1669 +                                       
1670 +                                       <div class="palm-section-divider"></div>                                
1671 +                                       
1672 +                                       
1673 +                                       <div id="vpn_pref" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">   
1674 +                                               <div class="title truncating-text">
1675 +                                                       <span x-mojo-loc=''>VPN Preferences</span> 
1676 +                                               </div>
1677 +                                       </div></div>  
1678 +                                       
1679 +                               </div> 
1680 +                                                          
1681 +                               </div>
1682 +
1683 +                               <div id="edit_items" x-mojo-element="IndexedList"></div>
1684 +
1685 +                               <div class="palm-section-divider"></div>
1686 +                               
1687 +                               <div class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1688 +                                       <div id="menu_action" class="title truncating-text"></div>
1689                                 </div></div>   
1690                                 
1691                                 </div>       
1692 --- .orig/usr/palm/applications/com.palm.app.screenlock/index.html
1693 +++ /usr/palm/applications/com.palm.app.screenlock/index.html
1694 @@ -10,6 +10,7 @@
1695        Mojo.loadScript('app/controllers/app-assistant.js');
1696           Mojo.loadScript('app/controllers/securityconfig-assistant.js');
1697           Mojo.loadScript('app/controllers/pin-assistant.js');
1698 +         Mojo.loadScript('app/controllers/password-assistant.js');
1699           Mojo.loadScript('app/models/SystemService.js');         
1700     </script>
1701    <link href="stylesheets/screenlock.css" media="screen" rel="stylesheet" type="text/css" />
1702 --- .orig/etc/jail_triton-inst.conf
1703 +++ /etc/jail_triton-inst.conf
1704 @@ -104,6 +104,11 @@
1705  # /etc
1706  mount:ro:/etc/palm
1707  
1708 +# /sys
1709 +mkdir:/sys
1710 +mkdir:/sys/class
1711 +mount:rw:/sys/class/i2c-adapter
1712 +
1713  # /media
1714  mkdir:/media
1715  mkdir:/media/cryptofs
1716 --- .orig/usr/lib/luna/system/luna-systemui/resources/es/views/devicemenu/devicemenu-scene.html
1717 +++ /usr/lib/luna/system/luna-systemui/resources/es/views/devicemenu/devicemenu-scene.html
1718 @@ -14,16 +14,70 @@
1719                 <div id="devicescroller" class="palm-popup-content" x-mojo-element="Scroller">       
1720                         <div class="palm-list">          
1721                                 
1722 -                               <div class="palm-row first"><div class="palm-row-wrapper">
1723 -                                       <div id="dm_date" class="title dim"></div>
1724 +                               <div class="palm-row first menu-start"><div class="palm-row-wrapper">
1725 +                                       <div id="menu_header" class="title dim"></div>
1726 +                               </div></div> 
1727 +                               
1728 +                               <div class="palm-section-divider"></div>               
1729 +                               
1730 +                               <div id="menu_items">
1731 +                               
1732 +                               <div class="palm-row" id="dm_device" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1733 +                                       <div class="title truncating-text">
1734 +                                               <div class="label right" id="devicemsg">&nbsp;</div>       
1735 +                                               <span x-mojo-loc=''>Device</span>                          
1736 +                                       </div>
1737                                 </div></div>
1738 +
1739 +                               <div id='devicedetails' x-mojo-element="Drawer">
1740                                 
1741 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1742 +                                       <div style="padding: 5px 0px 5px 0px;">
1743 +                                               <div id="flashlight_toggle" class="right" x-mojo-element="ToggleButton"></div>
1744 +                                               <div class="title truncating-text" >LED Flashlight</div>
1745 +                                       </div>
1746 +                                       </div></div> 
1747 +                                       
1748 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1749 +                                               <div id="dm_brightness" style="float:right;padding-top:16px;padding-right: 22px;font-weight:bold;">50</div>
1750 +                                               <div class="title">Screen Brightness</div>
1751 +
1752 +                                               <div x-mojo-element="Slider" id="brightness_slider" style="padding: 1px 3px 0px 0px; height: 40px;"></div>
1753 +                                       </div></div>
1754 +                               
1755 +                                       <div class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1756 +                                               <div id="dm_volume" style="float:right;padding-top:16px;padding-right: 22px;font-weight:bold;">50</div>
1757 +                                               <div id="volume_toggle" class="title">Ringtone Volume</div>
1758 +                                               
1759 +                                               <div x-mojo-element="Slider" id="volume_slider" style="padding-top: 1px 3px 0px 0px; height: 40px;"></div>
1760 +                                       </div></div>
1761 +                               </div>
1762 +
1763                                 <div class="palm-section-divider">
1764                                 </div> 
1765                                 
1766 -                               <div class="palm-row"><div class="palm-row-wrapper">
1767 -                                       <div id="dm_battery" class="title dim"></div>
1768 -                               </div></div> 
1769 +                               <div class="palm-row" id="dm_security" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1770 +                                       <div class="title truncating-text">
1771 +                                               <div class="label right" id="securitymsg">&nbsp;</div>       
1772 +                                               <span x-mojo-loc=''>Security</span>                          
1773 +                                       </div>
1774 +                               </div></div>
1775 +
1776 +                               <div id="securitydetails" x-mojo-element="Drawer">
1777 +                                       
1778 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1779 +                                               <div id="security_none" class="title truncating-text">Secure Unlock Off</div>
1780 +                                       </div></div>
1781 +
1782 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1783 +                                               <div id="security_pin" class="title truncating-text">Simple PIN Unlock</div>
1784 +                                       </div></div>
1785 +
1786 +                                       <div class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1787 +                                               <div id="security_pw" class="title truncating-text">Password Unlock</div>
1788 +                                       </div></div>
1789 +                                       
1790 +                               </div>
1791  
1792                                 <div class="palm-section-divider"></div>
1793                                 
1794 @@ -59,6 +113,89 @@
1795                                         
1796                                 </div> 
1797                                 
1798 +                               <div class="palm-section-divider"></div>
1799 +                               
1800 +                               <div class="palm-row" id="dm_network" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1801 +                                       <div class="title truncating-text">
1802 +                                               <div class="label right" id="networkmsg">&nbsp;</div>       
1803 +                                               <span x-mojo-loc=''>Network</span>                          
1804 +                                       </div>
1805 +                               </div></div>
1806 +
1807 +                               <div id="networkdetails" x-mojo-element="Drawer">
1808 +                                       
1809 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1810 +                                               <div id="network_auto" class="title truncating-text">
1811 +                                                       Automatic Network
1812 +                                               </div>                                                          
1813 +                                       </div></div>
1814 +
1815 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1816 +                                               <div id="network_2g" class="title truncating-text">
1817 +                                                       Only 2G Networks
1818 +                                               </div>                                                          
1819 +                                       </div></div>
1820 +
1821 +                                       <div class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1822 +                                               <div id="network_3g" class="title truncating-text">
1823 +                                                       Only 3G Networks
1824 +                                               </div>                                                          
1825 +                                       </div></div>
1826 +                                       
1827 +                               </div>
1828 +
1829 +                               <div class="palm-row" id="dm_phone" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1830 +                                       <div class="title truncating-text">
1831 +                                               <div class="label right" id="phonemsg">&nbsp;</div>       
1832 +                                               <span x-mojo-loc=''>Phone</span>                          
1833 +                                       </div>
1834 +                               </div></div>
1835 +
1836 +                               <div id="phonedetails" x-mojo-element="Drawer">
1837 +                                       
1838 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1839 +                                               <div id="phone_conn" class="title truncating-text"></div>                                                               
1840 +                                       </div></div>
1841 +
1842 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1843 +                                               <div id="phone_roam" class="title truncating-text"></div>                                                               
1844 +                                       </div></div>
1845 +                                       
1846 +                                       <div id="phone_pref" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1847 +                                               <div class="title truncating-text">
1848 +                                                       <span x-mojo-loc=''>Phone Preferences</span>
1849 +                                               </div>
1850 +                                       </div></div>
1851 +                                       
1852 +                               </div>
1853 +
1854 +                               <div class="palm-section-divider"></div>
1855 +                               
1856 +                               <div class="palm-row" id="dm_data" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1857 +                                       <div class="title truncating-text">
1858 +                                               <div class="label right" id="datamsg">&nbsp;</div>       
1859 +                                               <span x-mojo-loc=''>Data</span>                          
1860 +                                       </div>