28 Updates for Patches
[webos-internals:modifications.git] / top-bar / top-bar-roam-only-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 2a42b1a..eff6bd9 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 @@ -123,6 +123,7 @@ var DevicemenuAssistant = Class.create({
6                 this.controller.get('bt_pref').addEventListener(Mojo.Event.tap,this.handleBluetoothLaunch.bindAsEventListener(this));
7                 this.controller.get('wifi_pref').addEventListener(Mojo.Event.tap,this.handleWiFiLaunch.bindAsEventListener(this));
8                 this.controller.get('scrim').addEventListener(Mojo.Event.tap, this.toggleDeviceMenu.bindAsEventListener(this));
9 +               this.controller.get('dm_roam').addEventListener(Mojo.Event.tap, this.toggleRoam.bindAsEventListener(this));
10                 //Close the App because this is a first launch.
11                 this.toggleDeviceMenu();                                                
12         },      
13 @@ -230,6 +231,30 @@ var DevicemenuAssistant = Class.create({
14                 this.btdeviceList.clear();              
15         },
16         
17 +       toggleRoam: function(event) {
18 +               if(this.roamStatus=="roamonly") {
19 +                       this.roamStatus="any";
20 +               } else {
21 +                       this.roamStatus="roamonly";
22 +               }
23 +               this.controller.serviceRequest('palm://com.palm.telephony', {
24 +                       method: 'roamModeSet',
25 +                       parameters: {
26 +                               mode: this.roamStatus,
27 +                               client: Mojo.appName
28 +                       }
29 +               });
30 +               this.setRoamLabel();
31 +       },
32 +
33 +       setRoamLabel: function() {
34 +               if(this.roamStatus=="roamonly") {
35 +                       this.controller.get('roamStatus').innerText = "On";
36 +               } else {
37 +                       this.controller.get('roamStatus').innerText = "Off";
38 +               }
39 +       },
40 +
41         /*
42          * Handles the Bluetooth Device connect or disconnect when tapped on the device.
43          */
44 @@ -973,6 +998,14 @@ var DevicemenuAssistant = Class.create({
45                 }
46                 else {
47                         this.isVisible = true;
48 +                       this.controller.serviceRequest('palm://com.palm.telephony', {
49 +                               method: 'roamModeQuery',
50 +                               parameters: {},
51 +                               onSuccess: function(response) {
52 +                                       this.roamStatus = response.extended.mode;
53 +                                       this.setRoamLabel();
54 +                               }.bind(this)
55 +                       });
56                         var date = new Date();          
57                         this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '})  +  Mojo.Format.formatDate(date,{date:'long'});
58                         this.controller.stageController.activate();
59 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
60 index 933094e..968977b 100644
61 --- a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
62 +++ b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
63 @@ -94,6 +94,15 @@
64                                 
65                                 <div class="palm-section-divider"></div>
66                                 
67 +                               <div class="palm-row" id="dm_roam" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
68 +                                       <div class="title truncating-text">
69 +                                               <div class="label right" id="roamStatus">&nbsp;</div>
70 +                                               <span x-mojo-loc=''>Roam Only</span>
71 +                                       </div>
72 +                               </div></div>
73 +
74 +                               <div class="palm-section-divider"></div>
75 +                               
76                                 <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
77                                         <div id="dm_airplanemode_status" class="title truncating-text">
78                                          </div>