Difference between revisions of "Patch webOS Screenlock On While Connected"

From WebOS Internals
Jump to navigation Jump to search
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{template:patch}}
 
<table cellpadding="10">
 
<table cellpadding="10">
 
  <tr>
 
  <tr>
 
   <td>This patch will allow you to toggle the ''onWhenConnected'' bit via the "Screen & Lock" app which keeps the Pre powered on while its connected to a power supply.
 
   <td>This patch will allow you to toggle the ''onWhenConnected'' bit via the "Screen & Lock" app which keeps the Pre powered on while its connected to a power supply.
 +
 +
'''I applied this patch by hand by editing the specified files and creating DisplayService.js. 
 +
 +
It works, but I'd say don't try to apply this patch in the automated method because there are some differences in the line numbers.'''
 +
-pitcjd01
 
<source lang="diff">
 
<source lang="diff">
 
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
 
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

Latest revision as of 05:12, 12 August 2009


This patch will allow you to toggle the onWhenConnected bit via the "Screen & Lock" app which keeps the Pre powered on while its connected to a power supply.

I applied this patch by hand by editing the specified files and creating DisplayService.js.

It works, but I'd say don't try to apply this patch in the automated method because there are some differences in the line numbers. -pitcjd01 <source lang="diff"> 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 index 3260f78..3979abe 100644 --- 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 @@ -6,6 +6,7 @@ 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: {

@@ -13,6 +14,10 @@ var SecurityconfigAssistant = Class.create({

        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));

@@ -298,6 +306,12 @@ var SecurityconfigAssistant = Class.create({

			$('lockImg').hide();
	},
		

+ toggleStayOnWhenConnected: function(event) { + if(!event) + return; + DisplayService.setStayOnWhenConnected(event.value); + }, +

	toggleShowAlerts: function(event) {
		if(!event)
			return;		

@@ -341,6 +355,17 @@ var SecurityconfigAssistant = Class.create({

		}		
	},	
	

+ updateStayOnSettings: function(payload){ + + if (!payload) + return; + if (payload.onWhenConnected != undefined) { + this.stayOnToggleModel.value = payload.onWhenConnected; + this.controller.modelChanged(this.stayOnToggleModel, this); + } + + }, +

	updateAlertSettings: function(payload){
		
		if (!payload) 

diff --git a/usr/palm/applications/com.palm.app.screenlock/app/models/DisplayService.js b/usr/palm/applications/com.palm.app.screenlock/app/models/DisplayService.js new file mode 100644 index 0000000..0f72c04 --- /dev/null +++ b/usr/palm/applications/com.palm.app.screenlock/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/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 index f99b124..5a5b880 100644 --- 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 @@ -26,6 +26,19 @@

+
+

+ Advanced Power Options

+
+
+
+
+
+
On When Connected
+
+
+
+
			Wallpaper

diff --git a/usr/palm/applications/com.palm.app.screenlock/index.html b/usr/palm/applications/com.palm.app.screenlock/index.html index 4f999c0..0dc9b6b 100644 --- a/usr/palm/applications/com.palm.app.screenlock/index.html +++ b/usr/palm/applications/com.palm.app.screenlock/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>

PalmAppMod-screenlock OnWhenConnect.png