Renamed more-icons-per-row-5x4-flare576
[webos-internals:adamrmcd-modifications.git] / phone / radiopower.patch
1 Index: /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
2 ===================================================================
3 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
4 +++ /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
5 @@ -817,6 +817,8 @@ handletelephonyNotifications: function(p
6                                 this.callForwardNotificationSession = null;     
7                         }                               
8                 }
9 +               var stageController = Mojo.Controller.getAppController().getStageProxy("DeviceMenu");
10 +               stageController.delegateToSceneAssistant("updatePhone");
11         }
12         else if (payload.eventNetwork && this.phoneRadioState) {
13                 var networkMsg = payload.eventNetwork;
14 @@ -2647,6 +2649,10 @@ getCurrentWiFiState: function() {
15         return this.wifiState;
16  },
17  
18 +getCurrentPhoneState: function() {
19 +       return this.phoneRadioState;
20 +},
21 +
22  setDeviceMenuAssistant: function(menuassistant) {
23         this.deviceMenuAssistant = menuassistant;
24  },
25 Index: /usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
26 ===================================================================
27 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
28 +++ /usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
29 @@ -1,6 +1,6 @@
30  /* Copyright 2009 Palm, Inc.  All rights reserved. */
31  
32 -var RadioState = new Hash({wifi: undefined, bluetooth: undefined});
33 +var RadioState = new Hash({wifi: undefined, bluetooth: undefined, phone: undefined});
34  
35  var DevicemenuAssistant = Class.create({
36         
37 @@ -39,6 +39,8 @@ var DevicemenuAssistant = Class.create({
38                 this.drawerModel = {myOpenProperty:false};
39                 this.controller.setupWidget('wifidetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
40                 this.controller.setupWidget('btdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
41 +               this.controller.setupWidget('phonedetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
42 +               this.phonedrawer = this.controller.get('phonedetails')
43                 this.wifidrawer = this.controller.get('wifidetails');
44                 this.btdrawer = this.controller.get('btdetails');
45                 
46 @@ -95,6 +97,17 @@ var DevicemenuAssistant = Class.create({
47                         else
48                                 this.controller.get('wifimsg').innerHTML = wifistate.escapeHTML();                      
49                 }               
50 +               
51 +               var phonestate = this.barAssistant.getCurrentPhoneState();
52 +               if(phonestate === 'Off') {
53 +                       this.controller.get('phonemsg').innerHTML = $L('Off');
54 +                       RadioState.set('phone',false);
55 +               }
56 +               else {
57 +                       this.controller.get('phonemsg').innerHTML = $L('On');
58 +                       RadioState.set('phone',true);
59 +               }
60 +                               
61                 this.controller.listen(this.controller.document, Mojo.Event.deactivate, this.close.bindAsEventListener(this));
62                 this.isVisible = true;
63                 
64 @@ -118,6 +131,8 @@ var DevicemenuAssistant = Class.create({
65                 this.controller.get('btlist').addEventListener(Mojo.Event.listTap,this.handleBTTap.bindAsEventListener(this));          
66                 this.controller.get('dm_wifi').addEventListener(Mojo.Event.tap, this.togglewifiList.bindAsEventListener(this));
67                 this.controller.get('dm_bluetooth').addEventListener(Mojo.Event.tap, this.togglebluetoothList.bindAsEventListener(this));
68 +               this.controller.get('dm_phone').addEventListener(Mojo.Event.tap, this.togglePhoneList.bindAsEventListener(this));
69 +               this.controller.get('phone_radio').addEventListener(Mojo.Event.tap, this.togglePhoneRadio.bindAsEventListener(this));
70                 this.controller.get('wifi_radio').addEventListener(Mojo.Event.tap, this.toggleWifiRadio.bindAsEventListener(this));
71                 this.controller.get('bt_radio').addEventListener(Mojo.Event.tap, this.toggleBTRadio.bindAsEventListener(this));
72                 this.controller.get('bt_pref').addEventListener(Mojo.Event.tap,this.handleBluetoothLaunch.bindAsEventListener(this));
73 @@ -177,6 +192,49 @@ var DevicemenuAssistant = Class.create({
74                 }
75                 this.apModeInProgress = false;
76         },
77 +
78 +
79 +       updatePhone: function() {
80 +               if(this.barAssistant.getCurrentPhoneState()) {
81 +                       this.controller.get('phonemsg').innerHTML = $L('On');
82 +                       this.controller.get('phone_radio').innerHTML = $L('Turn off Phone');
83 +                       RadioState.set('phone', true);
84 +               }
85 +               else {
86 +                       this.controller.get('phonemsg').innerHTML = $L('Off');
87 +                       this.controller.get('phone_radio').innerHTML = $L('Turn on Phone');
88 +                       RadioState.set('phone', false);
89 +               }
90 +       },
91
92 +       togglePhoneRadio: function(event) {
93 +               this.serviceRequest = new Mojo.Service.Request("palm://com.palm.vibrate", {
94 +                       method: 'vibrate', parameters: { 'period': 0,'duration': 250 }
95 +               });
96 +               if(RadioState.get('phone'))
97 +                       TelephonyService.tempPowerSet('off',false,null,null);
98 +               else
99 +                       TelephonyService.tempPowerSet('on',false,null,null);
100 +               this.toggleDeviceMenu();
101 +       },
102 +  
103 +       togglePhoneList: function(event) {
104 +               if(this.apModeInProgress)
105 +                       return;
106 +  
107 +               if (this.phonedrawer.mojo.getOpenState()) {
108 +                       this.controller.hideWidgetContainer(this.controller.get('phonedetails'));       
109 +               }
110 +               else {
111 +                       if(RadioState.get('phone'))
112 +                               this.controller.get('phone_radio').innerHTML = $L('Turn off Phone');
113 +                       else
114 +                       this.controller.get('phone_radio').innerHTML = $L('Turn on Phone');     
115 +  
116 +                       this.controller.showWidgetContainer(this.controller.get('phonedetails'));
117 +               }
118 +               this.phonedrawer.mojo.setOpenState(!this.phonedrawer.mojo.getOpenState());                                              
119 +       },
120         
121         toggleBTRadio: function(event) {
122                 if(RadioState.get('bluetooth')) {
123 @@ -891,6 +949,10 @@ var DevicemenuAssistant = Class.create({
124         
125         close: function() {
126                 
127 +               if(this.phonedrawer.mojo.getOpenState()) {
128 +                       this.controller.hideWidgetContainer(this.controller.get('phonedetails'));
129 +                       this.phonedrawer.mojo.setOpenState(false);
130 +               }
131                 if (this.btdrawer.mojo.getOpenState()) {
132                         this.clearBTList();                     
133                         this.controller.hideWidgetContainer(this.controller.get('btdetails'));
134 Index: /usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
135 ===================================================================
136 --- .orig/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
137 +++ /usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
138 @@ -94,6 +94,22 @@
139                                 
140                                 <div class="palm-section-divider"></div>
141                                 
142 +                               <div class="palm-row" id="dm_phone" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
143 +                                       <div class="title truncating-text">
144 +                                               <div class="label right" id="phonemsg">&nbsp;</div>
145 +                                               <span x-mojo-loc=''>Phone</span>
146 +                                       </div>
147 +                               </div></div>
148 +
149 +                               <div id='phonedetails' x-mojo-element="Drawer">
150 +                                       <div class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
151 +                                               <div id="phone_radio" class="title truncating-text">
152 +                                               </div>
153 +                                       </div></div>
154 +                               </div>
155 +
156 +                               <div class="palm-section-divider"></div>
157 +                               
158                                 <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
159                                         <div id="dm_airplanemode_status" class="title truncating-text">
160                                          </div>