Address some comments post landing of bug 436615. r/sr=Neil
authorMark Banner <bugzilla@standard8.plus.com>
Tue, 14 Oct 2008 20:40:03 +0100
changeset 609 614bb57facfabe0a2eec85c31f837c93d29eb0b1
parent 608 770044d2e504309919a1ef3d51e322396dfc51ec
child 610 0e2ef43af74d2c1b552ad7280427987c8600b2f3
push idunknown
push userunknown
push dateunknown
bugs436615
Address some comments post landing of bug 436615. r/sr=Neil
mailnews/base/prefs/resources/content/am-offline.js
--- a/mailnews/base/prefs/resources/content/am-offline.js
+++ b/mailnews/base/prefs/resources/content/am-offline.js
@@ -38,18 +38,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 var gIncomingServer;
 var gServerType;
 var gImapIncomingServer;
 var gPref = null;
 var gLockedPref = null;
 var gOfflineMap = null; // map of folder URLs to offline flags
-var Cc = Components.classes;
-var Ci = Components.interfaces;
 
 function onInit(aPageId, aServerId) 
 {
     onLockPreference();	
 
     // init values here
     initServerSettings();
     initRetentionSettings();
@@ -259,58 +257,64 @@ function checkOffline()
 {
     var offline = document.getElementById("offline.folders").checked;
     var folderPickerButton = document.getElementById('selectImapFoldersButton');
     folderPickerButton.disabled = !offline;
 }
 
 function toggleOffline()
 {
-    checkOffline()
+    checkOffline();
     var offline = document.getElementById("offline.folders").checked;
     var rootFolder = gIncomingServer.rootFolder;
-    var allFolders = Cc["@mozilla.org/supports-array;1"].createInstance(Ci.nsISupportsArray);
+    var allFolders = Components.classes["@mozilla.org/supports-array;1"]
+                               .createInstance(Components.interfaces.nsISupportsArray);
     rootFolder.ListDescendents(allFolders);
     var numFolders = allFolders.Count();
     var folder;
     for (var folderIndex = 0; folderIndex < numFolders; folderIndex++)
     {
-      folder = allFolders.GetElementAt(folderIndex).QueryInterface(Ci.nsIMsgFolder);
+      folder = allFolders.QueryElementAt(folderIndex,
+                                         Components.interfaces.nsIMsgFolder);
       if (offline)
         folder.setFlag(Components.interfaces.nsMsgFolderFlags.Offline);
       else
         folder.clearFlag(Components.interfaces.nsMsgFolderFlags.Offline);
     }
     
 }
 
 function collectOfflineFolders()
 {
     var offlineFolderMap = {};
     var rootFolder = gIncomingServer.rootFolder;
-    var allFolders = Cc["@mozilla.org/supports-array;1"].createInstance(Ci.nsISupportsArray);
+    var allFolders = Components.classes["@mozilla.org/supports-array;1"]
+                               .createInstance(Components.interfaces.nsISupportsArray);
     rootFolder.ListDescendents(allFolders);
     var numFolders = allFolders.Count();
     var folder;
     for (var folderIndex = 0; folderIndex < numFolders; folderIndex++)
     {
-      folder = allFolders.GetElementAt(folderIndex).QueryInterface(Ci.nsIMsgFolder);
+      folder = allFolders.QueryElementAt(folderIndex,
+                                         Components.interfaces.nsIMsgFolder);
       offlineFolderMap[folder.folderURL] = folder.getFlag(Components.interfaces.nsMsgFolderFlags.Offline);
     }
     return offlineFolderMap;
 }
 
 function restoreOfflineFolders(offlineFolderMap)
 {
     var rootFolder = gIncomingServer.rootFolder;
-    var allFolders = Cc["@mozilla.org/supports-array;1"].createInstance(Ci.nsISupportsArray);
+    var allFolders = Components.classes["@mozilla.org/supports-array;1"]
+                               .createInstance(Components.interfaces.nsISupportsArray);
     rootFolder.ListDescendents(allFolders);
     var numFolders = allFolders.Count();
     var folder;
     for (var folderIndex = 0; folderIndex < numFolders; folderIndex++)
     {
-      folder = allFolders.GetElementAt(folderIndex).QueryInterface(Ci.nsIMsgFolder);
+      folder = allFolders.QueryElementAt(folderIndex,
+                                         Components.interfaces.nsIMsgFolder);
       if (offlineFolderMap[folder.folderURL])
         folder.setFlag(Components.interfaces.nsMsgFolderFlags.Offline);
       else
         folder.clearFlag(Components.interfaces.nsMsgFolderFlags.Offline);
     }
 }