Difference between revisions of "Patch webOS Screenlock On While Connected"
PuffTheMagic (talk | contribs) |
PuffTheMagic (talk | contribs) |
||
Line 65: | Line 65: | ||
updateAlertSettings: function(payload){ | updateAlertSettings: function(payload){ | ||
+ | diff --git a/app/models/DisplayService.js b/app/models/DisplayService.js | ||
+ | new file mode 100644 | ||
+ | index 0000000..27206eb | ||
+ | --- /dev/null | ||
+ | +++ b/app/models/DisplayService.js | ||
+ | @@ -0,0 +1,24 @@ | ||
+ | +var DisplayService = Class.create({ | ||
+ | + initialize: function() { | ||
+ | + } | ||
+ | +}); | ||
+ | + | ||
+ | +DisplayService.identifier = 'palm://com.palm.display/control'; | ||
+ | + | ||
+ | +DisplayService.getStayOnWhenConnected = function(callback) { | ||
+ | + var request = new Mojo.Service.Request(DisplayService.identifier, { | ||
+ | + method: 'getProperty', | ||
+ | + parameters: {"properties":["onWhenConnected"]}, | ||
+ | + onSuccess: callback, | ||
+ | + onFailure: callback | ||
+ | + }); | ||
+ | + return request; | ||
+ | +} | ||
+ | + | ||
+ | +DisplayService.setStayOnWhenConnected = function(value) { | ||
+ | + var request = new Mojo.Service.Request(DisplayService.identifier, { | ||
+ | + method: 'setProperty', | ||
+ | + parameters: {onWhenConnected:value} | ||
+ | + }); | ||
+ | + return request; | ||
+ | +} | ||
diff --git a/app/views/securityconfig/securityconfig-scene.html b/app/views/securityconfig/securityconfig-scene.html | diff --git a/app/views/securityconfig/securityconfig-scene.html b/app/views/securityconfig/securityconfig-scene.html | ||
− | index f99b124.. | + | index f99b124..178cbef 100644 |
− | --- a/app/views/securityconfig/securityconfig-scene.html | + | --- a/app/views/securityconfig/securityconfig-scene.html |
− | +++ b/app/views/securityconfig/securityconfig-scene.html | + | +++ b/app/views/securityconfig/securityconfig-scene.html |
− | @@ -26,6 +26,19 @@ | + | @@ -26,6 +26,19 @@ |
− | </div> | + | </div> |
− | </div> | + | </div> |
− | </div> | + | </div> |
− | + <div class="palm-group"> | + | + <div class="palm-group"> |
− | + <div class="palm-group-title capitalize"> | + | + <div class="palm-group-title capitalize"> |
− | + <span x-mojo-loc=''>Advanced Power Options</span> | + | + <span x-mojo-loc=''>Advanced Power Options</span> |
− | + </div> | + | + </div> |
− | + <div class="palm-list"> | + | + <div class="palm-list"> |
− | + <div class="palm-row single"> | + | + <div class="palm-row single"> |
− | + <div class="palm-row-wrapper"> | + | + <div class="palm-row-wrapper"> |
− | + <div x-mojo-element="ToggleButton" id="stayOnWhenConnected"></div> | + | + <div x-mojo-element="ToggleButton" id="stayOnWhenConnected"></div> |
− | + <div class="title capitalize" x-mojo-loc=''>On When Connected</div> | + | + <div class="title capitalize" x-mojo-loc=''>On When Connected</div> |
− | + </div> | + | + </div> |
− | + </div> | + | + </div> |
− | + </div> | + | + </div> |
− | + </div> | + | + </div> |
− | <div class="palm-group"> | + | <div class="palm-group"> |
<div class="palm-group-title capitalize"> | <div class="palm-group-title capitalize"> | ||
<span x-mojo-loc=''>Wallpaper</span> | <span x-mojo-loc=''>Wallpaper</span> |
Revision as of 18:49, 20 July 2009
This patch will allow you to toggle the onWhenConnected bit via the "Screen & Lock" app.
<source lang="diff"> diff --git a/app/controllers/securityconfig-assistant.js b/app/controllers/securityconfig-assistant.js index 3260f78..d6accfd 100644 --- a/app/controllers/securityconfig-assistant.js +++ b/app/controllers/securityconfig-assistant.js @@ -6,12 +6,17 @@ var SecurityconfigAssistant = Class.create({
this.dialogBox = null; this.getSystemlockModeReq = SystemService.getSystemlockMode(this.handleSystemlockMode.bind(this)); this.getSystemAlertsSetting = SystemService.getShowAlertWhenLocked(this.updateAlertSettings.bind(this));
+ this.getStayOnSetting = DisplayService.getStayOnWhenConnected(this.updateStayOnSettings.bind(this));
}, onOffToggleOpt: { modelProperty: 'value', enableProp: 'enabled', },
+ + stayOnToggleModel: { + value: false, + },
switchApptoggleModel: { value: false,
@@ -34,6 +39,9 @@ var SecurityconfigAssistant = Class.create({
}, setup: function(){
+ + this.controller.setupWidget('stayOnWhenConnected', this.onOffToggleOpt, this.stayOnToggleModel); + Mojo.Event.listen($('stayOnWhenConnected'),'mojo-property-change', this.toggleStayOnWhenConnected.bindAsEventListener(this));
this.controller.setupWidget('showAlerts', this.onOffToggleOpt, this.alertToggleModel); Mojo.Event.listen($('showAlerts'),'mojo-property-change', this.toggleShowAlerts.bindAsEventListener(this));
@@ -297,6 +305,12 @@ var SecurityconfigAssistant = Class.create({
else $('lockImg').hide(); },
+ + toggleStayOnWhenConnected: function(event) { + if(!event) + return; + DisplayService.setStayOnWhenConnected(event.value); + },
toggleShowAlerts: function(event) { if(!event)
@@ -340,6 +354,17 @@ var SecurityconfigAssistant = Class.create({
this.controller.modelChanged(this.timerModel,this); } },
+ + updateStayOnSettings: function(payload){ + + if (!payload) + return; + if (payload.onWhenConnected != undefined) { + this.stayOnToggleModel.value = payload.onWhenConnected; + this.controller.modelChanged(this.stayOnToggleModel, this); + } + + },
updateAlertSettings: function(payload){
diff --git a/app/models/DisplayService.js b/app/models/DisplayService.js new file mode 100644 index 0000000..27206eb --- /dev/null +++ b/app/models/DisplayService.js @@ -0,0 +1,24 @@ +var DisplayService = Class.create({ + initialize: function() { + } +}); + +DisplayService.identifier = 'palm://com.palm.display/control'; + +DisplayService.getStayOnWhenConnected = function(callback) { + var request = new Mojo.Service.Request(DisplayService.identifier, { + method: 'getProperty', + parameters: {"properties":["onWhenConnected"]}, + onSuccess: callback, + onFailure: callback + }); + return request; +} + +DisplayService.setStayOnWhenConnected = function(value) { + var request = new Mojo.Service.Request(DisplayService.identifier, { + method: 'setProperty', + parameters: {onWhenConnected:value} + }); + return request; +} diff --git a/app/views/securityconfig/securityconfig-scene.html b/app/views/securityconfig/securityconfig-scene.html index f99b124..178cbef 100644 --- a/app/views/securityconfig/securityconfig-scene.html +++ b/app/views/securityconfig/securityconfig-scene.html @@ -26,6 +26,19 @@
+
+ Advanced Power Options
+ Wallpaper
diff --git a/index.html b/index.html index 4f999c0..b39a0d3 100644 --- a/index.html +++ b/index.html @@ -11,6 +11,7 @@
Mojo.loadScript('app/controllers/securityconfig-assistant.js'); Mojo.loadScript('app/controllers/pin-assistant.js'); Mojo.loadScript('app/models/SystemService.js');
+ Mojo.loadScript('app/models/DisplayService.js');
</script> <link href="stylesheets/screenlock.css" media="screen" rel="stylesheet" type="text/css" /> </head>
</source>