6 new and 3 modified patches. All via New Portal.
[webos-internals:imagineer1981s-modifications.git] / top-bar / top-bar-device-menu-remix.patch
1 Name: Device Menu Remix
2 Version: 1.3.5-1
3 Author: Jason Robitaille
4 Description: Removes the date, undims the battery level, adds brightness controll, adds GPS toggle, and removes the airplane mode toggle, on the device menu  (MIT license)
5
6 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
7 +++ /usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
8 @@ -27,8 +27,6 @@
9                 //Add a touchable row class
10                 this.controller.get('palm-device-menu').addClassName('palm-touch-rows-'+Mojo.Environment.DeviceInfo.touchableRows);
11                         
12 -               var date = new Date();
13 -               this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '}) +  Mojo.Format.formatDate(date,{date:'long'});
14                 var msg = $L("Battery: #{batlevel}");
15                 this.controller.get('dm_battery').innerHTML = new Template(msg).evaluate({"batlevel": Mojo.Format.formatPercent(this.barAssistant.getBatteryLevel())});
16                                                 
17 @@ -32,6 +30,8 @@
18                 var msg = $L("Battery: #{batlevel}");
19                 this.controller.get('dm_battery').innerHTML = new Template(msg).evaluate({"batlevel": Mojo.Format.formatPercent(this.barAssistant.getBatteryLevel())});
20                                                 
21 +               this.controller.setupWidget('brightSlider', {minValue: 0, maxValue: 100}, this.brightModel = { value: 50});
22 +
23                 this.modesModel = {scrollbars: false, mode: "vertical"},
24                 this.controller.setupWidget('devicescroller', {}, this.modesModel);
25                 this.menuscroller = this.controller.get('devicescroller');
26 @@ -37,6 +37,7 @@
27                 this.menuscroller = this.controller.get('devicescroller');
28                 
29                 this.drawerModel = {myOpenProperty:false};
30 +               this.controller.setupWidget('brightdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
31                 this.controller.setupWidget('wifidetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
32                 this.controller.setupWidget('btdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
33                 this.wifidrawer = this.controller.get('wifidetails');
34 @@ -64,10 +65,10 @@
35                 //Spinner for Airplande Mode
36                 //this.controller.setupWidget('apSpinner', this.spinnerAttrs, this.apSpinnerModel);             
37                         
38 -               if(this.barAssistant.getAirplaneMode())                         
39 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn off Airplane Mode');
40 -               else
41 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn on Airplane Mode');
42 +               //if(this.barAssistant.getAirplaneMode())                       
43 +               //      this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn off Airplane Mode');
44 +               //else
45 +               //      this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn on Airplane Mode');
46                         
47                 var btstate = this.barAssistant.getCurrentBluetoothState();
48                 if(btstate === 'Off') {
49 @@ -113,7 +114,9 @@
50         },
51         
52         activate: function() {
53 -               this.controller.get('dm_airplanemode').addEventListener(Mojo.Event.tap, this.toggleAirplaneMode.bindAsEventListener(this));
54 +               this.controller.get('brightSlider').addEventListener(Mojo.Event.propertyChange, this.handleBrightSlider.bindAsEventListener(this));
55 +               this.controller.get('brightRow').addEventListener(Mojo.Event.tap, this.handleBrightTap.bindAsEventListener(this));
56 +               this.controller.get('dm_gps').addEventListener(Mojo.Event.tap, this.toggleGPS.bindAsEventListener(this));
57                 this.controller.get('wifilist').addEventListener(Mojo.Event.listTap,this.handleWiFiTap.bindAsEventListener(this));
58                 this.controller.get('btlist').addEventListener(Mojo.Event.listTap,this.handleBTTap.bindAsEventListener(this));          
59                 this.controller.get('dm_wifi').addEventListener(Mojo.Event.tap, this.togglewifiList.bindAsEventListener(this));
60 @@ -130,6 +133,37 @@
61         cleanup: function() {
62                 Mojo.Log.error("Device Menu - Clean up called");                                
63         },      
64 +       
65 +       handleBrightTap: function(event) {
66 +               this.controller.get('brightdetails').mojo.setOpenState(!this.controller.get('brightdetails').mojo.getOpenState());
67 +       },
68 +
69 +       handleBrightSlider: function(event) {
70 +               this.controller.serviceRequest('palm://com.palm.display/control', {
71 +                       method: 'setProperty',
72 +                       parameters:{maximumBrightness:Math.round(event.value)}
73 +               });
74 +               this.controller.get('dm_brightness').innerText = "Brightness: " + Math.round(event.value) + "%";
75 +       },
76 +       
77 +       toggleGPS: function(event) {
78 +               this.gpsEnabled = !this.gpsEnabled;
79 +               this.controller.serviceRequest('palm://com.palm.location', {
80 +                       method: 'setUseGps',
81 +                       parameters: {
82 +                               useGps: this.gpsEnabled
83 +                       }
84 +               });
85 +               this.setGPSLabel();
86 +       },
87 +
88 +       setGPSLabel: function() {
89 +               if(this.gpsEnabled) {
90 +                       this.controller.get('gpsStatus').innerText = "On";
91 +               } else {
92 +                       this.controller.get('gpsStatus').innerText = "Off";
93 +               }
94 +       },
95                         
96         wifiAPList: [],
97         btdeviceList: [],
98 @@ -169,13 +203,13 @@
99                 //this.apSpinnerModel.spinning = false;
100                 //this.controller.modelChanged(this.apSpinnerModel);
101                 
102 -               if(this.barAssistant.getAirplaneMode()) {
103 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn off Airplane Mode');                 
104 -               }                       
105 -               else {                  
106 -                       this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn on Airplane Mode');
107 -               }
108 -               this.apModeInProgress = false;
109 +               //if(this.barAssistant.getAirplaneMode()) {
110 +               //      this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn off Airplane Mode');                 
111 +               //}                     
112 +               //else {                        
113 +               //      this.controller.get('dm_airplanemode_status').innerHTML = $L('Turn on Airplane Mode');
114 +               //}
115 +               //this.apModeInProgress = false;
116         },
117         
118         toggleBTRadio: function(event) {
119 @@ -932,6 +966,7 @@
120                         this.controller.hideWidgetContainer(this.controller.get('wifidetails'));
121                         this.wifidrawer.mojo.setOpenState(false);
122                 }               
123 +               this.controller.get('brightdetails').mojo.setOpenState(false);
124                 //this.isVisible = false;
125                 if(this.isVisible){
126                         this.toggleDeviceMenu();
127 @@ -973,8 +1008,28 @@
128                 }
129                 else {
130                         this.isVisible = true;
131 -                       var date = new Date();          
132 -                       this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '})  +  Mojo.Format.formatDate(date,{date:'long'});
133 +                       this.controller.serviceRequest('palm://com.palm.display/control', {
134 +                               method: 'getProperty',
135 +                               parameters:{properties:['maximumBrightness']},
136 +                               onSuccess: function(response) {
137 +                                       if(response.maximumBrightness != undefined) {
138 +                                               this.brightModel.value = parseInt(response.maximumBrightness);
139 +                                               this.controller.modelChanged(this.brightModel);
140 +                                               this.controller.get('dm_brightness').innerText = "Brightness: " + response.maximumBrightness + "%";
141 +                                       } else {
142 +                                               this.controller.get('dm_brightness').innerText = "Brightness: ??%";
143 +                                       }
144 +                               }.bind(this)
145 +                       });
146 +                       this.controller.serviceRequest('palm://com.palm.location', {
147 +                               method: 'getUseGps',
148 +                               parameters: {},
149 +                               onSuccess: function(response) {
150 +                                       this.gpsEnabled = response.useGps;
151 +                                       this.setGPSLabel();
152 +                               }.bind(this)
153 +                       });
154 +                       
155                         this.controller.stageController.activate();
156                         
157                         var animateDialog = function(){
158 --- .orig/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
159 +++ /usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
160 @@ -14,17 +14,23 @@
161                 <div id="devicescroller" class="palm-popup-content" x-mojo-element="Scroller">       
162                         <div class="palm-list">          
163                                 
164 -                               <div class="palm-row first"><div class="palm-row-wrapper">
165 -                                       <div id="dm_date" class="title dim"></div>
166 -                               </div></div>
167 -                               
168 -                               <div class="palm-section-divider">
169 -                               </div> 
170 -                               
171                                 <div class="palm-row"><div class="palm-row-wrapper">
172 -                                       <div id="dm_battery" class="title dim"></div>
173 +                                       <div id="dm_battery" class="title"></div>
174                                 </div></div> 
175                                 
176 +                                                               <div class="palm-section-divider">
177 +                               </div>
178 +
179 +                               <div class="palm-row" id="brightRow" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
180 +                                       <div id="dm_brightness" class="title"></div>
181 +                               </div></div>
182 +
183 +                               <div id="brightdetails" x-mojo-element="Drawer">
184 +                                       <div class="palm-row first"><div class="palm-row-wrapper">
185 +                                               <div x-mojo-element="Slider" id="brightSlider" style="padding-top: 30px; height: 50px;"></div>
186 +                                       </div></div>
187 +                               </div>
188 +                               
189                                 <div class="palm-section-divider">
190                                 </div>               
191                                 
192 @@ -95,11 +101,12 @@
193                                 <div class="palm-section-divider"></div>
194                                 
195 -                               <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
196 -                                       <div id="dm_airplanemode_status" class="title truncating-text">
197 -                                        </div>
198 -                                        <!--<div id='apSpinner' class='label' x-mojo-element="Spinner"></div>-->
199 -                               </div></div>   
200 +                               <div class="palm-row last menu-end" id="dm_gps" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
201 +                                       <div class="title truncating-text">
202 +                                               <div class="label right" id="gpsStatus">&nbsp;</div>
203 +                                               <span x-mojo-loc=''>GPS</span>
204 +                                       </div>
205 +                               </div></div>
206                                 
207                                 </div>       
208                         </div>
209                 </div>