apps/system/js/quick_settings.js
/**
     * Prompts the user if they are requesting to enable data roaming.
     * @memberof QuickSettings.prototype
     */
Prompts the user if they are requesting to enable data roaming.
Prompts the user if they are requesting to enable data roaming .
function qs_showDataRoamingEnabledPromptIfNeeded() {
      var dialog = document.querySelector('#quick-setting-data-enabled-dialog'),
        enableBtn = document.querySelector('.quick-setting-data-ok-btn'),
        cancelBtn = document.querySelector('.quick-setting-data-cancel-btn');
      var self = this;
      var connections = window.navigator.mozMobileConnections;
      var dataType;
      var sim;
      if (!connections) {
        return;
      }
      for (var i = 0; i < connections.length && !dataType; i++) {
        dataType = connections[i].data.type;
        sim = connections[i];
      }
      if (!dataType) {
        return;
      }
      this.checkDataRoaming().then(function(roaming) {
        if (!roaming && sim.data.roaming) {
          disabledDefaultDialogIfNeeded();
        } else {
          var cset = {};
          cset[self.DATA_KEY] = true;
          self.setMozSettings(cset);
          return;
        }
      });
      var disabledDefaultDialogIfNeeded = function() {
        self.getDataRoamingWarning().then(function(warningEnabled) {
          if (warningEnabled === null || warningEnabled) {
            var cset = {};
            cset[self.WARNING_DIALOG_ENABLED_KEY] = false;
            self.setMozSettings(cset);
          }
          enableDialog(true);
        });
      };
      var enableSetting = function() {
        var cset = {};
        cset[self.DATA_KEY] = true;
        cset[self.DATA_ROAMING_KEY] = true;
        self.setMozSettings(cset);
        enableDialog(false);
      };
      var cancel = function() {
        enableDialog(false);
      };
      function enableDialog(enabled) {
        if (enabled) {
          UtilityTray.hide();
          enableBtn.addEventListener('click', enableSetting);
          cancelBtn.addEventListener('click', cancel);
          dialog.classList.add('visible');
        } else {
          enableBtn.removeEventListener('click', enableSetting);
          cancelBtn.removeEventListener('click', cancel);
          dialog.classList.remove('visible');
        }
      }
    }
function qs_showDataRoamingEnabledPromptIfNeeded ( ) { var dialog = document . querySelector ( '#quick-setting-data-enabled-dialog' ) , enableBtn = document . querySelector ( '.quick-setting-data-ok-btn' ) , cancelBtn = document . querySelector ( '.quick-setting-data-cancel-btn' ) ; var self = this ; var connections = window . navigator . mozMobileConnections ; var dataType ; var sim ; if ( ! connections ) { return ; } for ( var i = 0 ; i < connections . length && ! dataType ; i ++ ) { dataType = connections [ i ] . data . type ; sim = connections [ i ] ; } if ( ! dataType ) { return ; } this . checkDataRoaming ( ) . then ( function ( roaming ) { if ( ! roaming && sim . data . roaming ) { disabledDefaultDialogIfNeeded ( ) ; } else { var cset = { } ; cset [ self . DATA_KEY ] = true ; self . setMozSettings ( cset ) ; return ; } } ) ; var disabledDefaultDialogIfNeeded = function ( ) { self . getDataRoamingWarning ( ) . then ( function ( warningEnabled ) { if ( warningEnabled === null || warningEnabled ) { var cset = { } ; cset [ self . WARNING_DIALOG_ENABLED_KEY ] = false ; self . setMozSettings ( cset ) ; } enableDialog ( true ) ; } ) ; } ; var enableSetting = function ( ) { var cset = { } ; cset [ self . DATA_KEY ] = true ; cset [ self . DATA_ROAMING_KEY ] = true ; self . setMozSettings ( cset ) ; enableDialog ( false ) ; } ; var cancel = function ( ) { enableDialog ( false ) ; } ; function enableDialog ( enabled ) { if ( enabled ) { UtilityTray . hide ( ) ; enableBtn . addEventListener ( 'click' , enableSetting ) ; cancelBtn . addEventListener ( 'click' , cancel ) ; dialog . classList . add ( 'visible' ) ; } else { enableBtn . removeEventListener ( 'click' , enableSetting ) ; cancelBtn . removeEventListener ( 'click' , cancel ) ; dialog . classList . remove ( 'visible' ) ; } } }
Prompts the user if they are requesting to enable data roaming.
Prompts the user if they are requesting to enable data roaming .
// In DualSim only one of them will have data active //No connection available // Hides the warning dialog to prevent to show it in settings app again