updates and additions
[webos-internals:modifications.git] / top-bar / top-bar-data-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 08f7f75..aca80a1 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 @@ -159,6 +159,7 @@ var DevicemenuAssistant = Foundations.Class.create({
6                 this.controller.get('dm_bluetooth').addEventListener(Mojo.Event.tap, this.togglebluetoothList.bind(this));
7                 this.controller.get('wifi_radio').addEventListener(Mojo.Event.tap, this.toggleWifiRadio.bind(this));
8                 this.controller.get('bt_radio').addEventListener(Mojo.Event.tap, this.toggleBTRadio.bind(this));
9 +               this.controller.get('dm_data').addEventListener(Mojo.Event.tap, this.toggleData.bindAsEventListener(this));
10                 this.controller.get('bt_pref').addEventListener(Mojo.Event.tap,this.handleBluetoothLaunch.bind(this));
11                 this.controller.get('wifi_pref').addEventListener(Mojo.Event.tap,this.handleWiFiLaunch.bind(this));
12                 this.controller.get('vpn_pref').addEventListener(Mojo.Event.tap,this.handleVPNLaunch.bind(this));
13 @@ -1056,6 +1057,29 @@ var DevicemenuAssistant = Foundations.Class.create({
14                 this.controller.modelChanged(this.spinnerModel);                                
15         },
16         
17 +       toggleData: function(event) {
18 +               if(this.dataDisabled=="on") {
19 +                       this.dataDisabled = "off";
20 +               } else {
21 +                       this.dataDisabled = "on";
22 +               }
23 +               this.controller.serviceRequest('palm://com.palm.wan', {
24 +                       method: 'set',
25 +                       parameters: {
26 +                               disablewan: this.dataDisabled
27 +                       }
28 +               });
29 +               this.setDataLabel();
30 +       },
31 +
32 +       setDataLabel: function() {
33 +               if(this.dataDisabled=="off") {
34 +                       this.controller.get('dataStatus').innerText = "on";
35 +               } else {
36 +                       this.controller.get('dataStatus').innerText = "off";
37 +               }
38 +       },
39 +       
40         spinOff: function() {   
41                 this.spinnerModel.spinning = false;
42                 this.controller.modelChanged(this.spinnerModel);                        
43 @@ -1460,6 +1484,18 @@ var DevicemenuAssistant = Foundations.Class.create({
44                         //this.controller.stageController.deactivate();
45                 }
46                 else {
47 +                       this.controller.serviceRequest('palm://com.palm.connectionmanager', {
48 +                               method: 'getstatus',
49 +                               parameters: {},
50 +                               onSuccess: function(response) {
51 +                                       if(response.wan.state === "disconnected") {
52 +                                               this.dataDisabled = "on";
53 +                                       } else if(response.wan.state === "connected") {
54 +                                               this.dataDisabled = "off";
55 +                                       }
56 +                                       this.setDataLabel();
57 +                               }.bind(this)
58 +                       });
59                         this.isVisible = true;
60                         var date = new Date();          
61                         this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '})  +  Mojo.Format.formatDate(date,{date:'long'});
62 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
63 index 0e43a60..21c0e99 100644
64 --- a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
65 +++ b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
66 @@ -159,6 +159,15 @@
67                                 </div>  
68                                 
69                                 <div class="palm-section-divider"></div>
70 +
71 +                               <div class="palm-row" id="dm_data" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
72 +                                       <div class="title truncating-text">
73 +                                               <div class="label right" id="dataStatus">&nbsp;</div>
74 +                                               <span x-mojo-loc=''>Data Connection</span>
75 +                                       </div>
76 +                               </div></div>
77 +
78 +                               <div class="palm-section-divider"></div>
79                                 
80                                 <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
81                                         <div id="dm_airplanemode_status" class="title truncating-text">