Updated system menus patches
[webos-internals:modifications.git] / top-bar / top-bar-system-menu-mods-v1.patch
1 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
2 +++ /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
3 @@ -22,6 +22,7 @@
4                 this.bluetoothState = 'Off';
5                 this.wifiState = 'Off'; 
6                 this.wifiRadio = false; 
7 +               this.gpsState = 'Off';
8                 
9                 $('rssi').className = 'nobars';
10                 $('datanet').className = 'off';
11 @@ -47,6 +48,9 @@
12                 //Get the Carrier Name by querying the Carrier DB
13                 this.getCarrierName();
14                 
15 +               // Initialize the Gps icon once the service is running
16 +               this.initOnServerStart("com.palm.location", this.gpsInit.bind(this), this.gpsDeinit.bind(this));
17 +               
18                 // Initialize the Bluetooth icon once the service is running
19                 this.initOnServerStart("com.palm.btmonitor", this.btMonitorInit.bind(this), this.btMonitorDeinit.bind(this));
20                 this.initOnServerStart("com.palm.bluetooth", this.btInit.bind(this), this.btDeInit.bind(this));
21 @@ -604,6 +608,7 @@
22                 
23                 var stageController = Mojo.Controller.getAppController().getStageProxy("DeviceMenu");
24                 if (stageController) {
25 +                       this.gpsGetRadioStatus();
26                         this.hideSystemMenus("device");
27                         stageController.delegateToSceneAssistant("toggleDeviceMenu", edit);                     
28                 } else {
29 @@ -1911,6 +1916,47 @@
30  },
31  
32  /*
33 + * Initialize GPS status on device menu
34 + */
35 +gpsInit:function(payload) {
36 +       // Initial value
37 +       this.gpsState = 'Off';
38 +       
39 +       this.gpsGetRadioStatus();
40 +},
41 +
42 +// Get gps radio status and update the state   
43 +gpsGetRadioStatus:function() {
44 +       if(this.gpsRadioStatusRequest) {
45 +               this.gpsRadioStatusRequest.cancel();
46 +       }
47 +
48 +       this.gpsRadioStatusRequest=new Mojo.Service.Request('palm://com.palm.location/',{
49 +               method:'getUseGps',
50 +               parameters: {"subscribe": true},
51 +               onSuccess: this.gpsHandleRadioStatus.bind(this)
52 +       });
53 +},
54 +
55 +gpsHandleRadioStatus:function(payload) {
56 +       if (payload.useGps != undefined) {
57 +               if(payload.useGps)
58 +                       this.gpsState = 'On';
59 +               else
60 +                       this.gpsState = 'Off';
61 +
62 +               // Update the Device Menu
63 +               var stageController = Mojo.Controller.getAppController().getStageProxy("DeviceMenu");
64 +               if (stageController) {
65 +                       stageController.delegateToSceneAssistant("updateGps",this.gpsState);
66 +               }
67 +       }
68 +},
69 +
70 +gpsDeinit:function(payload) {
71 +},
72 +
73 +/*
74   * Handle power and charging notifications
75   */
76  handlePowerNotifications: function(payload) {
77 @@ -1920,6 +1966,10 @@
78                 Mojo.Log.error("SystemUI PowerD down -- ignoring the notification");
79                 return;
80         }       
81 +       // Is the temperature info provided?
82 +       if(payload.temperature_C) {
83 +               this.batteryTemp = payload.temperature_C;
84 +       }
85         // Is the battery level provided?
86         if (payload.percent_ui != undefined) {
87                 
88 @@ -1988,7 +2038,11 @@
89                         //Update the System Menu
90                         var stageController = Mojo.Controller.getAppController().getStageProxy("DeviceMenu");
91                         if (stageController) {
92 -                               stageController.delegateToSceneAssistant("updateBatteryLevel", this.batteryLevel);                      
93 +                               if(this.isCharging)
94 +                                       var batterystate = "Charging";
95 +                               else
96 +                                       var batterystate = "Discharging";
97 +                               stageController.delegateToSceneAssistant("updateBatteryInfo", this.batteryLevel, batterystate);                 
98                         }                                       
99                         return;
100                 }                
101 @@ -2081,6 +2135,17 @@
102         return this.batteryLevel;
103  },
104  
105 +getBatteryState: function() {
106 +       if(this.isCharging)
107 +               return "Charging";
108 +       else
109 +               return "Discharging";
110 +},
111 +
112 +getBatteryTemp: function() {
113 +       return this.batteryTemp;
114 +},
115 +
116  queryBatteryStatus: function() {
117         this.queryBatteryStatusReq = new Mojo.Service.Request('palm://com.palm.power/com/palm/power/', {
118                 method: 'batteryStatusQuery',});
119 @@ -2094,6 +2159,7 @@
120         this.lastBatteryLevel = 0;
121         this.chargingBannerShown = false;
122         this.batteryLevel = 0;
123 +       this.batteryTemp = 0;
124         // Subscribe to Battery Power Notifications
125         this.powerNotificationSession = new Mojo.Service.Request('palm://com.palm.bus/signal/', {
126                 method: 'addmatch',
127 @@ -2149,9 +2215,20 @@
128         
129          Mojo.Log.info("SystemUI -WAN Notification "+ Object.toJSON(payload));
130          
131 -        if(payload.returnValue != undefined && payload.returnValue)
132 -               return;
133 -               
134 +        if(payload.returnValue != undefined && payload.returnValue) {
135 +               return;
136 +        }       
137 +
138 +        if(payload.disablewan === 'on')
139 +               this.dataConnState = false;
140 +        else if(payload.disablewan === 'off')
141 +               this.dataConnState = true;
142 +
143 +        if(payload.roamGuard === 'disable')
144 +               this.dataRoamState = true;
145 +        else if(payload.roamGuard === 'enable')
146 +               this.dataRoamState = false;
147 +        
148          var mipFailureCode, causeCode; 
149                         
150          if (payload.networkstatus == "attached" && payload.connectedservices && payload.connectedservices.length > 0) { 
151 @@ -2926,22 +3003,12 @@
152                 this.airplaneMode = false;
153         
154         if(this.airplaneModeInitialQueryDone) {
155 -               var stageController = Mojo.Controller.getAppController().getStageProxy("DeviceMenu");   
156 -               if (stageController) {
157 -                       stageController.delegateToSceneAssistant("updateAirplaneModeProgress");
158 -               }       
159                 if (this.airplaneMode === false) 
160                         this.disableFlightMode();
161                 else {
162                         this.enableFlightMode();
163                 }
164         }
165 -       else {
166 -               var stageController = Mojo.Controller.getAppController().getStageProxy("DeviceMenu");   
167 -               if (stageController) {
168 -                       stageController.delegateToSceneAssistant("updateAirplaneModeSettings");
169 -               }       
170 -       }       
171         this.airplaneModeInitialQueryDone = true;
172  },
173  
174 @@ -3095,12 +3162,9 @@
175         this.apModeRadioStatus.set(radioName, true);
176         
177         var apModeDone = this.apModeRadioStatus.get('phone') & this.apModeRadioStatus.get('bluetooth') & this.apModeRadioStatus.get('wifi');
178 -       var stageController = Mojo.Controller.getAppController().getStageProxy("DeviceMenu");
179                 
180         if (apModeDone && stageController) {
181 -               Mojo.Log.info("SystemUI - Enable / Disable Airplane Mode complete - Updating Device Menu");
182                 this.airplaneModeTriggered = false;
183 -               stageController.delegateToSceneAssistant("updateAirplaneModeSettings");
184         }       
185  },
186  
187 @@ -3215,6 +3279,39 @@
188                         
189  },
190  
191 +getCurrentPhoneState: function() {
192 +       if(this.phoneRadioState) {
193 +               if(this.carrierText.length > 0)
194 +                       return this.carrierText;
195 +               else
196 +                       return 'On';
197 +       }
198 +       else
199 +               return 'Off';
200 +},
201 +
202 +getCurrentDataState: function() {
203 +       if(this.dataConnState) {
204 +               if(this.carrierText.length > 0)
205 +                       return this.carrierText;
206 +               else
207 +                       return 'On';
208 +       }
209 +       else
210 +               return 'Off';
211 +},
212 +
213 +getRoamingDataState: function() {      
214 +       if(this.dataRoamState)
215 +               return 'On';
216 +       else
217 +               return 'Off';
218 +},
219 +
220 +getCurrentGpsState: function() {
221 +       return this.gpsState;
222 +},
223 +
224  getCurrentBluetoothState: function() {
225         return this.bluetoothState;
226  },
227 @@ -4738,6 +4835,8 @@
228         // Telephony Variables
229         phoneType: null,
230         phoneRadioState: null,
231 +       dataConnState: null,
232 +       dataRoamState: null,
233         phoneRadioNotificationSession: null,
234         signalNotificationSession: null,
235         networkNotificationSession: null,
236 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
237 +++ /usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
238 @@ -1,6 +1,10 @@
239  /* Copyright 2009 Palm, Inc.  All rights reserved. */
240  
241 -var RadioState = new Hash({wifi: undefined, bluetooth: undefined});
242 +var ConnState = new Hash({phone: undefined, data: undefined});
243 +
244 +var RoamState = new Hash({phone: undefined, data: undefined});
245 +
246 +var RadioState = new Hash({wifi: undefined, bluetooth: undefined, gps: undefined});
247  
248  var DevicemenuAssistant = Class.create({
249         
250 @@ -20,32 +24,79 @@
251                 spinning: false
252         },
253         
254 +       wifiAPList: [],
255 +       btdeviceList: [],
256 +       
257         initialize: function(barAssistant,btProfileStatus) {
258                 this.barAssistant = barAssistant;
259                 this.btProfileStatus = btProfileStatus; 
260                 //this.barAssistant.setDeviceMenuAssistant(this);
261 +               
262                 this.turningOnBtRadio = false;
263 +
264 +               this.isVisible = true;
265 +               this.isEditing = false;
266 +
267 +               this.prevDrawer = null;
268 +
269 +               this.editItems = new Array();
270 +
271 +               this.quickAction = "LED Flashlight";
272 +               this.hiddenItems = new Array("Device", "Security", "Network");
273 +
274 +               this.menus = ["Device", "Security", "Network", "Phone", "Data", "Wi-Fi", "Bluetooth", "GPS"];
275 +
276 +               this.item_ids = ["dm_device", "dm_security", "dm_network", "dm_phone", "dm_data", "dm_wifi", 
277 +                       "dm_bluetooth", "dm_gps"];
278 +               
279 +               this.menuActions = ["LED Flashlight", "Phone Connection", "Voice Roaming", "Data Connection", 
280 +                       "Data Roaming", "Wi-Fi Connection", "BT Connection", "GPS Connection"];
281         },
282         
283         setup: function() {
284                 
285 -               //Add a touchable row class
286 +               // Add a touchable row class
287                 this.controller.get('palm-device-menu').addClassName('palm-touch-rows-'+Mojo.Environment.DeviceInfo.touchableRows);
288 -                       
289 -               var date = new Date();
290 -               this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '}) +  Mojo.Format.formatDate(date,{date:'long'});
291 -               var msg = $L("Battery: #{batlevel}");
292 -               this.controller.get('dm_battery').innerHTML = new Template(msg).evaluate({"batlevel": Mojo.Format.formatPercent(this.barAssistant.getBatteryLevel())});
293 -                                               
294 -               this.modesModel = {scrollbars: false, mode: "vertical"},
295 -               this.controller.setupWidget('devicescroller', {}, this.modesModel);
296 -               this.menuscroller = this.controller.get('devicescroller');
297 +               
298 +               this.modelScroller = {scrollbars: false, mode: "vertical"},
299 +               this.controller.setupWidget('scroller', {}, this.modelScroller);
300 +               this.menuscroller = this.controller.get('scroller');
301 +
302 +               this.modelFlashlight = {value: false, disabled: false};
303 +
304 +               this.controller.setupWidget("flashlight_toggle", {falseValue: 0, trueValue: 100}, this.modelFlashlight); 
305 +
306 +               this.modelBrightness = {value: 50};
307 +
308 +               this.controller.setupWidget('brightness_slider', {minValue: 0, maxValue: 100}, this.modelBrightness);
309 +
310 +               this.modelVolume = {value: 50};
311 +               
312 +               this.controller.setupWidget('volume_slider', {minValue: 0, maxValue: 100}, this.modelVolume);
313 +               
314 +               this.modelEditItems = {'items': this.editItems};
315 +
316 +               this.controller.setupWidget('edit_items', 
317 +                       {itemTemplate:'devicemenu/listitem-edit'}, 
318 +                       this.modelEditItems);           
319                 
320                 this.drawerModel = {myOpenProperty:false};
321 +               this.controller.setupWidget('devicedetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
322 +               this.controller.setupWidget('securitydetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
323 +               this.controller.setupWidget('networkdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
324 +               this.controller.setupWidget('phonedetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
325 +               this.controller.setupWidget('datadetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
326                 this.controller.setupWidget('wifidetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
327                 this.controller.setupWidget('btdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
328 +               this.controller.setupWidget('gpsdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
329 +               this.devicedrawer = this.controller.get('devicedetails');
330 +               this.securitydrawer = this.controller.get('securitydetails');
331 +               this.networkdrawer = this.controller.get('networkdetails');
332 +               this.phonedrawer = this.controller.get('phonedetails');
333 +               this.datadrawer = this.controller.get('datadetails');
334                 this.wifidrawer = this.controller.get('wifidetails');
335                 this.btdrawer = this.controller.get('btdetails');
336 +               this.gpsdrawer = this.controller.get('gpsdetails');
337                 
338                 this.wifiListModel = {
339                         items: this.wifiAPList
340 @@ -63,74 +114,76 @@
341                                                                         this.btListModel);                                                                      
342                 this.btListWidget = this.controller.get('btlist');
343                 
344 -               //Spinner for WiFi
345 +               // Spinner for WiFi
346                 this.controller.setupWidget('wifiSpinner', this.spinnerAttrs, this.spinnerModel);
347                 
348 -               //Spinner for BT
349 +               // Spinner for BT
350                 this.controller.setupWidget('btSpinner', this.spinnerAttrs, this.btspinnerModel);
351                 
352 -               //Spinner for Airplande Mode
353 -               //this.controller.setupWidget('apSpinner', this.spinnerAttrs, this.apSpinnerModel);             
354 -                       
355 -               if(this.barAssistant.getAirplaneMode())                         
356 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn off Airplane Mode');
357 -               else
358 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn on Airplane Mode');
359 -                       
360 -               var btstate = this.barAssistant.getCurrentBluetoothState();
361 -               if(btstate === 'Off') {
362 -                       this.controller.get('btmsg').innerHTML = $L('Off');
363 -                       RadioState.set('bluetooth',false);
364 -               }                       
365 -               else {
366 -                       RadioState.set('bluetooth',true);
367 -                                       
368 -                       if(btstate === 'On')
369 -                               this.controller.get('btmsg').innerHTML = $L('On');
370 -                       else
371 -                               this.controller.get('btmsg').innerHTML = btstate.escapeHTML();                  
372 -               }                       
373 -                       
374 -               var wifistate = this.barAssistant.getCurrentWiFiState();
375 -               if(wifistate === 'Off') {
376 -                       this.controller.get('wifimsg').innerHTML = $L('Off');
377 -                       RadioState.set('wifi',false);
378 -               }                       
379 -               else {
380 -                       RadioState.set('wifi',true);    
381 -                       if(wifistate === 'On')
382 -                               this.controller.get('wifimsg').innerHTML = $L('On');
383 -                       else
384 -                               this.controller.get('wifimsg').innerHTML = wifistate.escapeHTML();                      
385 -               }               
386 -               this.controller.listen(this.controller.document, Mojo.Event.deactivate, this.close.bindAsEventListener(this));
387 -               this.isVisible = true;
388 -               
389 -               //Hide WiFi Menu if WiFi is not present.
390 +               // Hide WiFi Menu if WiFi is not present
391                 if(!Mojo.Environment.DeviceInfo.wifiAvailable) {
392                         this.controller.get('dm_wifi').hide();
393                         this.controller.hideWidgetContainer(this.controller.get('dm_wifi'));
394                 }
395                 
396 -               //set up the the menu div
397 +               // Set up the the menu div
398                 this.scrim = this.controller.sceneElement.querySelector('div[x-mojo-scrim]');
399                 this.systemmenu = this.controller.sceneElement.querySelector('div[x-mojo-dialog]');
400                 this.scrim.style.opacity = 0;
401                 this.systemmenuTop = this.systemmenu.offsetTop;
402                 this.systemmenu.style.top = (-1 * this.systemmenu.offsetHeight) + 'px';                                 
403 +
404 +               this.controller.listen(this.controller.document, Mojo.Event.deactivate, this.close.bindAsEventListener(this));
405 +               
406 +               // Load preferences for the menu
407 +               this.getPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
408 +                       method: 'getPreferences', parameters: {subscribe: false, keys: ['deviceMenuCfg']},
409 +                       onSuccess: this.handlePreferences.bind(this) });
410         },
411         
412         activate: function() {
413 -               this.controller.get('dm_airplanemode').addEventListener(Mojo.Event.tap, this.toggleAirplaneMode.bindAsEventListener(this));
414 +               this.controller.get('menu_action').addEventListener(Mojo.Event.tap, this.handleActionTap.bindAsEventListener(this));
415 +               this.controller.get('edit_items').addEventListener(Mojo.Event.listTap, this.handleItemTap.bindAsEventListener(this));
416 +
417 +               this.controller.get('dm_device').addEventListener(Mojo.Event.tap, this.toggleDeviceList.bindAsEventListener(this));
418 +               this.controller.get('volume_toggle').addEventListener(Mojo.Event.tap, this.handleVolumeToggle.bindAsEventListener(this));                                               
419 +               this.controller.get('flashlight_toggle').addEventListener(Mojo.Event.propertyChange, this.handleFlashlightToggle.bindAsEventListener(this));
420 +               this.controller.get('brightness_slider').addEventListener(Mojo.Event.propertyChange, this.handleBrightnessSlider.bindAsEventListener(this));
421 +               this.controller.get('volume_slider').addEventListener(Mojo.Event.propertyChange, this.handleVolumeSlider.bindAsEventListener(this));
422 +
423 +               this.controller.get('dm_security').addEventListener(Mojo.Event.tap, this.toggleSecurityList.bindAsEventListener(this));
424 +               this.controller.get('security_none').addEventListener(Mojo.Event.tap, this.changeSecurityState.bindAsEventListener(this));
425 +               this.controller.get('security_pin').addEventListener(Mojo.Event.tap, this.changeSecurityState.bindAsEventListener(this));
426 +               this.controller.get('security_pw').addEventListener(Mojo.Event.tap, this.changeSecurityState.bindAsEventListener(this));
427 +
428 +               this.controller.get('dm_network').addEventListener(Mojo.Event.tap, this.toggleNetworkList.bindAsEventListener(this));
429 +               this.controller.get('network_2g').addEventListener(Mojo.Event.tap, this.changeNetworkState.bindAsEventListener(this));
430 +               this.controller.get('network_3g').addEventListener(Mojo.Event.tap, this.changeNetworkState.bindAsEventListener(this));
431 +               this.controller.get('network_auto').addEventListener(Mojo.Event.tap, this.changeNetworkState.bindAsEventListener(this));
432 +               
433 +               this.controller.get('dm_phone').addEventListener(Mojo.Event.tap, this.togglePhoneList.bindAsEventListener(this));
434 +               this.controller.get('phone_conn').addEventListener(Mojo.Event.tap, this.togglePhoneConn.bindAsEventListener(this));
435 +               this.controller.get('phone_roam').addEventListener(Mojo.Event.tap, this.togglePhoneRoam.bindAsEventListener(this));
436 +               this.controller.get('phone_pref').addEventListener(Mojo.Event.tap,this.handlePhoneLaunch.bindAsEventListener(this));
437 +
438 +               this.controller.get('dm_data').addEventListener(Mojo.Event.tap, this.toggleDataList.bindAsEventListener(this));
439 +               this.controller.get('data_conn').addEventListener(Mojo.Event.tap, this.toggleDataConn.bindAsEventListener(this));
440 +               this.controller.get('data_roam').addEventListener(Mojo.Event.tap, this.toggleDataRoam.bindAsEventListener(this));
441 +               this.controller.get('data_pref').addEventListener(Mojo.Event.tap,this.handlePhoneLaunch.bindAsEventListener(this));
442 +                                               
443                 this.controller.get('wifilist').addEventListener(Mojo.Event.listTap,this.handleWiFiTap.bindAsEventListener(this));
444                 this.controller.get('btlist').addEventListener(Mojo.Event.listTap,this.handleBTTap.bindAsEventListener(this));          
445                 this.controller.get('dm_wifi').addEventListener(Mojo.Event.tap, this.togglewifiList.bindAsEventListener(this));
446                 this.controller.get('dm_bluetooth').addEventListener(Mojo.Event.tap, this.togglebluetoothList.bindAsEventListener(this));
447 +               this.controller.get('dm_gps').addEventListener(Mojo.Event.tap, this.toggleGpsList.bindAsEventListener(this));
448                 this.controller.get('wifi_radio').addEventListener(Mojo.Event.tap, this.toggleWifiRadio.bindAsEventListener(this));
449                 this.controller.get('bt_radio').addEventListener(Mojo.Event.tap, this.toggleBTRadio.bindAsEventListener(this));
450 -               this.controller.get('bt_pref').addEventListener(Mojo.Event.tap,this.handleBluetoothLaunch.bindAsEventListener(this));
451 +               this.controller.get('gps_radio').addEventListener(Mojo.Event.tap, this.toggleGpsRadio.bindAsEventListener(this));
452                 this.controller.get('wifi_pref').addEventListener(Mojo.Event.tap,this.handleWiFiLaunch.bindAsEventListener(this));
453 +               this.controller.get('bt_pref').addEventListener(Mojo.Event.tap,this.handleBluetoothLaunch.bindAsEventListener(this));
454 +               this.controller.get('gps_pref').addEventListener(Mojo.Event.tap,this.handleGpsLaunch.bindAsEventListener(this));
455                 this.controller.get('scrim').addEventListener(Mojo.Event.tap, this.toggleDeviceMenu.bindAsEventListener(this));
456 +               
457                 //Close the App because this is a first launch.
458                 this.toggleDeviceMenu();                                                
459         },      
460 @@ -138,64 +191,791 @@
461         cleanup: function() {
462                 Mojo.Log.error("Device Menu - Clean up called");                                
463         },      
464 -                       
465 -       wifiAPList: [],
466 -       btdeviceList: [],
467 +
468 +       savePreferences: function() {
469 +               this.hiddenItems.clear();
470 +       
471 +               for(var i = 0; i < this.editItems.length ; i++) {
472 +                       if(this.editItems[i].label == "hide")
473 +                               this.hiddenItems.push(this.editItems[i].title);
474 +               }
475 +       
476 +               if(this.setPreferencesRequest)
477 +                       this.setPreferencesRequest.cancel();
478 +       
479 +               this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
480 +                       method: 'setPreferences', parameters: {'deviceMenuCfg': {hidden: this.hiddenItems, action: this.quickAction}} });
481 +       },
482 +       
483 +
484 +       handlePreferences: function(payload) {
485 +               if(payload != undefined) {
486 +                       if(payload.deviceMenuCfg != undefined) {
487 +                               this.hiddenItems = payload.deviceMenuCfg.hidden;
488 +                               this.quickAction = payload.deviceMenuCfg.action;
489 +                       }
490 +               }
491 +       },
492 +       
493 +       handleActionTap: function(event) {
494 +               if(this.isEditing) {
495 +                       if((event.up) && ( event.up.altKey || event.up.metaKey))
496 +                               this.menuActions.reverse();
497 +
498 +                       for(var i = 0; i < this.menuActions.length; i++) {
499 +                               if(this.menuActions[i] == this.quickAction) {
500 +                                       if((i+1) < this.menuActions.length)
501 +                                               this.quickAction = this.menuActions[i+1];
502 +                                       else
503 +                                               this.quickAction = this.menuActions[0];
504 +                                               
505 +                                       break;
506 +                               }
507 +                       }
508 +
509 +                       if((event.up) && ( event.up.altKey || event.up.metaKey))
510 +                               this.menuActions.reverse();
511                 
512 -       /*
513 -        * Toggles the AirplaneMode.
514 -        * 
515 -        * When Airplane Mode is enabled, it turns off the Phone. Also, it saves the current state of Bluetooth and WiFi and turn them off. 
516 -        * The Airplan Mode setting gets stored in the System Preferences.
517 -        */      
518 +                       this.controller.get('menu_action').innerHTML = $L("Toggle " + this.quickAction);
519 +
520 +                       this.savePreferences();
521 +               }
522 +               else {
523 +                       if(this.quickAction == "LED Flashlight")
524 +                               this.toggleFlashlightLed();
525 +                       else if(this.quickAction == "Phone Connection")
526 +                               this.togglePhoneConn(event);
527 +                       else if(this.quickAction == "Voice Roaming")
528 +                               this.togglePhoneRoam(event);
529 +                       else if(this.quickAction == "Data Connection")
530 +                               this.toggleDataConn(event);
531 +                       else if(this.quickAction == "Data Roaming") 
532 +                               this.toggleDataRoam(event);
533 +                       else if(this.quickAction == "Wi-Fi Connection") 
534 +                               this.toggleWifiRadio(event);
535 +                       else if(this.quickAction == "BT Connection") 
536 +                               this.toggleBTRadio(event);
537 +                       else if(this.quickAction == "GPS Connection")
538 +                               this.toggleGpsRadio(event);
539 +               }
540 +       },
541         
542 -       toggleAirplaneMode: function() {
543 +       handleItemTap: function(event) {
544 +               if(this.isEditing) {
545 +                       var index = this.modelEditItems.items.indexOf(event.item);
546                 
547 -               //Ignore the tap event if Airplane Mode is in Progress
548 -               if(this.apModeInProgress)
549 -                       return;
550 +                       if(this.modelEditItems.items[index].label == "hide")
551 +                               this.modelEditItems.items[index].label = "show";
552 +                       else
553 +                               this.modelEditItems.items[index].label = "hide";
554 +               
555 +                       this.controller.modelChanged(this.modelEditItems, this);
556 +               
557 +                       this.savePreferences();
558 +               }
559 +       },
560 +
561 +       toggleDeviceList: function(event) {     
562 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
563 +                       this.toggleFlashlightLed();
564 +               else {
565 +                       if(this.devicedrawer.mojo.getOpenState()) {
566 +                               this.prevDrawer = null;
567 +               
568 +                               this.controller.hideWidgetContainer(this.controller.get('devicedetails'));
569 +                       }
570 +                       else {
571 +                               if(this.prevDrawer)
572 +                                       this.prevDrawer.mojo.setOpenState(false);
573 +               
574 +                               this.prevDrawer = this.devicedrawer;
575 +               
576 +                               this.controller.showWidgetContainer(this.controller.get('devicedetails'));      
577 +                       }
578 +       
579 +                       this.devicedrawer.mojo.setOpenState(!this.devicedrawer.mojo.getOpenState());                                            
580 +               }
581 +       },
582 +       
583 +       toggleFlashlightLed: function() {
584 +               if(this.modelFlashlight.value == 0)
585 +                       this.modelFlashlight.value = 100;
586 +               else
587 +                       this.modelFlashlight.value = 0;
588 +               
589 +               this.controller.serviceRequest('palm://ca.canucksoftware.systoolsmgr', {
590 +                       method: 'flashOn', parameters: {value: this.modelFlashlight.value}
591 +               });
592 +               
593 +               this.toggleDeviceMenu.bind(this).delay(0.2);
594 +       },
595 +       
596 +       handleFlashlightToggle: function(event) {
597 +               // BUG in toggle button widget!
598 +       
599 +               if(this.modelFlashlight.value == false)
600 +                       this.modelFlashlight.value = 0;
601 +       
602 +               this.controller.serviceRequest('palm://ca.canucksoftware.systoolsmgr', {
603 +                       method: 'flashOn', parameters: {value: this.modelFlashlight.value}
604 +               });
605 +       },
606 +       
607 +       handleBrightnessSlider: function(event) {
608 +               this.controller.serviceRequest('palm://com.palm.display/control', {
609 +                       method: 'setProperty', parameters:{maximumBrightness: Math.round(event.value)}
610 +               });
611                 
612 -               //this.apSpinnerModel.spinning = true;
613 -               //this.controller.modelChanged(this.apSpinnerModel);    
614 +               this.controller.get('dm_brightness').innerHTML = Math.round(event.value);
615 +       },
616 +       
617 +       handleVolumeSlider: function(event) {
618 +               if(this.controller.get('volume_toggle').innerHTML == "System Volume")
619 +                       var service = "system";
620 +               else if(this.controller.get('volume_toggle').innerHTML == "Media Volume")
621 +                       var service = "media";
622 +               else
623 +                       var service = "ringtone";
624 +
625 +               this.controller.serviceRequest('palm://com.palm.audio/' + service, {
626 +                       method: 'setVolume', parameters:{volume: Math.round(event.value)}
627 +               });
628 +               
629 +               this.controller.get('dm_volume').innerHTML = Math.round(event.value);
630 +       },
631 +       
632 +       handleVolumeToggle: function(event) {
633 +               if(this.controller.get('volume_toggle').innerHTML == "Ringtone Volume")
634 +                       this.controller.get('volume_toggle').innerHTML = "System Volume";
635 +               else if(this.controller.get('volume_toggle').innerHTML == "System Volume")
636 +                       this.controller.get('volume_toggle').innerHTML = "Media Volume";
637 +               else
638 +                       this.controller.get('volume_toggle').innerHTML = "Ringtone Volume";
639 +
640 +               this.updateVolumeState();
641 +       },
642 +       
643 +       updateFlashState: function() {
644 +               this.controller.serviceRequest('palm://ca.canucksoftware.systoolsmgr', {
645 +                       method: 'flashState',
646 +                       parameters: {},
647 +                       onSuccess: function(response) {
648 +                               this.modelFlashlight.value = response.value;
649                                 
650 -               if(this.barAssistant.getAirplaneMode()) {
651 -                       Mojo.Log.info("SystemUI - Turning off Airplane Mode - Device Menu");
652 -                       this.barAssistant.setAirplaneMode(false);
653 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turning off Airplane Mode');                      
654 -               }                       
655 +                               if(this.quickAction == "LED Flashlight") {
656 +                                       if(this.modelFlashlight.value == 0)
657 +                                               this.controller.get('menu_action').innerHTML = $L('Turn on LED Flashlight');
658 +                                       else
659 +                                               this.controller.get('menu_action').innerHTML = $L('Turn off LED Flashlight');
660 +                               }
661 +                               this.controller.modelChanged(this.modelFlashlight, this);
662 +                       }.bind(this),
663 +               });
664 +       },
665 +       
666 +       updateScreenState: function() {
667 +               this.controller.serviceRequest('palm://com.palm.display/control', {
668 +                       method: 'getProperty',
669 +                       parameters:{properties:['maximumBrightness']},
670 +                       onSuccess: function(response) {
671 +                               if(response.maximumBrightness != undefined) {
672 +                                       this.modelBrightness.value = parseInt(response.maximumBrightness);
673 +                                       this.controller.modelChanged(this.modelBrightness);
674 +
675 +                                       this.controller.get('dm_brightness').innerHTML = response.maximumBrightness;
676 +                               } else {
677 +                                       this.controller.get('dm_brightness').innerHTML = "??";
678 +                               }
679 +                       }.bind(this)
680 +               });
681 +       },
682 +       
683 +       updateVolumeState: function() {
684 +               if(this.controller.get('volume_toggle').innerHTML == "System Volume")
685 +                       var service = "system";
686 +               else if(this.controller.get('volume_toggle').innerHTML == "Media Volume")
687 +                       var service = "media";
688 +               else
689 +                       var service = "ringtone";
690 +
691 +               this.controller.serviceRequest('palm://com.palm.audio/' + service, {
692 +                       method: 'getVolume',
693 +                       parameters:{},
694 +                       onSuccess: function(response) {
695 +                               if(response.volume != undefined) {
696 +                                       this.modelVolume.value = parseInt(response.volume);
697 +                                       this.controller.modelChanged(this.modelVolume);
698 +       
699 +                                       this.controller.get('dm_volume').innerHTML = response.volume;
700 +                               } else {
701 +                                       this.controller.get('dm_volume').innerHTML = "??";
702 +                               }
703 +                       }.bind(this)
704 +               });
705 +       },
706 +
707 +       toggleSecurityList: function(event) {
708 +               if((event.up) && ( event.up.altKey || event.up.metaKey)) {
709 +                       this.serviceRequest = new Mojo.Service.Request('palm://com.palm.applicationManager', {
710 +                               method: 'open',
711 +                               parameters: {'id': 'com.palm.app.screenlock','params':{mode: "none"}}
712 +                       });
713 +               }
714                 else {
715 -                       Mojo.Log.info("SystemUI - Turning on Airplane Mode - Device Menu");
716 -                       this.barAssistant.setAirplaneMode(true);
717 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turning on Airplane Mode');
718 +                       if(this.securitydrawer.mojo.getOpenState()) {
719 +                               this.prevDrawer = null;
720 +               
721 +                               this.controller.hideWidgetContainer(this.controller.get('securitydetails'));
722 +                       }
723 +                       else {
724 +                               if(this.prevDrawer)
725 +                                       this.prevDrawer.mojo.setOpenState(false);
726 +               
727 +                               this.prevDrawer = this.securitydrawer;
728 +               
729 +                               this.controller.showWidgetContainer(this.controller.get('securitydetails'));    
730 +                       }
731 +       
732 +                       this.securitydrawer.mojo.setOpenState(!this.securitydrawer.mojo.getOpenState());                                                
733                 }
734 -               this.apModeInProgress = true;
735 +       },
736 +
737 +       changeSecurityState: function(event) {
738 +               if(event.target.id == "security_pin")
739 +                       var security = "pin";
740 +               else if(event.target.id == "security_pw")
741 +                       var security = "password";                      
742 +               else 
743 +                       var security = "none";
744 +               
745 +               this.serviceRequest = new Mojo.Service.Request('palm://com.palm.applicationManager', {
746 +                       method: 'open',
747 +                       parameters: {'id': 'com.palm.app.screenlock','params':{mode: security}}
748 +               });
749 +       },
750 +       
751 +       updateSecurityState: function() {
752 +               this.controller.serviceRequest('palm://com.palm.systemmanager/', {
753 +                       method: "getDeviceLockMode", 
754 +                       onComplete: function(response) {
755 +                               if(response && response.lockMode) {
756 +                                       if(response.lockMode === 'pin')
757 +                                               this.controller.get('securitymsg').innerHTML = $L('PIN');
758 +                                       else if(response.lockMode === 'password')
759 +                                               this.controller.get('securitymsg').innerHTML = $L('PW');
760 +                                       else
761 +                                               this.controller.get('securitymsg').innerHTML = $L('None');
762 +                               }
763 +                       }.bind(this)
764 +               });
765 +       },
766 +
767 +       toggleNetworkList: function(event) {    
768 +               if((event.up) && ( event.up.altKey || event.up.metaKey)) {
769 +                       this.controller.serviceRequest('palm://com.palm.telephony/', {
770 +                               method: "ratSet", parameters: {"mode": "automatic"}
771 +                       });
772 +               }
773 +               else {
774 +                       if(this.networkdrawer.mojo.getOpenState()) {
775 +                               this.prevDrawer = null;
776 +               
777 +                               this.controller.hideWidgetContainer(this.controller.get('networkdetails'));
778 +                       }
779 +                       else {
780 +                               if(this.prevDrawer)
781 +                                       this.prevDrawer.mojo.setOpenState(false);
782 +               
783 +                               this.prevDrawer = this.networkdrawer;
784 +               
785 +                               this.controller.showWidgetContainer(this.controller.get('networkdetails'));     
786 +                       }
787 +       
788 +                       this.networkdrawer.mojo.setOpenState(!this.networkdrawer.mojo.getOpenState());                                          
789 +               }
790 +       },
791 +
792 +       changeNetworkState: function(event) {
793 +               if(event.target.id == "network_2g")
794 +                       var network = "gsm";
795 +               else if(event.target.id == "network_3g") 
796 +                       var network = "umts";
797 +               else
798 +                       var network = "automatic";
799 +
800 +               this.controller.serviceRequest('palm://com.palm.telephony/', {
801 +                       method: "ratSet", parameters: {"mode": network}
802 +               });
803 +               
804 +               this.toggleDeviceMenu.bind(this).delay(0.2);
805 +       },
806 +       
807 +       updateNetworkState: function() {
808 +               this.controller.serviceRequest('palm://com.palm.telephony/', {
809 +                       method: "ratQuery", 
810 +                       onComplete: function(response) {
811 +                               if(response && response.extended && response.extended.mode) {
812 +                                       if(response.extended.mode === 'gsm')
813 +                                               this.controller.get('networkmsg').innerHTML = $L('2G');
814 +                                       else if(response.extended.mode === 'umts')
815 +                                               this.controller.get('networkmsg').innerHTML = $L('3G');
816 +                                       else
817 +                                               this.controller.get('networkmsg').innerHTML = $L('Auto');
818 +                               }
819 +                       }.bind(this)
820 +               });
821 +       },
822 +       
823 +       togglePhoneList: function(event) {      
824 +               //Ignore the tap event if Airplane Mode is on
825 +               if(this.barAssistant.getAirplaneMode())
826 +                       return;
827 +
828 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
829 +                       this.togglePhoneConn(event);
830 +               else {
831 +                       if(this.phonedrawer.mojo.getOpenState()) {
832 +                               this.prevDrawer = null;
833 +               
834 +                               this.controller.hideWidgetContainer(this.controller.get('phonedetails'));
835 +                       }
836 +                       else {
837 +                               if(this.prevDrawer)
838 +                                       this.prevDrawer.mojo.setOpenState(false);
839 +               
840 +                               this.prevDrawer = this.phonedrawer;
841 +               
842 +                               this.controller.showWidgetContainer(this.controller.get('phonedetails'));       
843 +                       }
844 +       
845 +                       this.phonedrawer.mojo.setOpenState(!this.phonedrawer.mojo.getOpenState());                                              
846 +               }
847 +       },
848 +       
849 +       togglePhoneConn: function(event) {
850 +               if(ConnState.get('phone'))
851 +                       TelephonyService.tempPowerSet('off',false,null,null);
852 +               else
853 +                       TelephonyService.tempPowerSet('on',false,null,null);
854 +
855 +               this.toggleDeviceMenu.bind(this).delay(0.2);            
856 +       },
857 +       
858 +       togglePhoneRoam: function(event) {
859 +               var roamstate = RoamState.get('phone');
860 +
861 +               if((event.up) && ( event.up.altKey || event.up.metaKey)) {      
862 +                       if(roamstate === 'any')
863 +                               var state = 'roamonly';
864 +                       else
865 +                               var state = 'any';
866 +               }
867 +               else {
868 +                       if(roamstate === 'any')
869 +                               var state = 'homeonly';
870 +                       else
871 +                               var state = 'any';
872 +               }
873 +
874 +               this.controller.serviceRequest('palm://com.palm.telephony', {
875 +                       method: 'roamModeSet', 
876 +                       parameters: {mode: state, client: Mojo.appName}
877 +               });
878 +
879                 this.toggleDeviceMenu.bind(this).delay(0.2);            
880         },
881         
882 -       updateAirplaneModeSettings: function() {
883 +       handlePhoneLaunch: function(event) {
884 +               this.launchPhonePrefs.bind(this).delay(0.2);
885 +       },
886 +
887 +       launchPhonePrefs: function(toggleMenu) {
888 +               this.serviceRequest = new Mojo.Service.Request('palm://com.palm.applicationManager', {
889 +                       method: 'open',
890 +                       parameters: {'id': 'com.palm.app.phoneprefs','params':{}}
891 +               });
892 +
893 +               this.toggleDeviceMenu();
894 +       },
895 +       
896 +       updatePhoneState: function() {
897 +               var phonestate = this.barAssistant.getCurrentPhoneState();
898 +
899 +               if(phonestate === 'Off') {
900 +                       ConnState.set('phone', false);
901 +
902 +                       this.controller.get('phonemsg').innerHTML = $L('Off');
903 +
904 +                       this.controller.get('phone_conn').innerHTML = $L('Turn on Phone');                                      
905 +
906 +                       if(this.quickAction == "Phone Connection")
907 +                               this.controller.get('menu_action').innerHTML = $L('Turn on Phone Connection');
908 +               }
909 +               else {
910 +                       ConnState.set('phone', true);
911 +
912 +                       if(phonestate === 'On')
913 +                               this.controller.get('phonemsg').innerHTML = $L('On');
914 +                       else
915 +                               this.controller.get('phonemsg').innerHTML = phonestate.escapeHTML();
916 +
917 +                       this.controller.get('phone_conn').innerHTML = $L('Turn off Phone');                                     
918 +
919 +                       if(this.quickAction == "Phone Connection")
920 +                               this.controller.get('menu_action').innerHTML = "Turn off Phone Connection";
921 +               }
922 +               
923 +               this.controller.get('phone_roam').innerHTML = 'Roaming Enabled';
924 +               
925 +               this.controller.serviceRequest('palm://com.palm.telephony/', {
926 +                       method: 'roamModeQuery', parameters: {},
927 +                       onSuccess: function(response) {
928 +                               RoamState.set('phone', response.extended.mode);
929 +
930 +                               var roamstate = RoamState.get('phone');
931 +
932 +                               if(roamstate=='roamonly') {
933 +                                       this.controller.get('phone_roam').innerHTML = 'Roaming Forced';
934 +                                       
935 +                                       if(this.quickAction == "Voice Roaming")
936 +                                               this.controller.get('menu_action').innerHTML = "Enable Voice Roaming";
937 +                               }
938 +                               else if (roamstate=="homeonly") {
939 +                                       this.controller.get('phone_roam').innerHTML = 'Roaming Disabled';
940 +                                       
941 +                                       if(this.quickAction == "Voice Roaming")
942 +                                               this.controller.get('menu_action').innerHTML = "Enable Voice Roaming";
943 +                               }
944 +                               else {
945 +                                       this.controller.get('phone_roam').innerHTML = 'Roaming Enabled';
946 +                                       
947 +                                       if(this.quickAction == "Voice Roaming")
948 +                                               this.controller.get('menu_action').innerHTML = "Disable Voice Roaming";
949 +                               }
950 +                       }.bind(this)
951 +               });
952 +       },
953 +       
954 +       toggleDataList: function(event) {       
955 +               //Ignore the tap event if Airplane Mode is on
956 +               if(this.barAssistant.getAirplaneMode())
957 +                       return;
958 +
959 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
960 +                       this.toggleDataConn(event);
961 +               else {
962 +                       if(this.datadrawer.mojo.getOpenState()) {
963 +                               this.prevDrawer = null;
964                 
965 -               //this.apSpinnerModel.spinning = false;
966 -               //this.controller.modelChanged(this.apSpinnerModel);
967 +                               this.controller.hideWidgetContainer(this.controller.get('datadetails'));
968 +                       }
969 +                       else {
970 +                               if(this.prevDrawer)
971 +                                       this.prevDrawer.mojo.setOpenState(false);
972 +               
973 +                               this.prevDrawer = this.datadrawer;
974                 
975 -               if(this.barAssistant.getAirplaneMode()) {
976 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn off Airplane Mode');                 
977 +                               this.controller.showWidgetContainer(this.controller.get('datadetails'));        
978 +                       }
979 +       
980 +                       this.datadrawer.mojo.setOpenState(!this.datadrawer.mojo.getOpenState());                                                
981 +               }
982 +       },
983 +       
984 +       toggleDataConn: function(event) {
985 +               if(ConnState.get('data'))
986 +                       var state = "on";
987 +               else
988 +                       var state = "off";
989 +                       
990 +               this.controller.serviceRequest('palm://com.palm.wan/', {
991 +                       method: 'set', parameters: {disablewan: state}
992 +               });
993 +
994 +               this.toggleDeviceMenu.bind(this).delay(0.2);            
995 +       },
996 +       
997 +       toggleDataRoam: function(event) {
998 +               var roamstate = RoamState.get('data');
999 +
1000 +               if(roamstate === true)
1001 +                       var state = "enable";
1002 +               else
1003 +                       var state = "disable";
1004 +               
1005 +               this.controller.serviceRequest('palm://com.palm.wan/', {
1006 +                       method: 'set',
1007 +                       parameters: {roamguard: state},
1008 +               });
1009 +
1010 +               this.toggleDeviceMenu.bind(this).delay(0.2);            
1011 +       },
1012 +       
1013 +       updateDataState: function() {
1014 +               var datastate = this.barAssistant.getCurrentDataState();
1015 +               
1016 +               if(datastate === 'Off') {
1017 +                       ConnState.set('data', false);
1018 +
1019 +                       this.controller.get('datamsg').innerHTML = $L('Off');
1020 +
1021 +                       this.controller.get('data_conn').innerHTML = $L('Turn on Data');                                        
1022 +
1023 +                       if(this.quickAction == "Data Connection")
1024 +                               this.controller.get('menu_action').innerHTML = $L('Turn on Data Connection');
1025 +               }
1026 +               else {
1027 +                       ConnState.set('data', true);
1028 +
1029 +                       if(datastate === 'On')
1030 +                               this.controller.get('datamsg').innerHTML = $L('On');
1031 +                       else
1032 +                               this.controller.get('datamsg').innerHTML = datastate.escapeHTML();
1033 +
1034 +                       this.controller.get('data_conn').innerHTML = $L('Turn off Data');                                       
1035 +
1036 +                       if(this.quickAction == "Data Connection")
1037 +                               this.controller.get('menu_action').innerHTML = "Turn off Data Connection";
1038 +               }
1039 +
1040 +               var roamstate = this.barAssistant.getRoamingDataState();
1041 +               
1042 +               if(roamstate === 'Off') {
1043 +                       RoamState.set('data', false);
1044 +                       
1045 +                       this.controller.get('data_roam').innerHTML = $L('Roaming Disabled');
1046 +                       
1047 +                       if(this.quickAction == "Data Roaming")
1048 +                               this.controller.get('menu_action').innerHTML = "Enable Data Roaming";
1049 +               }
1050 +               else {
1051 +                       RoamState.set('data', true);
1052 +
1053 +                       this.controller.get('data_roam').innerHTML = $L('Roaming Enabled');
1054 +
1055 +                       if(this.quickAction == "Data Roaming")
1056 +                               this.controller.get('menu_action').innerHTML = "Disable Data Roaming";
1057 +               }
1058 +       },
1059 +       
1060 +       updateWiFiState: function() {
1061 +               var wifistate = this.barAssistant.getCurrentWiFiState();
1062 +               
1063 +               if(wifistate === 'Off') {
1064 +                       RadioState.set('wifi',false);
1065 +
1066 +                       this.controller.get('wifimsg').innerHTML = $L('Off');
1067 +
1068 +                       if(this.quickAction == "Wi-Fi Connection")
1069 +                               this.controller.get('menu_action').innerHTML = "Turn on Wi-Fi Connection";
1070                 }                       
1071 -               else {                  
1072 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn on Airplane Mode');
1073 +               else {
1074 +                       RadioState.set('wifi',true);
1075 +                       
1076 +                       if(wifistate === 'On')
1077 +                               this.controller.get('wifimsg').innerHTML = $L('On');
1078 +                       else
1079 +                               this.controller.get('wifimsg').innerHTML = wifistate.escapeHTML();                      
1080 +
1081 +                       if(this.quickAction == "Wi-Fi Connection")
1082 +                               this.controller.get('menu_action').innerHTML = "Turn off Wi-Fi Connection";
1083 +               }
1084 +       },
1085 +       
1086 +       updateBTState: function() {
1087 +               var btstate = this.barAssistant.getCurrentBluetoothState();
1088 +               
1089 +               if(btstate === 'Off') {
1090 +                       RadioState.set('bluetooth',false);
1091 +
1092 +                       this.controller.get('btmsg').innerHTML = $L('Off');
1093 +
1094 +                       if(this.quickAction == "BT Connection")
1095 +                               this.controller.get('menu_action').innerHTML = "Turn on BT Connection";
1096 +               }                       
1097 +               else {
1098 +                       RadioState.set('bluetooth',true);
1099 +                                       
1100 +                       if(btstate === 'On')
1101 +                               this.controller.get('btmsg').innerHTML = $L('On');
1102 +                       else
1103 +                               this.controller.get('btmsg').innerHTML = btstate.escapeHTML();                  
1104 +
1105 +                       if(this.quickAction == "BT Connection")
1106 +                               this.controller.get('menu_action').innerHTML = "Turn off BT Connection";
1107 +               }                       
1108 +               
1109 +               if(this.turningOnBtRadio) {
1110 +                       this.btspinnerModel.spinning = true;
1111 +                       this.controller.modelChanged(this.btspinnerModel);
1112                 }
1113 -               this.apModeInProgress = false;
1114         },
1115         
1116 -       updateAirplaneModeProgress: function() {
1117 -               if(this.barAssistant.getAirplaneMode()) {
1118 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turning on Airplane Mode');
1119 +       updateGPSState: function() {
1120 +               var gpsstate = this.barAssistant.getCurrentGpsState();
1121 +               
1122 +               if(gpsstate === 'Off') {
1123 +                       RadioState.set('gps',false);
1124 +                       
1125 +                       this.controller.get('gpsmsg').innerHTML = $L('Off');
1126 +
1127 +                       if(this.quickAction == "GPS Connection")
1128 +                               this.controller.get('menu_action').innerHTML = "Turn on GPS Connection";
1129                 }                       
1130                 else {
1131 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turning off Airplane Mode');
1132 +                       RadioState.set('gps',true);
1133 +                                       
1134 +                       if(gpsstate === 'On')
1135 +                               this.controller.get('gpsmsg').innerHTML = $L('On');
1136 +                       else
1137 +                               this.controller.get('gpsmsg').innerHTML = gpsstate.escapeHTML();        
1138 +               
1139 +                       if(this.quickAction == "GPS Connection")
1140 +                               this.controller.get('menu_action').innerHTML = "Turn off GPS Connection";
1141                 }
1142 -               this.apModeInProgress = true;
1143         },
1144         
1145 +       updateMenuItems: function() {
1146 +               var msg = $L("Battery: #{batlevel}, #{batstate}");
1147 +               
1148 +               this.controller.get('menu_header').innerHTML = new Template(msg).evaluate({"batlevel": Mojo.Format.formatPercent(this.barAssistant.getBatteryLevel()), "batstate": this.barAssistant.getBatteryState()});
1149 +       
1150 +               for(var i = 0; i < this.menus.length; i++) {
1151 +                       if(this.hiddenItems.indexOf(this.menus[i]) == -1)
1152 +                               this.controller.get(this.item_ids[i]).show();
1153 +                       else 
1154 +                               this.controller.get(this.item_ids[i]).hide();
1155 +               }
1156 +               
1157 +               this.controller.modelChanged(this.modelScroller, this);
1158 +       
1159 +               var temp = this.barAssistant.getBatteryTemp();
1160 +
1161 +               this.controller.get("devicemsg").innerHTML = temp + "&deg;C";
1162 +
1163 +               this.updateFlashState();
1164 +               this.updateScreenState();
1165 +               this.updateVolumeState();
1166 +
1167 +               this.updateSecurityState();
1168 +
1169 +               this.updateNetworkState();
1170 +                                               
1171 +               this.updatePhoneState();
1172 +
1173 +               this.updateDataState();
1174 +               
1175 +               this.updateWiFiState();
1176 +               
1177 +               this.updateBTState();
1178 +               
1179 +               this.updateGPSState();
1180 +       },
1181 +       
1182 +       updateEditItems: function() {
1183 +               this.controller.get('menu_header').innerHTML = "Menu Content Settings";
1184 +               
1185 +               this.controller.get('menu_action').innerHTML = $L("Toggle " + this.quickAction);
1186 +
1187 +               this.editItems.clear();
1188 +
1189 +               for(var i = 0; i < this.menus.length; i++) {
1190 +                       if(this.hiddenItems.indexOf(this.menus[i]) == -1)
1191 +                               this.editItems.push({title: this.menus[i], label: "show"});
1192 +                       else
1193 +                               this.editItems.push({title: this.menus[i], label: "hide"});
1194 +               }
1195 +               
1196 +               this.controller.modelChanged(this.modelEditItems, this);
1197 +       },
1198 +       
1199 +       toggleGpsRadio: function(event) {
1200 +               if(RadioState.get('gps')) {
1201 +                       this.controller.serviceRequest('palm://com.palm.location/', {
1202 +                               method: 'setUseGps',
1203 +                               parameters: {useGps: false}});
1204 +                       this.updateGps('Off');
1205 +               }                       
1206 +               else {
1207 +                       this.controller.serviceRequest('palm://com.palm.location/', {
1208 +                               method: 'setUseGps',
1209 +                               parameters: {useGps: true}});
1210 +                       this.updateGps('On');
1211 +               }
1212 +
1213 +               this.toggleDeviceMenu.bind(this).delay(0.2);            
1214 +       },
1215 +       
1216 +       /*
1217 +        * Toggles the GPS List to show and hide when tapping on the GPS Row.
1218 +        */
1219 +
1220 +       toggleGpsList: function(event) {
1221 +               
1222 +               //Ignore the tap event if Airplane Mode is on
1223 +               if(this.barAssistant.getAirplaneMode())
1224 +                       return;
1225 +
1226 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
1227 +                       this.toggleGpsRadio(event);
1228 +               else {                          
1229 +                       if (this.gpsdrawer.mojo.getOpenState()) {                       
1230 +                               this.prevDrawer = null;
1231 +               
1232 +                               this.controller.hideWidgetContainer(this.controller.get('gpsdetails')); 
1233 +                       }
1234 +                       else {
1235 +                               if(this.prevDrawer)
1236 +                                       this.prevDrawer.mojo.setOpenState(false);
1237 +               
1238 +                               this.prevDrawer = this.gpsdrawer;
1239 +                                               
1240 +                               if(RadioState.get('gps')) {
1241 +                                       this.controller.get('gps_radio').innerHTML = $L('Turn off GPS');
1242 +                               }                               
1243 +                               else
1244 +                                       this.controller.get('gps_radio').innerHTML = $L('Turn on GPS'); 
1245 +                                       
1246 +                               this.controller.showWidgetContainer(this.controller.get('gpsdetails'));                 
1247 +                       }       
1248 +                       this.gpsdrawer.mojo.setOpenState(!this.gpsdrawer.mojo.getOpenState());                                          
1249 +               }
1250 +       },
1251 +
1252 +       handleGpsLaunch: function(event) {
1253 +               this.launchGps.bind(this).delay(0.2,true);
1254 +       },
1255 +
1256 +       launchGps: function(toggleMenu) {
1257 +               this.serviceRequest = new Mojo.Service.Request('palm://com.palm.applicationManager', {
1258 +                               method: 'open',
1259 +                               parameters: {'id': 'com.palm.app.location','params':{}}
1260 +               });
1261 +               if(toggleMenu)
1262 +                       this.toggleDeviceMenu();
1263 +       },
1264 +
1265 +       /*
1266 +        * Update the GPS Label to display the GPS State
1267 +        */
1268 +                       
1269 +       updateGps: function(value) {
1270 +               if(value === 'On') {
1271 +                       RadioState.set('gps', true);
1272 +
1273 +                       this.controller.get('gpsmsg').innerHTML = $L('On');
1274 +                       
1275 +                       this.controller.get('gps_radio').innerHTML = $L('Turn off GPS');                                        
1276 +               }
1277 +               else {
1278 +                       RadioState.set('gps', false);
1279 +                       
1280 +                       this.controller.get('gpsmsg').innerHTML = $L('Off');
1281 +                       
1282 +                       this.controller.get('gps_radio').innerHTML = $L('Turn on GPS');
1283 +               }
1284 +       },
1285 +
1286         toggleBTRadio: function(event) {
1287                 
1288                 if(this.turningOnBtRadio)
1289 @@ -222,38 +1002,48 @@
1290          */     
1291         togglebluetoothList: function(event) {
1292                 
1293 -               //Ignore the tap event if Airplane Mode is in Progress
1294 -               if(this.apModeInProgress)
1295 +               //Ignore the tap event if Airplane Mode is On
1296 +               if(this.barAssistant.getAirplaneMode())
1297                         return;
1298 -                               
1299 -               this.clearBTList();
1300 -               if (this.btdrawer.mojo.getOpenState()) {                        
1301 -                       this.controller.get('btlist').hide();
1302 -                       this.controller.hideWidgetContainer(this.controller.get('btdetails'));  
1303 -               }
1304 +
1305 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
1306 +                       this.toggleBTRadio(event);
1307                 else {
1308 -                                               
1309 -                       if (RadioState.get('bluetooth')) {
1310 -                               this.controller.get('bt_radio').innerHTML = $L('Turn off Bluetooth');
1311 -                               if (this.btTrustedListReq) {
1312 -                                       this.btTrustedListReq.cancel();
1313 -                                       this.btTrustedListReq = undefined;
1314 -                               }       
1315 -                               this.btTrustedListReq = BtService.getTrustedList(this.BtDevicesHandler.bind(this), this.BtDevicesHandler.bind(this));
1316 +                       this.clearBTList();
1317 +                       if (this.btdrawer.mojo.getOpenState()) {                        
1318 +                               this.prevDrawer = null;
1319 +                       
1320 +                               this.controller.get('btlist').hide();
1321 +                               this.controller.hideWidgetContainer(this.controller.get('btdetails'));  
1322                         }
1323                         else {
1324 -                               this.getNumBTProfileReq = BtService.getNumOfProfiles(this.gotNumOfProfiles.bind(this));
1325 -                               if(this.turningOnBtRadio) {
1326 -                                       this.controller.get('bt_radio').innerHTML = $L('Turning on Bluetooth...');
1327 +                               if(this.prevDrawer)
1328 +                                       this.prevDrawer.mojo.setOpenState(false);
1329 +                                               
1330 +                               this.prevDrawer = this.btdrawer;
1331 +                                               
1332 +                               if (RadioState.get('bluetooth')) {
1333 +                                       this.controller.get('bt_radio').innerHTML = $L('Turn off Bluetooth');
1334 +                                       if (this.btTrustedListReq) {
1335 +                                               this.btTrustedListReq.cancel();
1336 +                                               this.btTrustedListReq = undefined;
1337 +                                       }       
1338 +                                       this.btTrustedListReq = BtService.getTrustedList(this.BtDevicesHandler.bind(this), this.BtDevicesHandler.bind(this));
1339                                 }
1340 -                               else 
1341 -                                       this.controller.get('bt_radio').innerHTML = $L('Turn on Bluetooth');
1342 -                       }       
1343 +                               else {
1344 +                                       this.getNumBTProfileReq = BtService.getNumOfProfiles(this.gotNumOfProfiles.bind(this));
1345 +                                       if(this.turningOnBtRadio) {
1346 +                                               this.controller.get('bt_radio').innerHTML = $L('Turning on Bluetooth...');
1347 +                                       }
1348 +                                       else 
1349 +                                               this.controller.get('bt_radio').innerHTML = $L('Turn on Bluetooth');
1350 +                               }       
1351                                         
1352 -                       this.controller.get('btlist').show();
1353 -                       this.controller.showWidgetContainer(this.controller.get('btdetails'));                  
1354 -               }       
1355 -               this.btdrawer.mojo.setOpenState(!this.btdrawer.mojo.getOpenState());                                            
1356 +                               this.controller.get('btlist').show();
1357 +                               this.controller.showWidgetContainer(this.controller.get('btdetails'));                  
1358 +                       }       
1359 +                       this.btdrawer.mojo.setOpenState(!this.btdrawer.mojo.getOpenState());                                            
1360 +               }
1361         },
1362         
1363         //Clear the Bluetooth List Array and List Model.        
1364 @@ -439,39 +1229,41 @@
1365                 if(!payload || !payload.returnValue ||!payload.trusteddevices)
1366                         return;
1367                 
1368 -               for (var i = 0; i < payload.trusteddevices.length; i++) {                       
1369 -                       var device = {
1370 -                               DISPNAME: payload.trusteddevices[i].name,
1371 -                               CONNECTSTATE: payload.trusteddevices[i].status,
1372 -                               BT_ADDR: payload.trusteddevices[i].address,
1373 -                               COD: payload.trusteddevices[i].cod,
1374 -                               showSelected: ''
1375 -                       };
1376 -                       
1377 -                       if(isHFGSupported(payload.trusteddevices[i].cod) || isA2DPSupported(payload.trusteddevices[i].cod)) {
1378 -                               if(payload.trusteddevices[i].status == 'connected') {
1379 -                                       device.showConnected = 'connected';     
1380 -                                       if (this.btProfileStatus['hfg'].status == "connected" && this.btProfileStatus['hfg'].address == payload.trusteddevices[i].address ||
1381 -                                       this.btProfileStatus['a2dp'].status == "connected" && this.btProfileStatus['a2dp'].address == payload.trusteddevices[i].address) 
1382 -                                               device.showConnected = 'connected';
1383 +               if(payload.trusteddevices) {
1384 +                       for (var i = 0; i < payload.trusteddevices.length; i++) {                       
1385 +                               var device = {
1386 +                                       DISPNAME: payload.trusteddevices[i].name,
1387 +                                       CONNECTSTATE: payload.trusteddevices[i].status,
1388 +                                       BT_ADDR: payload.trusteddevices[i].address,
1389 +                                       COD: payload.trusteddevices[i].cod,
1390 +                                       showSelected: ''
1391 +                               };
1392 +                       
1393 +                               if(isHFGSupported(payload.trusteddevices[i].cod) || isA2DPSupported(payload.trusteddevices[i].cod)) {
1394 +                                       if(payload.trusteddevices[i].status == 'connected') {
1395 +                                               device.showConnected = 'connected';     
1396 +                                               if (this.btProfileStatus['hfg'].status == "connected" && this.btProfileStatus['hfg'].address == payload.trusteddevices[i].address ||
1397 +                                               this.btProfileStatus['a2dp'].status == "connected" && this.btProfileStatus['a2dp'].address == payload.trusteddevices[i].address) 
1398 +                                                       device.showConnected = 'connected';
1399 +                                               else {
1400 +                                                       device.showConnected = 'none';
1401 +                                                       device.CONNECTSTATE = 'disconnected';
1402 +                                               }                               
1403 +                                       }
1404 +                                       else if(payload.trusteddevices[i].status == 'connecting') {
1405 +                                               device.showconnected = 'none';
1406 +                                               device.STATUS = $L('Connecting...');
1407 +                                               device.showErrorIfConnectFails = true;
1408 +                                               device.showSelected = 'selected';
1409 +                                       }                                       
1410                                         else {
1411 -                                               device.showConnected = 'none';
1412 -                                               device.CONNECTSTATE = 'disconnected';
1413 +                                               device.showConnected = 'none';                                  
1414                                         }                               
1415 -                               }
1416 -                               else if(payload.trusteddevices[i].status == 'connecting') {
1417 -                                       device.showconnected = 'none';
1418 -                                       device.STATUS = $L('Connecting...');
1419 -                                       device.showErrorIfConnectFails = true;
1420 -                                       device.showSelected = 'selected';
1421 -                               }                                       
1422 -                               else {
1423 -                                       device.showConnected = 'none';                                  
1424 -                               }                               
1425 -                               this.btdeviceList.push(device);
1426 -                               var items = [device];
1427 -                               this.btListWidget.mojo.noticeAddedItems(this.btListWidget.mojo.getLength(), items);                                                     
1428 -                       }               
1429 +                                       this.btdeviceList.push(device);
1430 +                                       var items = [device];
1431 +                                       this.btListWidget.mojo.noticeAddedItems(this.btListWidget.mojo.getLength(), items);                                                     
1432 +                               }               
1433 +                       }
1434                 }                               
1435         },
1436         
1437 @@ -706,34 +1498,45 @@
1438         //Toggles the WiFi list to show or hide.                
1439         togglewifiList: function(event) {       
1440                 
1441 -               //Ignore the tap event if Airplane Mode is in Progress
1442 -               if(this.apModeInProgress)
1443 +               //Ignore the tap event if Airplane Mode is on
1444 +               if(this.barAssistant.getAirplaneMode())
1445                         return;
1446                 
1447 -               this.clearWiFiList();
1448 -               if(this.wifidrawer.mojo.getOpenState()) {
1449 -                       this.clearWiFiList();
1450 -                       this.controller.get('wifilist').hide();
1451 -                       this.controller.hideWidgetContainer(this.controller.get('wifidetails'));
1452 -               }
1453 +               if((event.up) && ( event.up.altKey || event.up.metaKey))
1454 +                       this.toggleWifiRadio(event);
1455                 else {
1456 -                       if(RadioState.get('wifi')) {
1457 -                               this.controller.get('wifi_radio').innerHTML = $L('Turn off Wi-Fi');
1458 -                               this.spinOn();  
1459 +                       this.clearWiFiList();
1460 +                       if(this.wifidrawer.mojo.getOpenState()) {
1461 +                               this.prevDrawer = null;
1462 +                       
1463 +                               this.clearWiFiList();
1464 +                               this.controller.get('wifilist').hide();
1465 +                               this.controller.hideWidgetContainer(this.controller.get('wifidetails'));
1466 +                       }
1467 +                       else {
1468 +                               if(this.prevDrawer)
1469 +                                       this.prevDrawer.mojo.setOpenState(false);
1470 +               
1471 +                               this.prevDrawer = this.wifidrawer;
1472 +                       
1473 +                               if(RadioState.get('wifi')) {
1474 +                                       this.controller.get('wifi_radio').innerHTML = $L('Turn off Wi-Fi');
1475 +                                       this.spinOn();  
1476                                 
1477 -                               if(this.wifiFindNetworksReq) {
1478 -                                       this.wifiFindNetworksReq.cancel();
1479 -                                       this.wifiFindNetworksReq = undefined;
1480 -                               }
1481 -                               this.wifiFindNetworksReq = WiFiService.findNetworks(this.wifiListCb.bind(this),this.wifiListCb.bind(this));
1482 -                       }                               
1483 -                       else
1484 -                               this.controller.get('wifi_radio').innerHTML = $L('Turn on Wi-Fi');      
1485 +                                       if(this.wifiFindNetworksReq) {
1486 +                                               this.wifiFindNetworksReq.cancel();
1487 +                                               this.wifiFindNetworksReq = undefined;
1488 +                                       }
1489 +                                       this.wifiFindNetworksReq = WiFiService.findNetworks(this.wifiListCb.bind(this),this.wifiListCb.bind(this));
1490 +                               }                               
1491 +                               else
1492 +                                       this.controller.get('wifi_radio').innerHTML = $L('Turn on Wi-Fi');      
1493                                         
1494 -                       this.controller.get('wifilist').show(); 
1495 -                       this.controller.showWidgetContainer(this.controller.get('wifidetails'));        
1496 -               }               
1497 -               this.wifidrawer.mojo.setOpenState(!this.wifidrawer.mojo.getOpenState());                                                
1498 +                               this.controller.get('wifilist').show(); 
1499 +                               this.controller.showWidgetContainer(this.controller.get('wifidetails'));        
1500 +                       }               
1501 +                       this.wifidrawer.mojo.setOpenState(!this.wifidrawer.mojo.getOpenState());                                                
1502 +               }
1503         },
1504         
1505         /*
1506 @@ -1035,18 +1838,21 @@
1507                 this.menuscroller.mojo.revealTop(0);
1508         },
1509         
1510 -       toggleDeviceMenu: function() {
1511 +       toggleDeviceMenu: function(edit) {
1512                 
1513                 if(this.isVisible) {                    
1514                         this.isVisible = false;
1515                         
1516 +                       if(this.prevDrawer)
1517 +                               this.prevDrawer.mojo.setOpenState(false);
1518 +                       
1519                         this.btspinnerModel.spinning = false;
1520                         this.controller.modelChanged(this.btspinnerModel);
1521                         //animate the submenu onto the scene
1522                         var animateScrim = function(){
1523                                 Mojo.Animation.animateStyle(this.scrim, 'opacity', 'bezier', {
1524 -                                                       from: 0,
1525 -                                                       to: 1,
1526 +                                                       from: 1,
1527 +                                                       to: 0,
1528                                                         duration: .15,
1529                                                         curve:'over-easy',
1530                                                         reverse:true,
1531 @@ -1071,13 +1877,24 @@
1532                 }
1533                 else {
1534                         this.isVisible = true;
1535 -                       var date = new Date();          
1536 -                       this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '})  +  Mojo.Format.formatDate(date,{date:'long'});
1537                         
1538 -                       if(this.turningOnBtRadio) {
1539 -                               this.btspinnerModel.spinning = true;
1540 -                               this.controller.modelChanged(this.btspinnerModel);
1541 +                       if(edit) {
1542 +                               this.isEditing = true;
1543 +                               
1544 +                               this.controller.get('menu_items').hide();
1545 +                               this.controller.get('edit_items').show();
1546 +                               
1547 +                               this.updateEditItems();
1548                         }
1549 +                       else {
1550 +                               this.isEditing = false;
1551 +       
1552 +                               this.controller.get('menu_items').show();
1553 +                               this.controller.get('edit_items').hide();
1554 +
1555 +                               this.updateMenuItems();
1556 +                       }
1557 +                       
1558                         this.controller.stageController.activate();
1559                         
1560                         var animateDialog = function(){
1561 @@ -1106,11 +1923,14 @@
1562                 }                 
1563         },
1564         
1565 -       updateBatteryLevel: function(batlevel) {                
1566 -               var msg = $L("Battery: #{batlevel}");
1567 -               this.controller.get('dm_battery').innerHTML = new Template(msg).evaluate({
1568 -                       "batlevel": Mojo.Format.formatPercent(batlevel)
1569 -               });             
1570 +       updateBatteryInfo: function(batlevel, batstate) {
1571 +               if(!this.isEditing) {
1572 +                       var msg = $L("Battery: #{batlevel}, #{batstate}");
1573 +                       this.controller.get('menu_header').innerHTML = new Template(msg).evaluate({
1574 +                               "batlevel": Mojo.Format.formatPercent(batlevel),
1575 +                               "batstate": batstate
1576 +                       });             
1577 +               }
1578         },
1579         
1580  });
1581 --- .orig/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
1582 +++ /usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
1583 @@ -1,4 +1,5 @@
1584  <div id="scrim" class="palm-scrim" x-mojo-scrim=""></div>
1585 +
1586  <div id='palm-device-menu' class='palm-popup-container' x-mojo-dialog="">           
1587         <div class="palm-popup-wrapper">  
1588                 
1589 @@ -11,23 +12,161 @@
1590                         <div class="fade-arrow"></div>
1591                 </div>
1592                 
1593 -               <div id="devicescroller" class="palm-popup-content" x-mojo-element="Scroller">       
1594 +               <div id="scroller" class="palm-popup-content" x-mojo-element="Scroller">       
1595                         <div class="palm-list">          
1596                                 
1597 -                               <div class="palm-row first"><div class="palm-row-wrapper">
1598 -                                       <div id="dm_date" class="title dim"></div>
1599 +                               <div class="palm-row first menu-start"><div class="palm-row-wrapper">
1600 +                                       <div id="menu_header" class="title dim"></div>
1601 +                               </div></div> 
1602 +                               
1603 +                               <div class="palm-section-divider"></div>               
1604 +                               
1605 +                               <div id="menu_items">
1606 +                               
1607 +                               <div class="palm-row" id="dm_device" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1608 +                                       <div class="title truncating-text">
1609 +                                               <div class="label right" id="devicemsg">&nbsp;</div>       
1610 +                                               <span x-mojo-loc=''>Device</span>                          
1611 +                                       </div>
1612                                 </div></div>
1613 +
1614 +                               <div id='devicedetails' x-mojo-element="Drawer">
1615 +                               
1616 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1617 +                                       <div style="padding: 5px 0px 5px 0px;">
1618 +                                               <div id="flashlight_toggle" class="right" x-mojo-element="ToggleButton"></div>
1619 +                                               <div class="title truncating-text" >LED Flashlight</div>
1620 +                                       </div>
1621 +                                       </div></div> 
1622 +                                       
1623 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1624 +                                               <div id="dm_brightness" style="float:right;padding-top:16px;padding-right: 22px;font-weight:bold;">50</div>
1625 +                                               <div class="title">Screen Brightness</div>
1626 +
1627 +                                               <div x-mojo-element="Slider" id="brightness_slider" style="padding: 1px 3px 0px 0px; height: 40px;"></div>
1628 +                                       </div></div>
1629 +                               
1630 +                                       <div class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1631 +                                               <div id="dm_volume" style="float:right;padding-top:16px;padding-right: 22px;font-weight:bold;">50</div>
1632 +                                               <div id="volume_toggle" class="title">Ringtone Volume</div>
1633 +                                               
1634 +                                               <div x-mojo-element="Slider" id="volume_slider" style="padding-top: 1px 3px 0px 0px; height: 40px;"></div>
1635 +                                       </div></div>
1636                                 
1637 -                               <div class="palm-section-divider">
1638 -                               </div> 
1639 +                               </div>
1640 +
1641 +                               <div class="palm-section-divider"></div>
1642                                 
1643 -                               <div class="palm-row"><div class="palm-row-wrapper">
1644 -                                       <div id="dm_battery" class="title dim"></div>
1645 -                               </div></div> 
1646 +                               <div class="palm-row" id="dm_security" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1647 +                                       <div class="title truncating-text">
1648 +                                               <div class="label right" id="securitymsg">&nbsp;</div>       
1649 +                                               <span x-mojo-loc=''>Security</span>                          
1650 +                                       </div>
1651 +                               </div></div>
1652 +
1653 +                               <div id="securitydetails" x-mojo-element="Drawer">
1654 +                                       
1655 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1656 +                                               <div id="security_none" class="title truncating-text">Secure Unlock Off</div>
1657 +                                       </div></div>
1658 +
1659 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1660 +                                               <div id="security_pin" class="title truncating-text">Simple PIN Unlock</div>
1661 +                                       </div></div>
1662 +
1663 +                                       <div class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1664 +                                               <div id="security_pw" class="title truncating-text">Password Unlock</div>
1665 +                                       </div></div>
1666 +                                       
1667 +                               </div>
1668 +
1669 +                               <div class="palm-section-divider"></div>
1670 +                               
1671 +                               <div class="palm-row" id="dm_network" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1672 +                                       <div class="title truncating-text">
1673 +                                               <div class="label right" id="networkmsg">&nbsp;</div>       
1674 +                                               <span x-mojo-loc=''>Network</span>                          
1675 +                                       </div>
1676 +                               </div></div>
1677 +
1678 +                               <div id="networkdetails" x-mojo-element="Drawer">
1679 +                                       
1680 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1681 +                                               <div id="network_auto" class="title truncating-text">
1682 +                                                       Automatic Network
1683 +                                               </div>                                                          
1684 +                                       </div></div>
1685 +
1686 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1687 +                                               <div id="network_2g" class="title truncating-text">
1688 +                                                       Only 2G Networks
1689 +                                               </div>                                                          
1690 +                                       </div></div>
1691 +
1692 +                                       <div class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1693 +                                               <div id="network_3g" class="title truncating-text">
1694 +                                                       Only 3G Networks
1695 +                                               </div>                                                          
1696 +                                       </div></div>
1697 +                                       
1698 +                               </div>
1699 +
1700 +                               <div class="palm-section-divider"></div>
1701                                 
1702 -                               <div class="palm-section-divider">
1703 -                               </div>               
1704 +                               <div class="palm-row" id="dm_phone" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1705 +                                       <div class="title truncating-text">
1706 +                                               <div class="label right" id="phonemsg">&nbsp;</div>       
1707 +                                               <span x-mojo-loc=''>Phone</span>                          
1708 +                                       </div>
1709 +                               </div></div>
1710 +
1711 +                               <div id="phonedetails" x-mojo-element="Drawer">
1712 +                                       
1713 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1714 +                                               <div id="phone_conn" class="title truncating-text"></div>                                                               
1715 +                                       </div></div>
1716 +
1717 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1718 +                                               <div id="phone_roam" class="title truncating-text"></div>                                                               
1719 +                                       </div></div>
1720 +                                       
1721 +                                       <div id="phone_pref" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1722 +                                               <div class="title truncating-text">
1723 +                                                       <span x-mojo-loc=''>Phone Preferences</span>
1724 +                                               </div>
1725 +                                       </div></div>
1726 +                                       
1727 +                               </div>
1728 +
1729 +                               <div class="palm-section-divider"></div>
1730                                 
1731 +                               <div class="palm-row" id="dm_data" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1732 +                                       <div class="title truncating-text">
1733 +                                               <div class="label right" id="datamsg">&nbsp;</div>       
1734 +                                               <span x-mojo-loc=''>Data</span>                          
1735 +                                       </div>
1736 +                               </div></div>
1737 +
1738 +                               <div id="datadetails" x-mojo-element="Drawer">
1739 +                                       
1740 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1741 +                                               <div id="data_conn" class="title truncating-text"></div>                                                                
1742 +                                       </div></div>
1743 +                                       
1744 +                                       <div class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1745 +                                               <div id="data_roam" class="title truncating-text"></div>                                                                
1746 +                                       </div></div>
1747 +                                       
1748 +                                       <div id="data_pref" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1749 +                                               <div class="title truncating-text">
1750 +                                                       <span x-mojo-loc=''>Data Preferences</span>
1751 +                                               </div>
1752 +                                       </div></div>
1753 +                                       
1754 +                               </div>
1755 +                                                               
1756 +                               <div class="palm-section-divider"></div>
1757 +                                                               
1758                                 <div class="palm-row" id="dm_wifi" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1759                                         <div class="title truncating-text">
1760                                                 <div class="label right" id="wifimsg">&nbsp;</div>                               
1761 @@ -97,14 +236,40 @@
1762                                 
1763                                 <div class="palm-section-divider"></div>
1764                                 
1765 -                               <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1766 -                                       <div id="dm_airplanemode_status" class="title truncating-text">
1767 -                                        </div>
1768 -                                        <!--<div id='apSpinner' class='label' x-mojo-element="Spinner"></div>-->
1769 -                               </div></div>   
1770 +                               <div class="palm-row" id="dm_gps" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1771 +                                               <div class="title truncating-text">
1772 +                                                       <div class="label right" id="gpsmsg">&nbsp;</div>
1773 +                                                       <span x-mojo-loc=''>GPS</span>                                  
1774 +                                               </div>                          
1775 +                               </div></div>
1776 +                               
1777 +                               <div id="gpsdetails" x-mojo-element="Drawer">
1778 +                                       
1779 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1780 +                                               <div id="gps_radio" class="title truncating-text">
1781 +                                               </div>                                                          
1782 +                                       </div></div>
1783 +                                       
1784 +                                       <div id="gps_pref" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1785 +                                               <div class="title truncating-text">
1786 +                                                       <span x-mojo-loc=''>GPS Preferences</span>
1787 +                                               </div>
1788 +                                       </div></div>
1789 +                                       
1790 +                               </div>
1791 +
1792 +                               </div>
1793                                 
1794 -                               </div>       
1795 +                               <div id="edit_items" x-mojo-element="List"></div>
1796 +
1797 +                               <div class="palm-section-divider"></div>
1798 +                               
1799 +                               <div class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
1800 +                                       <div id="menu_action" class="title truncating-text"></div>
1801 +                               </div></div>   
1802 +
1803                         </div>
1804                 </div>
1805         </div>                          
1806  </div>
1807 +
1808 --- .orig/usr/palm/applications/com.palm.app.screenlock/app/controllers/app-assistant.js
1809 +++ /usr/palm/applications/com.palm.app.screenlock/app/controllers/app-assistant.js
1810 @@ -6,8 +6,25 @@
1811  
1812  function StageAssistant(stageController) {
1813    this.stageController = stageController
1814 -  this.stageController.pushScene('securityconfig')
1815  }
1816  
1817 +StageAssistant.prototype.initialize = function() {
1818 +}
1819 +
1820 +StageAssistant.prototype.setup = function() {
1821 +  var params = Mojo.getLaunchParameters();
1822  
1823 +  if((params) && (params.mode)) {
1824 +    if(params.mode == "none")
1825 +      this.stageController.pushScene('securityconfig', "none");
1826 +    else if(params.mode == "pin")
1827 +      this.stageController.pushScene('securityconfig', "pin");
1828 +    else if(params.mode == "password")
1829 +      this.stageController.pushScene('securityconfig', "password");
1830 +    else
1831 +      this.stageController.pushScene('securityconfig');  
1832 +  }
1833 +  else
1834 +    this.stageController.pushScene('securityconfig');
1835 +}
1836  
1837 --- .orig/usr/palm/applications/com.palm.app.screenlock/app/controllers/securityconfig-assistant.js
1838 +++ /usr/palm/applications/com.palm.app.screenlock/app/controllers/securityconfig-assistant.js
1839 @@ -1,7 +1,9 @@
1840  /* Copyright 2009 Palm, Inc.  All rights reserved. */
1841  
1842  var SecurityconfigAssistant = Class.create({
1843 -       initialize: function() {
1844 +       initialize: function(mode) {
1845 +               this.mode = mode;
1846 +               
1847                 this.switchAppOnInfo = $L("Swiping the entire length of the gesture area will switch to the next or previous app.");
1848                 this.switchAppOffInfo = $L("Any right to left swipe on the gesture area will perform the back gesture.");
1849                 this.newSecurity = '';  
1850 @@ -44,7 +46,9 @@
1851         },
1852                 
1853         setup: function(){
1854 -               
1855 +               if(this.mode)
1856 +                       this.controller.get('main').hide();
1857 +                       
1858                 //this.controller.get('fixedtimerrow').hide();
1859                         
1860                 this.controller.setupWidget('showAlerts', this.onOffToggleOpt, this.alertToggleModel);
1861 @@ -154,6 +158,27 @@
1862                 this.currentSecurity = payload.lockMode || 'none';
1863                 this.showModifyRow();
1864                 this.revertChanges();
1865 +               
1866 +               if(this.mode) {
1867 +                       for(var i = 0; i < this.availableSecurity.length; i++) {
1868 +                               if(this.availableSecurity[i].value == this.mode) {
1869 +                                       this.newSecurity = this.mode;   
1870 +                                       
1871 +                                       if((this.currentSecurity === this.mode) && (this.mode === 'pin'))
1872 +                                               this.controller.stageController.pushScene({name: "pin", automaticFocusAdvance: false},"changePin",this);
1873 +                                       else if((this.currentSecurity === this.mode) && (this.mode === 'password'))
1874 +                                               this.controller.stageController.pushScene({name: "password", automaticFocusAdvance: false},"changePassword",this);
1875 +                                       else if(this.currentSecurity === 'none')
1876 +                                               this.changeSecureLock(this.mode,false);
1877 +                                       else if(this.currentSecurity === 'pin') 
1878 +                                               this.askPin();
1879 +                                       else if(this.currentSecurity === 'password')
1880 +                                               this.askPassword();
1881 +                                       
1882 +                                       return;
1883 +                               }
1884 +                       }
1885 +               }
1886         },
1887         
1888         handleSystemlockValue: function(payload) {
1889 @@ -362,7 +387,7 @@
1890                         this.controller.stageController.pushScene({name: "pin", automaticFocusAdvance: false},"changePin",this);
1891                 }
1892                 else if(this.currentSecurity == 'password') {
1893 -                       this.askPassword();
1894 +                       this.controller.stageController.pushScene({name: "password", automaticFocusAdvance: false},"changePassword",this);
1895                         this.newSecurity = "password";
1896                 }                       
1897         },
1898 @@ -423,16 +448,16 @@
1899                 if(pinCorrect)
1900                         this.changeSecureLock(this.newSecurity,true);
1901                 else {
1902 +                       if(this.mode)
1903 +                               this.controller.window.close();
1904 +
1905                         Mojo.Log.info("Pin was wrong");
1906                         this.revertChanges();
1907                 }
1908         },
1909         
1910         askPassword: function() {
1911 -               this.dialogBox = this.controller.showDialog({
1912 -                       template: 'template/password-box',                      
1913 -                       assistant: new VerifyPasswordAssistant(this,this.systemlockValue),                      
1914 -               });
1915 +               this.controller.stageController.pushScene({name: "password", automaticFocusAdvance: false},"askPassword",this); 
1916         },
1917         
1918         passwordVerified: function(passwordCorrect) {
1919 @@ -440,6 +465,9 @@
1920                         this.changeSecureLock(this.newSecurity,false);
1921                 }
1922                 else {
1923 +                       if(this.mode)
1924 +                               this.controller.window.close();
1925 +               
1926                         Mojo.Log.info("Password was wrong");
1927                         this.revertChanges();
1928                         
1929 @@ -448,25 +476,40 @@
1930         
1931         changeSecureLock: function(newSetting,setFocus) {
1932                 if(newSetting == 'pin') {
1933 -                       this.showPINDialogBox();                                
1934 +                       if(this.currentSecurity == 'password')
1935 +                               this.showPINDialogBox.bind(this).delay(1);
1936 +                       else
1937 +                               this.showPINDialogBox();                                
1938                 }
1939                 else if (newSetting == 'password') {
1940 -                       this.showPasswordDialogBox(setFocus);                           
1941 +                       if(this.currentSecurity == 'pin')
1942 +                               this.showPasswordDialogBox.bind(this, setFocus).delay(1);                               
1943 +                       else
1944 +                               this.showPasswordDialogBox(setFocus);                           
1945                 }
1946                 else {
1947                         Mojo.Log.info("Security is Off");
1948                         this.currentSecurity = 'none';
1949                         $('lockImg').hide();
1950 -                       this.setSystemlockModeReq = SystemService.setSystemlockValue('none','');
1951 +                       this.setSystemlockModeReq = SystemService.setSystemlockValue('none','', this.changedSystemlockValue.bind(this));
1952                         this.showModifyRow();
1953                 }       
1954         },
1955         
1956 +       changedSystemlockValue: function() {
1957 +               if(this.mode)
1958 +                       this.controller.window.close();
1959 +       },
1960 +       
1961         setPinCode: function(pincode) {
1962                 
1963                 if(pincode === '') {
1964 +                       if(this.mode)
1965 +                               this.controller.window.close();
1966 +
1967                         Mojo.Log.info("PIN code is Emplty");
1968                         this.revertChanges();
1969 +                       
1970                         return;
1971                 }
1972                 this.setSystemlockModeReq = SystemService.setSystemlockValue('pin',pincode, this.handleSetPasscodeResponse.bind(this)); 
1973 @@ -474,6 +517,10 @@
1974         
1975         handleSetPasscodeResponse: function(response) {
1976                 Mojo.Log.error("Response "+ Object.toJSON(response));
1977 +               
1978 +               if(this.mode)
1979 +                       this.controller.window.close();
1980 +               
1981                 if(response.returnValue) {
1982                         this.currentSecurity = 'pin';
1983                         $('lockImg').show();
1984 @@ -485,6 +532,9 @@
1985         },
1986         
1987         pinAlreadySet: function() {
1988 +               if(this.mode)
1989 +                       this.controller.window.close();
1990 +               
1991                 this.currentSecurity = 'pin';
1992                 $('lockImg').show();
1993                 this.policyEnforced = true;
1994 @@ -496,6 +546,9 @@
1995         },
1996         
1997         setPassword: function(password) {
1998 +               if(this.mode)
1999 +                       this.controller.window.close();
2000 +
2001                 Mojo.Log.info("Entered Password "+ password);
2002                 if(password === '') {
2003                         Mojo.Log.info("Password is Emplty");
2004 @@ -510,6 +563,9 @@
2005         },
2006         
2007         passwordAlreadySet: function(password) {
2008 +               if(this.mode)
2009 +                       this.controller.window.close();
2010 +       
2011                 this.currentSecurity = 'password';
2012                 this.systemlockValue = password;
2013                 this.policyEnforced = true;
2014 @@ -519,10 +575,7 @@
2015         
2016         
2017         showPasswordDialogBox: function(setFocus) {             
2018 -               this.dialogBox = this.controller.showDialog({
2019 -                       template: 'template/security-password-box',
2020 -                       assistant: new PasswordAssistant(this,setFocus),                        
2021 -               });             
2022 +               this.controller.stageController.pushScene({name: "password", automaticFocusAdvance: false},"enterPassword",this,setFocus);      
2023         },
2024  
2025         revertChanges: function() {
2026 @@ -645,280 +698,3 @@
2027         },
2028  });
2029  
2030 -
2031 -var VerifyPasswordAssistant = Class.create({
2032 -       
2033 -       initialize: function(sceneAssistant) {
2034 -               this.sceneAssistant = sceneAssistant;
2035 -               this.enteredPassword = '';
2036 -               this.passwordVerified = false;          
2037 -       },
2038 -       
2039 -       setup : function(widget) {
2040 -               
2041 -               Mojo.Log.info("Pincode assistant setup ");
2042 -               this.widget = widget;
2043 -                                               
2044 -               this.passwordAttributes = {
2045 -               textFieldName: "password",
2046 -               hintText: $L('enter password...'),
2047 -        property: 'value',
2048 -        multi: false,        
2049 -               changeOnKeyPress: true,
2050 -        disabled: false,
2051 -               requiresEnterKey: true,         
2052 -       },
2053 -    
2054 -       this.passwordModel = {
2055 -        'value': ''
2056 -       },
2057 -               
2058 -               this.sceneAssistant.controller.setupWidget('password', this.passwordAttributes, this.passwordModel);
2059 -               $('password').observe(Mojo.Event.propertyChange, this.propertyChanged.bind(this));
2060 -               $('done_pw').addEventListener(Mojo.Event.tap, this.matchPassword.bindAsEventListener(this));
2061 -               $('cancel_pw').addEventListener(Mojo.Event.tap, this.cancel.bindAsEventListener(this));
2062 -                               
2063 -               if(this.sceneAssistant.securityPolicy && this.sceneAssistant.retriesLeft == 1) {
2064 -                       $('passworderrortext').innerHTML = $L("Password incorrect. If you enter an incorrect password now your phone will be erased.");
2065 -                       $('passworderror').show();
2066 -               }
2067 -       },
2068 -       
2069 -       matchPassword: function(event) {
2070 -               if(!event)
2071 -                       return;
2072 -               event.stop();
2073 -               SystemService.matchDevicePasscode($('password').mojo.getValue(),this.verifyPasswd.bind(this));
2074 -       },
2075 -       
2076 -       propertyChanged: function(event) {
2077 -               if(!event)
2078 -                       return;
2079 -               
2080 -               if (event && Mojo.Char.isEnterKey(event.originalEvent.keyCode)) {
2081 -                       this.matchPassword(event);
2082 -               }
2083 -       },
2084 -       
2085 -       cancel: function(event) {
2086 -               event.stop();
2087 -               this.sceneAssistant.passwordVerified(false);
2088 -               this.widget.mojo.close();       
2089 -       },
2090 -       
2091 -       cleanup: function() {
2092 -               if(this.passwordVerified === false) {
2093 -                       this.sceneAssistant.passwordVerified(false);
2094 -               }
2095 -       },
2096 -       
2097 -       
2098 -       verifyPasswd: function(payload) {
2099 -               if(!payload)
2100 -                       return;
2101 -                               
2102 -               if(payload.returnValue === true ) {
2103 -                       if(this.sceneAssistant.securityPolicy) 
2104 -                               this.sceneAssistant.retriesLeft = this.sceneAssistant.maxRetries;
2105 -                       this.passwordVerified = true;           
2106 -                       Mojo.Log.info("Password Matches!!!");
2107 -                       this.sceneAssistant.passwordVerified(true);
2108 -                       this.widget.mojo.close();                       
2109 -               }
2110 -               else {
2111 -                       
2112 -                       this.clearFields();
2113 -                       
2114 -                       if(this.sceneAssistant.securityPolicy) {
2115 -                               this.sceneAssistant.retriesLeft = payload.retriesLeft;
2116 -                               if(payload.retriesLeft === 1) { 
2117 -                                       $('passworderrortext').innerHTML = $L("Password incorrect. If you enter an incorrect password now your phone will be erased.");
2118 -                               }
2119 -                               else {
2120 -                                       $('passworderrortext').innerHTML = $L("Password incorrect. ") + Mojo.Format.formatChoice(payload.retriesLeft, 
2121 -                                                               $L("##{num} tries remaining."), 
2122 -                                                               {num: SystemService.numberToWord(payload.retriesLeft)});
2123 -                               }
2124 -                       }
2125 -                       else 
2126 -                               $('passworderrortext').innerHTML = $L("Incorrect password.");
2127 -                       $('passworderror').show();
2128 -               }
2129 -       },
2130 -       
2131 -       clearFields: function() {
2132 -               this.passwordModel.value = '';
2133 -               this.sceneAssistant.controller.modelChanged(this.passwordModel,this);   
2134 -               $('password').mojo.focus();     
2135 -       },
2136 -       
2137 -       handleCommand: function(event) {
2138 -               if(event.type == Mojo.Event.back) {                     
2139 -                       this.sceneAssistant.revertChanges();
2140 -                       event.stop();
2141 -                       this.widget.mojo.close();                                                               
2142 -               }
2143 -       }       
2144 -       
2145 -});
2146 -
2147 -var PasswordAssistant = Class.create({
2148 -       
2149 -       initialize: function(sceneAssistant,setFocus) {
2150 -               this.sceneAssistant = sceneAssistant;
2151 -               this.enteredPin = '';
2152 -               this.firstPinInput = '';
2153 -               this.setFocus = setFocus;
2154 -               this.settingPassword = false;
2155 -       },
2156 -       
2157 -       setup : function(widget) {
2158 -               
2159 -               Mojo.Log.info("Pincode assistant setup ");
2160 -               this.widget = widget;
2161 -                                               
2162 -               this.attributes = {
2163 -        textFieldName: "password",
2164 -        property: 'value',
2165 -        multi: false,        
2166 -               changeOnKeyPress: true,
2167 -        disabled: false,                     
2168 -               hintText: $L('enter password...'),
2169 -       };
2170 -                this.model = {
2171 -                'value' : ''
2172 -                };
2173 -                
2174 -                this.attributes1 = {
2175 -       textFieldName: "password",
2176 -        property: 'value',
2177 -        multi: false,        
2178 -               changeOnKeyPress: true,
2179 -        disabled: false,           
2180 -               hintText: $L('confirm password...'),
2181 -               requiresEnterKey: true,
2182 -       };
2183 -                this.model1 = {
2184 -                'value' : ''
2185 -                };
2186 -                
2187 -                this.buttonattributes = {
2188 -                               disabledProperty: 'disabled'
2189 -                },
2190 -                
2191 -                this.donebuttonmodel = {
2192 -                       buttonLabel : $L("Done"),
2193 -                       buttonClass : "affirmative",
2194 -                       disabled: false
2195 -               },
2196 -               this.cancelbuttonmodel = {
2197 -                       buttonLabel : $L("Cancel"),
2198 -                       disabled: false
2199 -               },
2200 -                
2201 -               this.sceneAssistant.controller.setupWidget('passwordInput', this.attributes, this.model);
2202 -               this.sceneAssistant.controller.setupWidget('password_confirm', this.attributes1, this.model1);
2203 -               $('passwordInput').observe(Mojo.Event.propertyChange, this.propertyChanged.bind(this));
2204 -               $('password_confirm').observe(Mojo.Event.propertyChange, this.confirmPasswordpropertyChanged.bind(this));
2205 -               
2206 -               this.sceneAssistant.controller.setupWidget('done', this.buttonattributes, this.donebuttonmodel);
2207 -               this.sceneAssistant.controller.setupWidget('cancel', this.buttonattributes, this.cancelbuttonmodel);            
2208 -               $('cancel').addEventListener(Mojo.Event.tap, this.cancel.bindAsEventListener(this));    
2209 -               $('done').addEventListener(Mojo.Event.tap, this.verifyPasswd.bindAsEventListener(this));
2210 -               
2211 -               if(this.sceneAssistant.passwordHintText)
2212 -                       $('passwordhint').innerHTML = this.sceneAssistant.passwordHintText;
2213 -       },
2214 -       
2215 -       activate: function() {
2216 -               if(this.setFocus)
2217 -                       $('passwordInput').mojo.focus();        
2218 -       },
2219 -       
2220 -       cleanup: function() {
2221 -               if(this.settingPassword === false)      
2222 -                       this.sceneAssistant.revertChanges();
2223 -       },
2224 -
2225 -       verifyPasswd: function(event) {
2226 -               Event.stop(event);
2227 -               
2228 -               if($('passwordInput').mojo.getValue() == $('password_confirm').mojo.getValue()) {
2229 -                       if(this.sceneAssistant.securityPolicy) {
2230 -                               this.settingPassword = true;
2231 -                               this.donebuttonmodel.disabled = true;
2232 -                               this.cancelbuttonmodel.disabled = true;
2233 -                               this.sceneAssistant.controller.modelChanged(this.donebuttonmodel);
2234 -                               this.sceneAssistant.controller.modelChanged(this.cancelbuttonmodel);
2235 -                               this.setSystemlockPasswordReq = SystemService.setSystemlockValue('password',$('passwordInput').mojo.getValue(), this.handleSetPasswordResponse.bind(this));
2236 -                       }
2237 -                       else {
2238 -                               this.sceneAssistant.setPassword($('password_confirm').mojo.getValue());
2239 -                               this.widget.mojo.close();       
2240 -                       }               
2241 -               }
2242 -               else {
2243 -                       Mojo.Log.info("Password don't Match!!!");
2244 -                       this.clearFields();
2245 -                       $('errortext').innerHTML = $L("Passwords do not match.");
2246 -                       $('passworderror').show();
2247 -               }
2248 -       },
2249 -       
2250 -       handleSetPasswordResponse: function(payload) {
2251 -               
2252 -               this.settingPassword = false;
2253 -               this.donebuttonmodel.disabled = false;
2254 -               this.cancelbuttonmodel.disabled = false;
2255 -               this.sceneAssistant.controller.modelChanged(this.donebuttonmodel);
2256 -               this.sceneAssistant.controller.modelChanged(this.cancelbuttonmodel);
2257 -               
2258 -               if(payload.returnValue) {
2259 -                       this.sceneAssistant.passwordAlreadySet($('passwordInput').mojo.getValue());
2260 -                       this.widget.mojo.close();       
2261 -               }
2262 -               else {
2263 -                       this.clearFields();
2264 -                       $('errortext').innerHTML = $L("Password does not match security requirements.");
2265 -                       $('passworderror').show();
2266 -               }
2267 -       },
2268 -       
2269 -       propertyChanged: function(event) {
2270 -               if(!event)
2271 -                       return;
2272 -               if($('passworderror').visible())
2273 -                       $('passworderror').hide();
2274 -       },
2275 -       
2276 -       confirmPasswordpropertyChanged: function(event) {
2277 -               if (event && Mojo.Char.isEnterKey(event.originalEvent.keyCode)) {
2278 -                       this.verifyPasswd(event);
2279 -               }
2280 -       },
2281 -               
2282 -       cancel: function(event) {
2283 -               this.sceneAssistant.setPassword('');
2284 -               this.widget.mojo.close();       
2285 -       },
2286 -       
2287 -       clearFields: function() {
2288 -               this.model1.value = '';
2289 -               this.model.value = '';
2290 -               this.sceneAssistant.controller.modelChanged(this.model,this);
2291 -               this.sceneAssistant.controller.modelChanged(this.model1,this);
2292 -               $('passwordInput').mojo.focus();        
2293 -       },
2294 -       
2295 -       handleCommand: function(event) {
2296 -               if(event.type == Mojo.Event.back) {     
2297 -                       event.stop();
2298 -                       if(this.settingPassword == true)
2299 -                               return;         
2300 -                       this.sceneAssistant.revertChanges();
2301 -                       this.widget.mojo.close();                                                                               
2302 -               }
2303 -       }               
2304 -       
2305 -});
2306 -
2307 --- .orig/usr/palm/applications/com.palm.app.screenlock/index.html
2308 +++ /usr/palm/applications/com.palm.app.screenlock/index.html
2309 @@ -10,6 +10,7 @@
2310        Mojo.loadScript('app/controllers/app-assistant.js');
2311           Mojo.loadScript('app/controllers/securityconfig-assistant.js');
2312           Mojo.loadScript('app/controllers/pin-assistant.js');
2313 +         Mojo.loadScript('app/controllers/password-assistant.js');
2314           Mojo.loadScript('app/models/SystemService.js');         
2315     </script>
2316    <link href="stylesheets/screenlock.css" media="screen" rel="stylesheet" type="text/css" />