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

Commit

Permalink
Bug 1123164 - [Settings]There is no SIM settings icons when you inser…
Browse files Browse the repository at this point in the history
…t SIM2 only in Settings -> Cellular & Data. r=arthurcc.
  • Loading branch information
mpizza committed Jan 28, 2015
1 parent 782d371 commit ba73b28
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 36 deletions.
4 changes: 4 additions & 0 deletions apps/settings/js/carrier.js
Expand Up @@ -253,6 +253,10 @@ var CarrierSettings = (function(window, document, undefined) {
* Show the carrier name in the ICC card.
*/
function cs_showCarrierName() {
if (DsdsSettings.getNumberOfIccSlots() > 1) {
// We don't do anything here when the device support dsds.
return;
}
var desc = document.getElementById('dataNetwork-desc');
var iccCard = _iccManager.getIccById(_mobileConnection.iccId);
var network = _mobileConnection.voice.network;
Expand Down
30 changes: 7 additions & 23 deletions apps/settings/js/dsds_settings.js
Expand Up @@ -5,8 +5,10 @@

var DsdsSettings = (function(window, document, undefined) {
var _settings = window.navigator.mozSettings;
var _mobileConnections = window.navigator.mozMobileConnections;

var _mobileConnections = null;
if (window.navigator.mozMobileConnections) {
_mobileConnections = window.navigator.mozMobileConnections;
}
/** */
var _iccCardIndexForCallSettings = 0;

Expand All @@ -21,7 +23,6 @@ var DsdsSettings = (function(window, document, undefined) {
return;
}
ds_handleDefaultIccCard();
ds_handleCallSettingSimPanel();
ds_handleCellAndDataSettingSimPanel();
}

Expand All @@ -31,7 +32,9 @@ var DsdsSettings = (function(window, document, undefined) {
* @return {Numeric} Number of ICC slots.
*/
function ds_getNumberOfIccSlots() {
return _mobileConnections.length;
if (_mobileConnections) {
return _mobileConnections.length;
}
}

/**
Expand All @@ -49,25 +52,6 @@ var DsdsSettings = (function(window, document, undefined) {
_iccCardIndexForCallSettings = iccCardIndexForCallSettings;
}

/**
* Hide or show the call settings panel in which we show the ICC cards.
*/
function ds_handleCallSettingSimPanel() {
var callItem = null;

if (ds_getNumberOfIccSlots() > 1) {
callItem = document.getElementById('menuItem-callSettings');
callItem.setAttribute('href', '#call-iccs');
if ((_mobileConnections[0].radioState !== 'enabled') ||
(!_mobileConnections[0].iccId &&
!_mobileConnections[1].iccId)) {
return;
}
callItem = document.getElementById('call-settings');
callItem.removeAttribute('aria-disabled');
}
}

/**
*
*/
Expand Down
43 changes: 30 additions & 13 deletions apps/settings/js/main.js
Expand Up @@ -11,6 +11,7 @@ require(['config/require'], function() {
var SettingsService = require('modules/settings_service');
var ScreenLayout = require('shared/screen_layout');
var Settings = require('settings');
var DsdsSettings = require('dsds_settings');

function isInitialPanel(panel) {
if (Settings.isTabletAndLandscape()) {
Expand All @@ -35,20 +36,36 @@ require(['config/require'], function() {
if (initialPanelHandler) {
initialPanelHandler.release();
var pendingTargetPanel = initialPanelHandler.pendingTargetPanel;
// XXX: special logic for navigating to bluetooth panels
if (pendingTargetPanel === 'bluetooth') {
require(['modules/bluetooth/version_detector'], (versionDetector) => {
var version = versionDetector.getVersion();
if (version === 1) {
// navigate old bluetooth panel..
SettingsService.navigate('bluetooth');
} else if (version === 2) {
// navigate new bluetooth panel..
SettingsService.navigate('bluetooth_v2');
// XXX: In bluetooth and call item,
// we need special logic for navigating to specific panels.

switch (pendingTargetPanel) {
case 'bluetooth':
require(['modules/bluetooth/version_detector'],
(versionDetector) => {
var version = versionDetector.getVersion();
if (version === 1) {
// navigate old bluetooth panel..
SettingsService.navigate('bluetooth');
} else if (version === 2) {
// navigate new bluetooth panel..
SettingsService.navigate('bluetooth_v2');
}
});
break;
case 'call':
if (DsdsSettings.getNumberOfIccSlots() > 1) {
// If the device support dsds,
// then navigate to 'call-iccs' panel
pendingTargetPanel = 'call-iccs';
}
});
} else if (pendingTargetPanel) {
SettingsService.navigate(pendingTargetPanel);
SettingsService.navigate(pendingTargetPanel);
break;
default:
if (pendingTargetPanel) {
SettingsService.navigate(pendingTargetPanel);
}
break;
}
}

Expand Down
8 changes: 8 additions & 0 deletions apps/settings/js/panels/root/panel.js
Expand Up @@ -9,6 +9,7 @@ define(function(require) {
var HomescreenItem = require('panels/root/homescreen_item');
var PrivacyPanelItem = require('panels/root/privacy_panel_item');
var BTAPIVersionDetector = require('modules/bluetooth/version_detector');
var DsdsSettings = require('dsds_settings');

var queryRootForLowPriorityItems = function(panel) {
// This is a map from the module name to the object taken by the constructor
Expand Down Expand Up @@ -97,6 +98,13 @@ define(function(require) {
}
});

// If the device supports dsds, callSettings must be changed 'href' for
// navigating call-iccs panel first.
if (DsdsSettings.getNumberOfIccSlots() > 1) {
var callItem = document.getElementById('menuItem-callSettings');
callItem.setAttribute('href', '#call-iccs');
}

var idleObserver = {
time: 3,
onidle: function() {
Expand Down

0 comments on commit ba73b28

Please sign in to comment.