Bug 420614 Drop nsAdapterEnumerator (finish replacing subFoldersObsolete in js files) r=philor,sr=Neil

This commit is contained in:
bugzilla%standard8.plus.com 2008-05-08 18:46:39 +00:00
Родитель 2bca0e0d73
Коммит fd06ef06ef
6 изменённых файлов: 70 добавлений и 157 удалений

Просмотреть файл

@ -446,32 +446,23 @@ function OpenMessageByHeader(messageHeader, openInNewWindow)
function SearchForMessageIdInSubFolder(folder, messageId)
{
var messageHeader;
var subFolders = folder.subFoldersObsolete;
var subFolders = folder.subFolders;
// search in folder
if (!folder.isServer)
messageHeader = CheckForMessageIdInFolder(folder, messageId);
// search subfolders recursively
var done = !folder.hasSubFolders;
while (!done && !messageHeader)
while (subFolders.hasMoreElements() && !messageHeader)
{
// search in current folder
var currentFolder = subFolders.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
var currentFolder =
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
messageHeader = CheckForMessageIdInFolder(currentFolder, messageId);
// search in its subfolder
if (!messageHeader && currentFolder.hasSubFolders)
messageHeader = SearchForMessageIdInSubFolder(currentFolder, messageId);
try
{
subFolders.next();
}
catch(e)
{
done = true;
}
}
return messageHeader;

Просмотреть файл

@ -355,24 +355,13 @@ var gFeedSubscriptionsWindow = {
container: true };
// if a feed has any sub folders, we should add them to the list of children
if (aFolder.hasSubFolders)
{
var folderEnumerator = aFolder.subFoldersObsolete;
var done = false;
var folderEnumerator = aFolder.subFolders;
while (!done)
while (folderEnumerator.hasMoreElements())
{
var folder = folderEnumerator.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
var folder =
folderEnumerator.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
folderObject.children.push(this.makeFolderObject(folder, aCurrentLevel + 1));
try {
folderEnumerator.next();
}
catch (ex)
{
done = true;
}
}
}
var feeds = this.getFeedsInFolder(aFolder);
@ -430,28 +419,17 @@ var gFeedSubscriptionsWindow = {
var numFolders = 0;
this.mFeedContainers = [];
if (this.mRSSServer.rootFolder.hasSubFolders)
{
var folderEnumerator = this.mRSSServer.rootFolder.subFoldersObsolete;
var done = false;
var folderEnumerator = this.mRSSServer.rootFolder.subFolders;
while (!done)
while (folderEnumerator.hasMoreElements())
{
var folder = folderEnumerator.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
if (folder && !folder.getFlag(MSG_FOLDER_FLAG_TRASH))
var folder = folderEnumerator.getNext()
.QueryInterface(Components.interfaces.nsIMsgFolder);
if (!folder.getFlag(MSG_FOLDER_FLAG_TRASH))
{
this.mFeedContainers.push(this.makeFolderObject(folder, 0));
numFolders++;
}
try {
folderEnumerator.next();
}
catch (ex)
{
done = true;
}
}
}
this.mView.mRowCount = numFolders;
@ -942,18 +920,18 @@ var gFeedSubscriptionsWindow = {
generateOutline: function(baseFolder, parent, indentLevel)
{
var folderEnumerator = baseFolder.subFoldersObsolete;
var done = false;
var folderEnumerator = baseFolder.subFolders;
// pretty printing
var indentString = "";
for(i = 0; i < indentLevel; i++)
indentString = indentString + " ";
while (!done)
while (folderEnumerator.hasMoreElements())
{
var folder = folderEnumerator.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
if (folder && !folder.getFlag(MSG_FOLDER_FLAG_TRASH))
var folder = folderEnumerator.getNext()
.QueryInterface(Components.interfaces.nsIMsgFolder);
if (!folder.getFlag(MSG_FOLDER_FLAG_TRASH))
{
var outline;
if (folder.hasSubFolders)
@ -978,14 +956,6 @@ var gFeedSubscriptionsWindow = {
}
}
}
try {
folderEnumerator.next();
}
catch (ex)
{
done = true;
}
}
},

Просмотреть файл

@ -754,18 +754,13 @@ function deleteAllInFolder(commandName)
.createInstance(Components.interfaces.nsISupportsArray);
// Delete sub-folders.
var iter = folder.subFoldersObsolete;
while (true) {
try {
children.AppendElement(iter.currentItem());
iter.next();
} catch (ex) {
break;
}
}
for (var i = 0; i < children.Count(); ++i) {
var iter = folder.subFolders;
while (iter.hasMoreElements())
children.AppendElement(iter.getNext());
for (var i = 0; i < children.Count(); ++i)
folder.propagateDelete(children.GetElementAt(i), true, msgWindow);
}
children.Clear();
// Delete messages.

Просмотреть файл

@ -734,32 +734,24 @@ function OpenMessageByHeader(messageHeader, openInNewWindow)
function SearchForMessageIdInSubFolder(folder, messageId)
{
var messageHeader;
var subFolders = folder.subFoldersObsolete;
var subFolders = folder.subFolders;
// search in folder
if (!folder.isServer)
messageHeader = CheckForMessageIdInFolder(folder, messageId);
// search subfolders recursively
var done = !folder.hasSubFolders;
while (!done && !messageHeader)
while (subFolders.hasMoreElements() && !messageHeader)
{
// search in current folder
var currentFolder = subFolders.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
var currentFolder =
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
messageHeader = CheckForMessageIdInFolder(currentFolder, messageId);
// search in its subfolder
if (!messageHeader && currentFolder.hasSubFolders)
messageHeader = SearchForMessageIdInSubFolder(currentFolder, messageId);
try
{
subFolders.next();
}
catch(e)
{
done = true;
}
}
return messageHeader;

Просмотреть файл

@ -96,22 +96,13 @@ function compareFolderSortKey(folder1, folder2)
function GetSubFoldersInFolderPaneOrder(folder)
{
var subFolderEnumerator = folder.subFoldersObsolete;
var done = false;
var subFolders = folder.subFolders;
var msgFolders = Array();
// get all the subfolders
while (!done) {
try {
var element = subFolderEnumerator.currentItem();
var msgFolder = element.QueryInterface(Components.interfaces.nsIMsgFolder);
msgFolders[msgFolders.length] = msgFolder;
subFolderEnumerator.next();
}
catch (ex) {
done = true;
}
while (subFolders.hasMoreElements()) {
msgFolders[msgFolders.length] =
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
}
// sort the subfolders

Просмотреть файл

@ -437,49 +437,34 @@ function onSearch()
}
function AddSubFolders(folder) {
if (folder.hasSubFolders)
var subFolders = folder.subFolders;
while (subFolders.hasMoreElements())
{
var subFolderEnumerator = folder.subFoldersObsolete;
var done = false;
while (!done)
{
var next = subFolderEnumerator.currentItem();
if (next)
{
var nextFolder = next.QueryInterface(Components.interfaces.nsIMsgFolder);
if (nextFolder && ! (nextFolder.flags & MSG_FOLDER_FLAG_VIRTUAL))
var nextFolder =
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
if (!(nextFolder.flags & MSG_FOLDER_FLAG_VIRTUAL))
{
if (!nextFolder.noSelect)
gSearchSession.addScopeTerm(GetScopeForFolder(nextFolder), nextFolder);
AddSubFolders(nextFolder);
}
}
try
{
subFolderEnumerator.next();
}
catch (ex)
{
done = true;
}
}
}
}
function AddSubFoldersToURI(folder)
{
var returnString = "";
if (folder.hasSubFolders)
var subFolders = folder.subFolders;
while (subFolders.hasMoreElements())
{
var subFolderEnumerator = folder.subFoldersObsolete;
var done = false;
while (!done)
{
var next = subFolderEnumerator.currentItem();
if (next)
{
var nextFolder = next.QueryInterface(Components.interfaces.nsIMsgFolder);
if (nextFolder && ! (nextFolder.flags & MSG_FOLDER_FLAG_VIRTUAL))
var nextFolder =
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
if (!(nextFolder.flags & MSG_FOLDER_FLAG_VIRTUAL))
{
if (!nextFolder.noSelect && !nextFolder.isServer)
{
@ -494,17 +479,6 @@ function AddSubFoldersToURI(folder)
returnString += '|';
returnString += subFoldersString;
}
}
}
try
{
subFolderEnumerator.next();
}
catch (ex)
{
done = true;
}
}
}
return returnString;