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