updates and additions
[webos-internals:djcin7s-modifications.git] / top-bar / top-bar-brightness-in-device-menu---de.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 5beb152..e07324f 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 @@ -32,12 +32,14 @@ var DevicemenuAssistant = Foundations.Class.create({
6                 this.controller.get('dm_date').innerHTML = Mojo.Format.formatDate(date,{date:'EEE '}) +  Mojo.Format.formatDate(date,{date:'long'});
7                 var msg = $L("Battery: #{batlevel}");
8                 this.controller.get('dm_battery').innerHTML = new Template(msg).evaluate({"batlevel": Mojo.Format.formatPercent(this.barAssistant.getBatteryLevel())});
9 +               this.controller.setupWidget('brightSlider', {minValue: 1, maxValue: 100}, this.brightModel = { value: 50});
10                                                 
11                 this.modesModel = {scrollbars: false, mode: "vertical"},
12                 this.controller.setupWidget('devicescroller', {}, this.modesModel);
13                 this.menuscroller = this.controller.get('devicescroller');
14                 
15                 this.drawerModel = {myOpenProperty:false};
16 +               this.controller.setupWidget('brightdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
17                 this.controller.setupWidget('imedetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
18                 this.controller.setupWidget('wifidetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
19                 this.controller.setupWidget('btdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
20 @@ -150,6 +152,8 @@ var DevicemenuAssistant = Foundations.Class.create({
21         },
22         
23         activate: function() {
24 +               this.controller.get('brightSlider').addEventListener(Mojo.Event.propertyChange, this.handleBrightSlider.bindAsEventListener(this));
25 +               this.controller.get('brightRow').addEventListener(Mojo.Event.tap, this.handleBrightTap.bindAsEventListener(this));
26                 this.controller.get('dm_airplanemode').addEventListener(Mojo.Event.tap, this.toggleAirplaneMode.bind(this));
27                 this.controller.get('wifilist').addEventListener(Mojo.Event.listTap,this.handleWiFiTap.bind(this));
28                 this.controller.get('btlist').addEventListener(Mojo.Event.listTap,this.handleBTTap.bind(this));
29 @@ -171,6 +175,17 @@ var DevicemenuAssistant = Foundations.Class.create({
30                 this._stageRef = 1;
31                 this.toggleDeviceMenu();                                                
32         },      
33 +       handleBrightTap: function(event) {
34 +               this.controller.get('brightdetails').mojo.setOpenState(!this.controller.get('brightdetails').mojo.getOpenState());
35 +       },
36 +
37 +       handleBrightSlider: function(event) {
38 +               this.controller.serviceRequest('palm://com.palm.display/control', {
39 +                       method: 'setProperty',
40 +                       parameters:{maximumBrightness:Math.round(event.value)}
41 +               });
42 +               this.controller.get('dm_brightness').innerText = "Helligkeit: " + Math.round(event.value) + "%";
43 +       },
44                 
45         cleanup: function() {
46                 Mojo.Log.error("Device Menu - Clean up called");
47 @@ -1236,6 +1251,7 @@ var DevicemenuAssistant = Foundations.Class.create({
48                         this.controller.hideWidgetContainer(this.controller.get('wifidetails'));
49                         this.wifidrawer.mojo.setOpenState(false);
50                 }
51 +               this.controller.get('brightdetails').mojo.setOpenState(false);
52                 if(this.vpndrawer.mojo.getOpenState()) {
53                         this.controller.hideWidgetContainer(this.controller.get('vpndetails'));
54                         this.vpndrawer.mojo.setOpenState(false);
55 @@ -1438,6 +1454,20 @@ var DevicemenuAssistant = Foundations.Class.create({
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                         
59 +                       this.controller.serviceRequest('palm://com.palm.display/control', {
60 +                               method: 'getProperty',
61 +                               parameters:{properties:['maximumBrightness']},
62 +                               onSuccess: function(response) {
63 +                                       if(response.maximumBrightness != undefined) {
64 +                                               this.brightModel.value = parseInt(response.maximumBrightness);
65 +                                               this.controller.modelChanged(this.brightModel);
66 +                                               this.controller.get('dm_brightness').innerText = "Helligkeit: " + response.maximumBrightness + "%";
67 +                                       } else {
68 +                                               this.controller.get('dm_brightness').innerText = "Helligkeit: ??%";
69 +                                       }
70 +                               }.bind(this)
71 +                       });
72 +                       
73                         if(this.turningOnBtRadio) {
74                                 this.btspinnerModel.spinning = true;
75                                 this.controller.modelChanged(this.btspinnerModel);
76 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
77 index e81161a..8f4d835 100644
78 --- a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
79 +++ b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
80 @@ -25,6 +25,14 @@
81                                         <div id="dm_battery" class="title dim"></div>
82                                 </div></div> 
83  
84 +                               <div class="palm-row" id="brightRow" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
85 +                                       <div id="dm_brightness" class="title"></div>
86 +                               </div></div>
87 +                               <div id="brightdetails" x-mojo-element="Drawer">
88 +                                       <div class="palm-row first"><div class="palm-row-wrapper">
89 +                                               <div x-mojo-element="Slider" id="brightSlider" style="padding-top: 30px; height: 50px;"></div>
90 +                                       </div></div>
91 +                               </div>
92                                 <div class="palm-section-divider"></div>
93                                 
94                                 <div class="palm-row" id="dm_ime" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
95 diff --git a/usr/lib/luna/system/luna-systemui/resources/de/views/devicemenu/devicemenu-scene.html b/usr/lib/luna/system/luna-systemui/resources/de/views/devicemenu/devicemenu-scene.html
96 index ee545ef..c0dba59 100644
97 --- a/usr/lib/luna/system/luna-systemui/resources/de/views/devicemenu/devicemenu-scene.html
98 +++ b/usr/lib/luna/system/luna-systemui/resources/de/views/devicemenu/devicemenu-scene.html
99 @@ -60,7 +60,20 @@
100                                 </div> 
101                                 
102                                 <div class="palm-section-divider">
103 -                               </div>               
104 +                               </div> 
105 +                               
106 +                               <div class="palm-row" id="brightRow" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
107 +                                       <div id="dm_brightness" class="title"></div>
108 +                               </div></div>
109 +
110 +                               <div id="brightdetails" x-mojo-element="Drawer">
111 +                                       <div class="palm-row first"><div class="palm-row-wrapper">
112 +                                               <div x-mojo-element="Slider" id="brightSlider" style="padding-top: 30px; height: 50px;"></div>
113 +                                       </div></div>
114 +                               </div>
115 +
116 +                               <div class="palm-section-divider">
117 +                               </div>                             
118                                 
119                                 <div class="palm-row" id="dm_wifi" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
120                                         <div class="title truncating-text">