5 new, 1 updated patches.
[webos-internals:modifications.git] / screen-lock / screen-lock-no-auto-off-while-charging.patch
1 diff --git a/usr/palm/applications/com.palm.app.screenlock/app/controllers/securityconfig-assistant.js b/usr/palm/applications/com.palm.app.screenlock/app/controllers/securityconfig-assistant.js
2 index 86eb675..0683764 100644
3 --- a/usr/palm/applications/com.palm.app.screenlock/app/controllers/securityconfig-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.screenlock/app/controllers/securityconfig-assistant.js
5 @@ -19,6 +19,10 @@ var SecurityconfigAssistant = Class.create({
6          enableProp: 'enabled',        
7      },
8      
9 +    autoOffChargingtoggleModel: {
10 +        value: false
11 +    },
12 +    
13      switchApptoggleModel: {
14          value: false,
15      },
16 @@ -53,6 +57,9 @@ var SecurityconfigAssistant = Class.create({
17                 //this.controller.setupWidget('blinkAlerts', this.onOffToggleOpt, this.ledThrobberToggleModel);
18                 //Mojo.Event.listen($('blinkAlerts'),'mojo-property-change', this.toggleLEDThrobber.bindAsEventListener(this));
19                 
20 +               this.controller.setupWidget('autoOffCharging', this.onOffToggleOpt, this.autoOffChargingtoggleModel);
21 +               Mojo.Event.listen($('autoOffCharging'),'mojo-property-change', this.toggleautoOffCharging.bindAsEventListener(this));
22 +               
23                 this.controller.setupWidget('switchApps', this.onOffToggleOpt, this.switchApptoggleModel);
24                 Mojo.Event.listen($('switchApps'),'mojo-property-change', this.toggleSwitchApps.bindAsEventListener(this));
25                 
26 @@ -236,6 +243,7 @@ var SecurityconfigAssistant = Class.create({
27                 
28                 this.getSystemlockModeReq = SystemService.getSystemlockMode(this.handleSystemlockMode.bind(this));
29                 this.getSystemlockTimeoutReq = SystemService.getSystemlockTimeout(this.handleSystemlockTimeout.bind(this));
30 +               this.getAutoOffCharging();
31         },
32         
33         updateUI: function(timeout,maximumBrightness) {
34 @@ -551,6 +559,33 @@ var SecurityconfigAssistant = Class.create({
35                 }
36         },
37         
38 +       toggleautoOffCharging: function(event) {
39 +               if(!event)
40 +                       return;
41 +               this.setAutoOffCharging(event.value);
42 +       },
43 +       
44 +       setAutoOffCharging: function(value) {
45 +               this.controller.serviceRequest('palm://com.palm.display/control', {
46 +                       method: 'setProperty',
47 +                       parameters: {
48 +                               onWhenConnected: !value
49 +                       }
50 +               });     
51 +       },
52 +       
53 +       getAutoOffCharging: function() {
54 +               this.controller.serviceRequest('palm://com.palm.display/control', {
55 +                       method: 'getProperty',
56 +                       parameters: {
57 +                               properties: ["onWhenConnected"]
58 +                       },
59 +                       onSuccess: function(payload) {
60 +                               this.autoOffChargingToggleModel.value = !payload.onWhenConnected;
61 +                               this.controller.modelChanged(this.autoOffChargingtoggleModel);
62 +                       }.bind(this)
63 +               });             
64 +       },
65         
66         
67         launchFilePicker: function(event) {
68 diff --git a/usr/palm/applications/com.palm.app.screenlock/app/views/securityconfig/securityconfig-scene.html b/usr/palm/applications/com.palm.app.screenlock/app/views/securityconfig/securityconfig-scene.html
69 index a97b61b..ab92777 100644
70 --- a/usr/palm/applications/com.palm.app.screenlock/app/views/securityconfig/securityconfig-scene.html
71 +++ b/usr/palm/applications/com.palm.app.screenlock/app/views/securityconfig/securityconfig-scene.html
72 @@ -19,11 +19,17 @@
73                                 </div>
74                         </div>
75  
76 -                       <div id='screentimerrow' class="palm-row last">
77 +                       <div id='screentimerrow' class="palm-row">
78                                 <div id='timeroptions' class="palm-row-wrapper">
79                                         <div id="screenOffTimer" x-mojo-element="ListSelector" class="right"></div>
80                                 </div>
81                         </div>
82 +                       <div class="palm-row last">
83 +                               <div class="palm-row-wrapper">
84 +                                       <div x-mojo-element="ToggleButton" id="autoOffCharging"></div>
85 +                                       <div class="title capitalize" style="font-size:0.85em" x-mojo-loc=''>Auto-off while charging</div>
86 +                               </div>
87 +                       </div>
88                 </div>
89          </div>
90          <div class="palm-group">