Results 1 to 9 of 9
  1.    #1  
    Hi,

    I'm trying to create a patch for WebOS that will allow me to add more options to the "Lock After" section of the Screen & Lock app. I want this because I'd like to have my phone lock the screen roughly once per day. But not more often than that. The idea being that I want it to be inconvenient for someone who finds my phone if I lose it, but not too inconvenient for me.

    Anyway, I found the part of the code which sets the options list. It's in
    /usr/palm/applications/com.palm.app.screenlock/app/controllers/securityconfig-assistant.jsjsjs
    Code:
      //Available Lock Timer Values.
      availableLockTimers: [
                {label: $L('Screen turns off'), value:0},
                {label: $L('30 seconds'), value:30},
                {label: $L('1 minute'), value:60},
                {label: $L('2 minutes'), value:120},
                {label: $L('3 minutes'), value:180},
                {label: $L('5 minutes'), value:300},
                {label: $L('10 minutes'), value:600},
                {label: $L('30 minutes'), value:1800}
      ],
    I changed this to add the values that I want:
    Code:
      //Available Lock Timer Values.
      availableLockTimers: [
                {label: $L('Screen turns off'), value:0},
                {label: $L('30 seconds'), value:30},
                {label: $L('1 minute'), value:60},
                {label: $L('2 minutes'), value:120},
                {label: $L('3 minutes'), value:180},
                {label: $L('5 minutes'), value:300},
                {label: $L('10 minutes'), value:600},
                {label: $L('30 minutes'), value:1800},
                {label: $L('1 hour'), value:3600},
                {label: $L('2 hours'), value:7200},
                {label: $L('8 hours'), value:28800}
      ],
    After having done this, I did a Luna Restart, and the options show up correctly in the screen & lock app.

    The problem is when I try to select one of them. It appears to work, but when I close the "Screen & Lock" application and restart it, it doesn't show what I selected. It shows either "30 minutes" (if I wanted 1 hour or 2 hours) or "Screen turns off" (if I wanted 8 hours).

    I don't understand why.

    I think it might have something to do with this section, but I'm struggling to understand it.
    Code:
    handleSystemlockTimeout: function(response) {
    
    		if (response.lockTimeout !== undefined) {
    			this.lockTimerModel.currentLockTimer = response.lockTimeout;
    
    			if (this.securityPolicyInactivityTimer !== undefined && this.securityPolicy) {
    				for (var i=0; i<this.availableLockTimers.length; i++) {
    					if (this.availableLockTimers[i].value > this.securityPolicyInactivityTimer) {
    						this.availableLockTimers.splice(i, this.availableLockTimers.length-i);
    						break;
    					}
    				}
    				//The last value in the list should be same as the policy inactivity timer value. If not, add it to the list.
    				if(this.availableLockTimers[this.availableLockTimers.length-1].value !== this.securityPolicyInactivityTimer) {
    					var obj = {};
    					obj.label = $L('#{policyInactivityTimer} minutes').interpolate({policyInactivityTimer: this.securityPolicyInactivityTimer/60});
    					obj.value = this.securityPolicyInactivityTimer;
    					this.availableLockTimers.push(obj);
    				}	
    			}
    			this.controller.modelChanged(this.lockTimerModel, this);
    		}
    		delete this.getSystemlockTimeoutReq;
    	},
    Where can I go for help on this?
    Twitter: dullgeek
  2. #2  
    I'll look into this when I get home if no one is able to solve it.


    If I helped you or you have downloaded one of my files,
    then least you could do is click the "Thanks" button.
  3.    #3  
    Thanks. Any luck?
    Twitter: dullgeek
  4. #4  
    Sorry, I've been busy. I'll get to it when I have the time. Most likely when I get of work today.
  5.    #5  
    I appreciate it. Of course, if it's easier just to point me elsewhere that I might look for assistance, you're welcome to do that. I'm interested in two things:
    1. learning
    2. getting the functionality I'm looking for

    Thanks, again.
    Twitter: dullgeek
  6. #6  
    Quote Originally Posted by mu7efcer View Post
    I'm interested in two things:
    1. learning
    2. getting the functionality I'm looking for
    I too would like this functionality and considered writing my own patch (it would be my first webOS dev project). So this is a bump, me too, and a please!! (all in one)
    PalmIII -> PalmV -> Sprint Treo650 -> Treo755P -> Pre

    "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."

    --Andrew Tanenbaum
  7. #7  
    It appears that values are limited to eight, otherwise they don't appear on the list.
    Overwriting or commenting out an unwanted value seems to do the trick.

    Try:
    //Available Lock Timer Values.
    availableLockTimers: [
    {label: $L('Screen turns off'), value:0},
    {label: $L('30 seconds'), value:30},
    {label: $L('1 minute'), value:60},
    {label: $L('2 minutes'), value:120},
    {label: $L('3 minutes'), value:180},
    // {label: $L('5 minutes'), value:300},
    // {label: $L('10 minutes'), value:600},
    // {label: $L('30 minutes'), value:1800},
    {label: $L('1 hour'), value:3600},
    {label: $L('2 hours'), value:7200},
    {label: $L('8 hours'), value:28800}
    ],
  8. #8  
    Quote Originally Posted by gmccoyWP View Post
    It appears that values are limited to eight, otherwise they don't appear on the list.
    Overwriting or commenting out an unwanted value seems to do the trick.
    Thanks!! Awesome! I don't want most of their defaults anyway!

    I just need to figure out how to do this now. It's been a long time coming.

    I have (shamefully) turned off the lock functionality because it's such a pain!
    PalmIII -> PalmV -> Sprint Treo650 -> Treo755P -> Pre

    "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."

    --Andrew Tanenbaum
  9. #9  
    Quote Originally Posted by gmccoyWP View Post
    It appears that values are limited to eight, otherwise they don't appear on the list.
    Overwriting or commenting out an unwanted value seems to do the trick.

    Try:
    //Available Lock Timer Values.
    availableLockTimers: [
    {label: $L('Screen turns off'), value:0},
    {label: $L('30 seconds'), value:30},
    {label: $L('1 minute'), value:60},
    {label: $L('2 minutes'), value:120},
    {label: $L('3 minutes'), value:180},
    // {label: $L('5 minutes'), value:300},
    // {label: $L('10 minutes'), value:600},
    // {label: $L('30 minutes'), value:1800},
    {label: $L('1 hour'), value:3600},
    {label: $L('2 hours'), value:7200},
    {label: $L('8 hours'), value:28800}
    ],
    I went down this path a while ago as well (there is a thread that i started also) and even commenting out some of the lines does not work for me. It will add those values to the list, but the values won't "stick". i.e. once you close the app, it will be reset to "screen turns off" :-(
    I am the creator of the PalmSpot entry “webOS Does, and Does, and Does Some More”, writes Save/Restore scripts and helps manage the script feed, and now writes webOS Nation's Tip of the Day

    Got a good tip for webOS Nation's Tip of the Day? Please send me a PM or use the Contact Us form and select "Suggest a tip"

    Like any of my work:

Posting Permissions