diff options
author | drebs <drebs@leap.se> | 2014-06-03 11:04:02 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2014-06-03 11:07:45 -0300 |
commit | c29e78d2caa6bd0477e92ebab38c62f5bc18c857 (patch) | |
tree | 0ea74b1da56a2d663db1afa52c126bceaabcabbf /chrome | |
parent | e8de1db4a667fab1525c78847d7b672072caeba2 (diff) |
Only disable caching checkbox if caching is already disabled (#4811).
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/content/preventCaching/bitmaskAmOfflineOverlay.js | 19 | ||||
-rw-r--r-- | chrome/content/statusBar/statusBarOverlay.js | 17 |
2 files changed, 29 insertions, 7 deletions
diff --git a/chrome/content/preventCaching/bitmaskAmOfflineOverlay.js b/chrome/content/preventCaching/bitmaskAmOfflineOverlay.js index c88b2ab..afc35a3 100644 --- a/chrome/content/preventCaching/bitmaskAmOfflineOverlay.js +++ b/chrome/content/preventCaching/bitmaskAmOfflineOverlay.js @@ -22,23 +22,32 @@ var currentAccount = null; -// The following function disables UI items that would allow a user to turn -// on offline caching for a LEAP account. It acts on am-offline.xul items that +// The following function disables UI items that would allow a user to turn on +// offline caching for a LEAP account. It acts on am-offline.xul items that // can be accessed in Thunderbird by choosing: // // Edit -> Account Settings... -> Synchronization and Storage. +// In order to be somewhat consistent, we only disable those items if the +// account already has its offline caching turned off. Accounts created with +// the Bitmask wizard are created with offline caching turned off (and so the +// UI items are disabled from the beginning). Accounts created manually will +// have offline caching turned on by default, and thus need a way to disable +// it if the user ever wants to. Once offline caching is disabled, then the +// user will not be able to turn it on again for Leap accounts. function disableOfflineCaching() { var disabled; - // for now, we consider a LEAP account every account whose incoming server + var checkbox = document.getElementById("offline.folders") + // For now, we consider a LEAP account every account whose incoming server // has a hostname equal to IMAP_HOST and port equal to IMAP_PORT. if (currentAccount.incomingServer.port == IMAP_PORT && - currentAccount.incomingServer.hostName == IMAP_HOST) + currentAccount.incomingServer.hostName == IMAP_HOST && + checkbox.checked == false) disabled = true; else disabled = false; // The "Keep messsages for this account on this computer" checkbox. - document.getElementById("offline.folders").disabled = disabled; + checkbox.disabled = disabled; // The "Advanced..." button. document.getElementById("selectImapFoldersButton").disabled = disabled; } diff --git a/chrome/content/statusBar/statusBarOverlay.js b/chrome/content/statusBar/statusBarOverlay.js index 31ec16a..c82b3f2 100644 --- a/chrome/content/statusBar/statusBarOverlay.js +++ b/chrome/content/statusBar/statusBarOverlay.js @@ -18,6 +18,7 @@ Components.utils.import("resource:///modules/mailServices.js"); +Components.utils.import("resource://gre/modules/Services.jsm"); var accountNotConfigured = getStringBundle( "chrome://bitmask/locale/statusBar.properties") @@ -51,6 +52,12 @@ function starUp() { updatePanel(); if (!isBitmaskAccountConfigured()) { launchAccountWizard(); + } else { + var server = getBitmaskServer(); + // TODO: add an alert that there exists a bitmask account with caching + // enabled. + //if (server.offlineDownload == true) + // alertPrompt('WARNING!'); } } @@ -86,9 +93,15 @@ function handleStatusBarClick() { * TODO: also verify for SMTP configuration? */ function isBitmaskAccountConfigured() { + return !!getBitmaskServer(); +} + +/** + * Get a configured bitmask account + */ +function getBitmaskServer() { var accountManager = Cc["@mozilla.org/messenger/account-manager;1"] .getService(Ci.nsIMsgAccountManager); - var existing = accountManager.findRealServer( + return accountManager.findRealServer( "", IMAP_HOST, "imap", IMAP_PORT); - return !!existing; } |