Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #10405 from daleharvey/882175
Browse files Browse the repository at this point in the history
Bug 882175 - Fix cellbroadcast settings UI to not display opposite of actual value. r=kaze(cherry picked from commit 5ad48f6)

Conflicts:
	apps/settings/index.html
	apps/settings/js/call.js
	apps/settings/js/settings.js
  • Loading branch information
daleharvey committed Jun 21, 2013
1 parent f638e04 commit c411b04
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
5 changes: 3 additions & 2 deletions apps/settings/index.html
Expand Up @@ -38,6 +38,7 @@
<!-- shared helper library -->
<!--<script defer src="shared/js/mobile_operator.js"></script>-->
<!--<script defer src="shared/js/async_storage.js"></script>-->
<!--<script defer src="shared/js/settings_listener.js"></script> -->

<!-- all non-#root panels will lazy-load their own scripts -->
</head>
Expand Down Expand Up @@ -529,9 +530,9 @@ <h1 data-l10n-id="callSettings"> Call Settings </h1>
</label>
<a data-l10n-id="callWaiting">Call Waiting</a>
</li>
<li id="menuItem-cellBroadcast">
<li id="menuItem-cellBroadcast" class="disabled">
<label class="checkbox-label">
<input type="checkbox" data-type="switch" name="ril.cellbroadcast.disabled" />
<input type="checkbox" data-type="switch" data-ignore disabled />
<span></span>
</label>
<a data-l10n-id="cellBroadcast">Cell broadcast service</a>
Expand Down
31 changes: 30 additions & 1 deletion apps/settings/js/call.js
Expand Up @@ -417,7 +417,35 @@ var Calls = (function(window, document, undefined) {
});
}

var callWaitingItemListener = function (evt) {
// The UI for cell broadcast indicates that it is enabled or not, whereas
// the setting used is 'disabled' so note that we switch the value when
// it is set or displayed
function initCellBroadcast() {
var CBS_KEY = 'ril.cellbroadcast.disabled';
var wrapper = document.getElementById('menuItem-cellBroadcast');
var input = wrapper.querySelector('input');
var init = false;

var cellBroadcastChanged = function(value) {
input.checked = !value;
if (!init) {
input.disabled = false;
wrapper.classList.remove('disabled');
init = true;
}
};

var inputChanged = function(event) {
var cbsset = {};
cbsset[CBS_KEY] = !input.checked;
settings.createLock().set(cbsset);
};

input.addEventListener('change', inputChanged);
SettingsListener.observe(CBS_KEY, false, cellBroadcastChanged);
}

var callWaitingItemListener = function(evt) {
var alertPanel = document.querySelector('#call .cw-alert');
var confirmInput =
alertPanel.querySelector('.cw-alert-checkbox-label input');
Expand Down Expand Up @@ -603,6 +631,7 @@ var Calls = (function(window, document, undefined) {
initVoiceMailSettings();
initCallWaiting();
initCallForwarding();
initCellBroadcast();

setTimeout(initCallForwardingObservers, 500);
}
Expand Down
3 changes: 2 additions & 1 deletion apps/settings/js/settings.js
Expand Up @@ -759,7 +759,8 @@ window.addEventListener('load', function loadSettings() {
'shared/js/mobile_operator.js',
'js/connectivity.js',
'js/security_privacy.js',
'js/icc_menu.js'
'js/icc_menu.js',
'shared/js/settings_listener.js'
];
scripts.forEach(function attachScripts(src) {
var script = document.createElement('script');
Expand Down

0 comments on commit c411b04

Please sign in to comment.