updates and additions
[webos-internals:jeffrotulls-modifications.git] / top-bar / top-bar-flashlight-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..2c29477 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 @@ -163,6 +163,7 @@ var DevicemenuAssistant = Foundations.Class.create({
6                 this.controller.get('wifi_pref').addEventListener(Mojo.Event.tap,this.handleWiFiLaunch.bind(this));
7                 this.controller.get('vpn_pref').addEventListener(Mojo.Event.tap,this.handleVPNLaunch.bind(this));
8                 this.controller.get('ime_OnOff').addEventListener(Mojo.Event.tap, this.toggleIMEOnOff.bind(this));
9 +               this.controller.get('dm_flash').addEventListener(Mojo.Event.tap, this.toggleFlash.bindAsEventListener(this));
10                 this.controller.get('imelist').addEventListener(Mojo.Event.listTap,this.handleIMETap.bindAsEventListener(this));
11                 this.controller.get('dm_ime').addEventListener(Mojo.Event.tap, this.toggleIMEList.bindAsEventListener(this));
12                 this.controller.get('ime_pref').addEventListener(Mojo.Event.tap,this.handleIMELaunch.bindAsEventListener(this));
13 @@ -438,6 +439,31 @@ var DevicemenuAssistant = Foundations.Class.create({
14                 }
15         },
16         
17 +       toggleFlash: function() {
18 +               if(this.flashVal==0) {
19 +                       this.flashVal = 100;
20 +               } else {
21 +                       this.flashVal = 0;
22 +               }
23 +               this.controller.serviceRequest('palm://ca.canucksoftware.systoolsmgr', {
24 +                       method: 'flashOn',
25 +                       parameters: {
26 +                               value: this.flashVal
27 +                       },
28 +                       onSuccess: function() {
29 +                               this.setFlashLabel();
30 +                       }.bind(this)
31 +               });
32 +       },
33 +       
34 +       setFlashLabel: function() {
35 +               if(this.flashVal==0) {
36 +                       this.controller.get('flashStatus').innerText = $L('Off');
37 +               } else {
38 +                       this.controller.get('flashStatus').innerText = $L('On');
39 +               }
40 +       },
41 +       
42         /*
43          * Disconnect All Bluetooth Profiles.
44          */     
45 @@ -1394,6 +1420,18 @@ var DevicemenuAssistant = Foundations.Class.create({
46         
47         toggleDeviceMenu: function() {
48                 this.clearAllAnimations();
49 +               this.flashVal = 0;
50 +               this.controller.serviceRequest('palm://ca.canucksoftware.systoolsmgr', {
51 +                       method: 'flashState',
52 +                       parameters: {},
53 +                       onSuccess: function(response) {
54 +                               this.flashVal = response.value;
55 +                               this.setFlashLabel();
56 +                       }.bind(this),
57 +                       onFailure: function(err) {
58 +                               this.controller.get('flashStatus').innerText = "Error";
59 +                       }.bind(this)
60 +               });
61                 var self = this;
62                 if(this.isVisible) {
63                         this.isVisible = false;
64 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
65 index e81161a..e842ad7 100644
66 --- a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
67 +++ b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
68 @@ -158,6 +158,15 @@
69                                 </div>  
70                                 
71                                 <div class="palm-section-divider"></div>
72 +
73 +                               <div class="palm-row" id="dm_flash"><div class="palm-row-wrapper">
74 +                                       <div class="title truncating-text">
75 +                                               <div class="label right" id="flashStatus">&nbsp;</div>
76 +                                               <span x-mojo-loc=''>Flashlight</span>
77 +                                       </div>
78 +                               </div></div>
79 +
80 +                               <div class="palm-section-divider"></div>
81                                 
82                                 <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
83                                         <div id="dm_airplanemode_status" class="title truncating-text">
84 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
85 index ee545ef..c2107c5 100644
86 --- a/usr/lib/luna/system/luna-systemui/resources/de/views/devicemenu/devicemenu-scene.html
87 +++ b/usr/lib/luna/system/luna-systemui/resources/de/views/devicemenu/devicemenu-scene.html
88 @@ -159,6 +159,15 @@
89                                 
90                                 <div class="palm-section-divider"></div>
91                                 
92 +                               <div class="palm-row" id="dm_flash"><div class="palm-row-wrapper">
93 +                                       <div class="title truncating-text">
94 +                                               <div class="label right" id="flashStatus">&nbsp;</div>
95 +                                               <span x-mojo-loc=''>Taschenlampe</span>
96 +                                       </div>
97 +                               </div></div>
98 +                               
99 +                               <div class="palm-section-divider"></div>
100 +                               
101                                 <div id="dm_airplanemode" class="palm-row last menu-end" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
102                                         <div id="dm_airplanemode_status" class="title truncating-text">
103                                          </div>