1 Updated patch.
[webos-internals:djcin7s-modifications.git] / top-bar / top-bar-toggle-3g-in-device-menu.patch
1 diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
2 index 335a73c..7d413fd 100644
3 --- a/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
4 +++ b/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
5 @@ -44,8 +44,10 @@ var DevicemenuAssistant = Class.create({
6                 this.drawerModel = {myOpenProperty:false};
7                 this.controller.setupWidget('wifidetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
8                 this.controller.setupWidget('btdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
9 +               this.controller.setupWidget('gsmdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
10                 this.wifidrawer = this.controller.get('wifidetails');
11                 this.btdrawer = this.controller.get('btdetails');
12 +               this.gsmdrawer = this.controller.get('gsmdetails');
13                 
14                 this.wifiListModel = {
15                         items: this.wifiAPList
16 @@ -76,6 +78,8 @@ var DevicemenuAssistant = Class.create({
17                         this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn off Airplane Mode');
18                 else
19                         this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn on Airplane Mode');
20 +
21 +               this.controller.get('ratStatus').innerText = "???";
22                         
23                 var btstate = this.barAssistant.getCurrentBluetoothState();
24                 if(btstate === 'Off') {
25 @@ -126,10 +130,14 @@ var DevicemenuAssistant = Class.create({
26                 this.controller.get('btlist').addEventListener(Mojo.Event.listTap,this.handleBTTap.bindAsEventListener(this));          
27                 this.controller.get('dm_wifi').addEventListener(Mojo.Event.tap, this.togglewifiList.bindAsEventListener(this));
28                 this.controller.get('dm_bluetooth').addEventListener(Mojo.Event.tap, this.togglebluetoothList.bindAsEventListener(this));
29 +               this.controller.get('gsm_umts').addEventListener(Mojo.Event.tap, this.togglegsmList.bindAsEventListener(this));
30                 this.controller.get('wifi_radio').addEventListener(Mojo.Event.tap, this.toggleWifiRadio.bindAsEventListener(this));
31                 this.controller.get('bt_radio').addEventListener(Mojo.Event.tap, this.toggleBTRadio.bindAsEventListener(this));
32                 this.controller.get('bt_pref').addEventListener(Mojo.Event.tap,this.handleBluetoothLaunch.bindAsEventListener(this));
33                 this.controller.get('wifi_pref').addEventListener(Mojo.Event.tap,this.handleWiFiLaunch.bindAsEventListener(this));
34 +               this.controller.get('gsm_umts_auto').addEventListener(Mojo.Event.tap, this.toggleGSM_Auto.bindAsEventListener(this));
35 +               this.controller.get('gsm_umts_2g').addEventListener(Mojo.Event.tap, this.toggleGSM_2G.bindAsEventListener(this));
36 +               this.controller.get('gsm_umts_3g').addEventListener(Mojo.Event.tap, this.toggleGSM_3G.bindAsEventListener(this));
37                 this.controller.get('scrim').addEventListener(Mojo.Event.tap, this.toggleDeviceMenu.bindAsEventListener(this));
38                 //Close the App because this is a first launch.
39                 this.toggleDeviceMenu();                                                
40 @@ -185,6 +193,59 @@ var DevicemenuAssistant = Class.create({
41                 }
42                 this.apModeInProgress = false;
43         },
44 +
45 +       toggleGSM_Auto: function(event) {
46 +               this.toggleGSM(event, "automatic");
47 +       },
48 +       
49 +       toggleGSM_2G: function(event) {
50 +               this.toggleGSM(event, "gsm");
51 +       },
52 +       
53 +       toggleGSM_3G: function(event) {
54 +               this.toggleGSM(event, "umts");
55 +       },
56 +       
57 +       // "automatic", "gsm", "umts"
58 +       toggleGSM: function(event, rat) {
59 +               this.currentRat = rat;
60 +               var request = new Mojo.Service.Request('palm://com.palm.telephony', {
61 +                       method: "ratSet",
62 +                       parameters: {
63 +                               "mode": this.currentRat
64 +                       },
65 +                       onSuccess: function(response) {},
66 +                       onFailure: function(response) {},
67 +               });
68 +               if(this.currentRat == "gsm") {
69 +                       this.controller.get('ratStatus').innerText = "2G";
70 +               } else if(this.currentRat == "umts") {
71 +                       this.controller.get('ratStatus').innerText = "3G";
72 +               } else if(this.currentRat == "automatic") {
73 +                       this.controller.get('ratStatus').innerText = "Auto";
74 +               } else {
75 +                       this.controller.get('ratStatus').innerText = "???";
76 +               }
77 +               this.toggleDeviceMenu.bind(this).delay(0.2);            
78 +       },
79 +
80 +       /*
81 +        * Toggles the Bluetooth List to show and Hide when tapping on the Bluetooth Row.
82 +        */     
83 +       togglegsmList: function(event) {
84 +               
85 +               //Ignore the tap event if Airplane Mode is in Progress
86 +               if(this.apModeInProgress)
87 +                       return;
88 +                               
89 +               if (this.gsmdrawer.mojo.getOpenState()) {                       
90 +                       this.controller.hideWidgetContainer(this.controller.get('gsmdetails')); 
91 +               }
92 +               else {
93 +                       this.controller.showWidgetContainer(this.controller.get('gsmdetails'));                 
94 +               }       
95 +               this.gsmdrawer.mojo.setOpenState(!this.gsmdrawer.mojo.getOpenState());                                          
96 +       },
97         
98         updateAirplaneModeProgress: function() {
99                 if(this.barAssistant.getAirplaneMode()) {
100 @@ -1028,6 +1089,10 @@ var DevicemenuAssistant = Class.create({
101                         this.controller.hideWidgetContainer(this.controller.get('wifidetails'));
102                         this.wifidrawer.mojo.setOpenState(false);
103                 }               
104 +               if (this.gsmdrawer.mojo.getOpenState()) {
105 +                       this.controller.hideWidgetContainer(this.controller.get('gsmdetails'));
106 +                       this.gsmdrawer.mojo.setOpenState(false);        
107 +               }               
108                 //this.isVisible = false;
109                 if(this.isVisible){
110                         this.toggleDeviceMenu();
111 diff --git a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
112 index d153a8d..e9dc9c0 100644
113 --- a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
114 +++ b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
115 @@ -97,6 +97,37 @@
116                                 
117                                 <div class="palm-section-divider"></div>
118                                 
119 +                               <div class="palm-row" id="gsm_umts" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
120 +                                       <div class="title truncating-text">
121 +                                               <div class="label right" id="ratStatus">&nbsp;</div>
122 +                                               <span>Network Type</span>
123 +                                       </div>
124 +                               </div></div>
125 +                               
126 +                               <div id='gsmdetails' x-mojo-element="Drawer">
127 +                                       
128 +                                       <div id="gsm_umts_auto" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">   
129 +                                               <div class="title truncating-text">
130 +                                                       <span>Auto</span> 
131 +                                               </div>
132 +                                       </div></div>  
133 +
134 +                                       <div id="gsm_umts_2g" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">   
135 +                                               <div class="title truncating-text">
136 +                                                       <span>2G</span> 
137 +                                               </div>
138 +                                       </div></div>  
139 +
140 +                                       <div id="gsm_umts_3g" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">   
141 +                                               <div class="title truncating-text">
142 +                                                       <span>3G</span> 
143 +                                               </div>
144 +                                       </div></div>  
145 +                                       
146 +                               </div>                            
147 +
148 +                               <div class="palm-section-divider"></div>
149 +                               
150                                 <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
151                                         <div id="dm_airplanemode_status" class="title truncating-text">
152                                          </div>
153 diff --git a/usr/lib/luna/system/luna-systemui/resources/de_de/views/devicemenu/devicemenu-scene.html b/usr/lib/luna/system/luna-systemui/resources/de_de/views/devicemenu/devicemenu-scene.html
154 index 6d5d20d..a6e5077 100644
155 --- a/usr/lib/luna/system/luna-systemui/resources/de_de/views/devicemenu/devicemenu-scene.html
156 +++ b/usr/lib/luna/system/luna-systemui/resources/de_de/views/devicemenu/devicemenu-scene.html
157 @@ -97,6 +97,37 @@
158                                 
159                                 <div class="palm-section-divider"></div>
160                                 
161 +                               <div class="palm-row" id="gsm_umts" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
162 +                                       <div class="title truncating-text">
163 +                                               <div class="label right" id="ratStatus">&nbsp;</div>
164 +                                               <span>Netzwerktyp</span>
165 +                                       </div>
166 +                               </div></div>
167 +
168 +                               <div id='gsmdetails' x-mojo-element="Drawer">
169 +                                       
170 +                                       <div id="gsm_umts_auto" class="palm-row first" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">   
171 +                                               <div class="title truncating-text">
172 +                                                       <span>Auto</span> 
173 +                                               </div>
174 +                                       </div></div>  
175 +
176 +                                       <div id="gsm_umts_2g" class="palm-row" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">   
177 +                                               <div class="title truncating-text">
178 +                                                       <span>2G</span> 
179 +                                               </div>
180 +                                       </div></div>  
181 +
182 +                                       <div id="gsm_umts_3g" class="palm-row last" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">   
183 +                                               <div class="title truncating-text">
184 +                                                       <span>3G</span> 
185 +                                               </div>
186 +                                       </div></div>  
187 +                                       
188 +                               </div>                            
189 +                               
190 +                               <div class="palm-section-divider"></div>
191 +                               
192                                 <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
193                                         <div id="dm_airplanemode_status" class="title truncating-text">
194                                          </div>