Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4793 from alivedise/add-screen-timeout-settings

Add screen timeout settings
  • Loading branch information...
commit b0ef482f64d2774c9565d3c1d0a44c06091547bf 2 parents 9b7e434 + 79bcc3e
@vingtetun vingtetun authored
View
22 apps/settings/index.html
@@ -79,7 +79,7 @@ <h2 data-l10n-id="personalization">Personalization</h2>
<a href="#sounds" data-l10n-id="sound">Sound</a>
</li>
<li>
- <a href="#brightness" data-l10n-id="brightness">Brightness</a>
+ <a href="#display" data-l10n-id="display">Display</a>
</li>
<li>
<a href="#wallpaper" data-l10n-id="wallpaper">Wallpaper</a>
@@ -667,12 +667,12 @@ <h2 data-l10n-id="messages">Messages</h2>
</ul>
</section>
- <!-- Personalization :: Brightness -->
- <section role="region" id="brightness">
+ <!-- Personalization :: Display -->
+ <section role="region" id="display">
<header>
<a href="#root"><span class="icon icon-back">back</span></a>
- <h1 data-l10n-id="brightness">
- Brightness
+ <h1 data-l10n-id="display">
+ Display
</h1>
</header>
@@ -690,6 +690,18 @@ <h3 data-l10n-id="brightness">Brightness level</h3>
</label>
<a data-l10n-id="automatic-brightness">Automatic Brightness</a>
</li>
+ <li>
+ <label>
+ <select name="screen.timeout">
+ <option value="60" data-l10n-id="one-minute" selected>1 minute</option>
+ <option value="120" data-l10n-id="two-minutes">2 minute</option>
+ <option value="300" data-l10n-id="five-minutes">5 minute</option>
+ <option value="600" data-l10n-id="ten-minutes">10 minute</option>
+ <option value="0" data-l10n-id="never">Never</option>
+ </select>
+ </label>
+ <a data-l10n-id="screen-timeout">Screen Timeout</a>
+ </li>
</ul>
</section>
View
20 apps/settings/js/settings.js
@@ -145,6 +145,23 @@ var Settings = {
}
}
);
+
+ // preset all select
+ var selects = document.querySelectorAll('select');
+ for (i = 0; i < selects.length; i++) {
+ (function(select) {
+ var key = select.name;
+ if (!key)
+ return;
+
+ var request = lock.get(key);
+ request.onsuccess = function() {
+ var value = request.result[key];
+ if (value != undefined)
+ select.querySelector('option[value="' + value + '"]').selected = true;
+ };
+ })(selects[i]);
+ }
},
handleEvent: function settings_handleEvent(evt) {
@@ -161,7 +178,8 @@ var Settings = {
value = input.checked;
} else if ((input.type == 'radio') ||
(input.type == 'text') ||
- (input.type == 'password')) {
+ (input.type == 'password') ||
+ (input.tagName.toLowerCase() == 'select')) {
value = input.value;
}
var cset = {}; cset[key] = value;
View
6 apps/settings/locales/settings.en-US.properties
@@ -145,6 +145,12 @@ wallpaper=Wallpaper
balloon=Balloon
water=Water
leaves=Leaves
+screen-timeout=Screen Timeout
+one-minute=1 minute
+two-minutes=2 minute
+five-minutes=5 minute
+ten-minutes=10 minute
+never=never
# Personalization :: Notifications
notifications=Notifications
View
0  apps/settings/style/images/settings_brightness.png → apps/settings/style/images/settings_display.png
File renamed without changes
View
12 apps/settings/style/lists.css
@@ -149,6 +149,16 @@ ul li button, ul li a[role=button] {
margin: 1.5rem auto;
}
+[role=region] label > select {
+ display: inline-block;
+ left: auto;
+ right: 2rem;
+ position: absolute;
+ height: 3rem;
+ margin: 1.5rem auto;
+ font-size: 2rem;
+}
+
#brightness-level:active {
background-color: #f5f5f5;
text-shadow: none;
@@ -176,7 +186,7 @@ ul li button, ul li a[role=button] {
#root li [data-l10n-id="bluetooth"] { background-image: url(images/settings_bluetooth.png); }
#root li [data-l10n-id="hotspot"] { background-image: url(images/settings_hotspot.png); }
#root li [data-l10n-id="sound"] { background-image: url(images/settings_sound.png); }
-#root li [data-l10n-id="brightness"] { background-image: url(images/settings_brightness.png); }
+#root li [data-l10n-id="display"] { background-image: url(images/settings_display.png); }
#root li [data-l10n-id="wallpaper"] { background-image: url(images/settings_wallpaper.png); }
#root li [data-l10n-id="notifications"] { background-image: url(images/settings_notifications.png); }
#root li [data-l10n-id="timeAndDate"] { background-image: url(images/settings_datetime.png); }
Please sign in to comment.
Something went wrong with that request. Please try again.