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.subFolders;
while (folderEnumerator.hasMoreElements())
{
var folderEnumerator = aFolder.subFoldersObsolete;
var done = false;
while (!done)
{
var folder = folderEnumerator.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
folderObject.children.push(this.makeFolderObject(folder, aCurrentLevel + 1));
try {
folderEnumerator.next();
}
catch (ex)
{
done = true;
}
}
var folder =
folderEnumerator.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
folderObject.children.push(this.makeFolderObject(folder, aCurrentLevel + 1));
}
var feeds = this.getFeedsInFolder(aFolder);
@ -430,27 +419,16 @@ var gFeedSubscriptionsWindow = {
var numFolders = 0;
this.mFeedContainers = [];
if (this.mRSSServer.rootFolder.hasSubFolders)
var folderEnumerator = this.mRSSServer.rootFolder.subFolders;
while (folderEnumerator.hasMoreElements())
{
var folderEnumerator = this.mRSSServer.rootFolder.subFoldersObsolete;
var done = false;
while (!done)
var folder = folderEnumerator.getNext()
.QueryInterface(Components.interfaces.nsIMsgFolder);
if (!folder.getFlag(MSG_FOLDER_FLAG_TRASH))
{
var folder = folderEnumerator.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
if (folder && !folder.getFlag(MSG_FOLDER_FLAG_TRASH))
{
this.mFeedContainers.push(this.makeFolderObject(folder, 0));
numFolders++;
}
try {
folderEnumerator.next();
}
catch (ex)
{
done = true;
}
this.mFeedContainers.push(this.makeFolderObject(folder, 0));
numFolders++;
}
}
this.mView.mRowCount = numFolders;
@ -942,21 +920,21 @@ 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)
if (folder.hasSubFolders)
{
// Make a mostly empty outline element
outline = parent.ownerDocument.createElement("outline");
@ -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,31 +437,18 @@ 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 nextFolder =
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
if (!(nextFolder.flags & MSG_FOLDER_FLAG_VIRTUAL))
{
var next = subFolderEnumerator.currentItem();
if (next)
{
var nextFolder = next.QueryInterface(Components.interfaces.nsIMsgFolder);
if (nextFolder && ! (nextFolder.flags & MSG_FOLDER_FLAG_VIRTUAL))
{
if (!nextFolder.noSelect)
gSearchSession.addScopeTerm(GetScopeForFolder(nextFolder), nextFolder);
AddSubFolders(nextFolder);
}
}
try
{
subFolderEnumerator.next();
}
catch (ex)
{
done = true;
}
if (!nextFolder.noSelect)
gSearchSession.addScopeTerm(GetScopeForFolder(nextFolder), nextFolder);
AddSubFolders(nextFolder);
}
}
}
@ -469,42 +456,29 @@ function AddSubFolders(folder) {
function AddSubFoldersToURI(folder)
{
var returnString = "";
if (folder.hasSubFolders)
{
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))
{
if (!nextFolder.noSelect && !nextFolder.isServer)
{
if (returnString.length > 0)
returnString += '|';
returnString += nextFolder.URI;
}
var subFoldersString = AddSubFoldersToURI(nextFolder);
if (subFoldersString.length > 0)
{
if (returnString.length > 0)
returnString += '|';
returnString += subFoldersString;
}
}
}
try
var subFolders = folder.subFolders;
while (subFolders.hasMoreElements())
{
var nextFolder =
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
if (!(nextFolder.flags & MSG_FOLDER_FLAG_VIRTUAL))
{
if (!nextFolder.noSelect && !nextFolder.isServer)
{
subFolderEnumerator.next();
}
catch (ex)
{
done = true;
}
if (returnString.length > 0)
returnString += '|';
returnString += nextFolder.URI;
}
var subFoldersString = AddSubFoldersToURI(nextFolder);
if (subFoldersString.length > 0)
{
if (returnString.length > 0)
returnString += '|';
returnString += subFoldersString;
}
}
}
return returnString;