28 Updates for Patches
[webos-internals:imagineer1981s-modifications.git] / top-bar / top-bar-gps-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..5348456 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 @@ -130,6 +130,7 @@ var DevicemenuAssistant = Class.create({
6                 this.controller.get('bt_radio').addEventListener(Mojo.Event.tap, this.toggleBTRadio.bindAsEventListener(this));
7                 this.controller.get('bt_pref').addEventListener(Mojo.Event.tap,this.handleBluetoothLaunch.bindAsEventListener(this));
8                 this.controller.get('wifi_pref').addEventListener(Mojo.Event.tap,this.handleWiFiLaunch.bindAsEventListener(this));
9 +               this.controller.get('dm_gps').addEventListener(Mojo.Event.tap, this.toggleGPS.bindAsEventListener(this));
10                 this.controller.get('scrim').addEventListener(Mojo.Event.tap, this.toggleDeviceMenu.bindAsEventListener(this));
11                 //Close the App because this is a first launch.
12                 this.toggleDeviceMenu();                                                
13 @@ -186,6 +187,25 @@ var DevicemenuAssistant = Class.create({
14                 this.apModeInProgress = false;
15         },
16         
17 +       toggleGPS: function(event) {
18 +               this.gpsEnabled = !this.gpsEnabled;
19 +               this.controller.serviceRequest('palm://com.palm.location', {
20 +                       method: 'setUseGps',
21 +                       parameters: {
22 +                               useGps: this.gpsEnabled
23 +                       }
24 +               });
25 +               this.setGPSLabel();
26 +       },
27 +
28 +       setGPSLabel: function() {
29 +               if(this.gpsEnabled) {
30 +                       this.controller.get('gpsStatus').innerText = "On";
31 +               } else {
32 +                       this.controller.get('gpsStatus').innerText = "Off";
33 +               }
34 +       },
35 +       
36         updateAirplaneModeProgress: function() {
37                 if(this.barAssistant.getAirplaneMode()) {
38                         this.controller.get('dm_airplanemode_status').innerHTML = $L('Turning on Airplane Mode');
39 @@ -1090,6 +1110,15 @@ var DevicemenuAssistant = Class.create({
40                                 );
41                         }
42              
43 +                       this.controller.serviceRequest('palm://com.palm.location', {
44 +                               method: 'getUseGps',
45 +                               parameters: {},
46 +                               onSuccess: function(response) {
47 +                                       this.gpsEnabled = response.useGps;
48 +                                       this.setGPSLabel();
49 +                               }.bind(this)
50 +                       });
51 +
52                         //animate the scrim onto the scene and then the submenu
53                         Mojo.Animation.animateStyle(this.scrim, 'opacity', 'bezier', {
54                                                 from: 0,
55 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
56 index d153a8d..b5b953b 100644
57 --- a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
58 +++ b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
59 @@ -97,6 +97,15 @@
60                                 
61                                 <div class="palm-section-divider"></div>
62                                 
63 +                               <div class="palm-row" id="dm_gps" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
64 +                                       <div class="title truncating-text">
65 +                                               <div class="label right" id="gpsStatus">&nbsp;</div>
66 +                                               <span x-mojo-loc=''>GPS</span>
67 +                                       </div>
68 +                               </div></div>
69 +
70 +                               <div class="palm-section-divider"></div>
71 +                               
72                                 <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
73                                         <div id="dm_airplanemode_status" class="title truncating-text">
74                                          </div>