зеркало из https://github.com/mozilla/pjs.git
Bug 420614 Drop nsAdapterEnumerator (finish replacing subFoldersObsolete in js files) r=philor,sr=Neil
This commit is contained in:
Родитель
2bca0e0d73
Коммит
fd06ef06ef
|
@ -446,32 +446,23 @@ function OpenMessageByHeader(messageHeader, openInNewWindow)
|
||||||
function SearchForMessageIdInSubFolder(folder, messageId)
|
function SearchForMessageIdInSubFolder(folder, messageId)
|
||||||
{
|
{
|
||||||
var messageHeader;
|
var messageHeader;
|
||||||
var subFolders = folder.subFoldersObsolete;
|
var subFolders = folder.subFolders;
|
||||||
|
|
||||||
// search in folder
|
// search in folder
|
||||||
if (!folder.isServer)
|
if (!folder.isServer)
|
||||||
messageHeader = CheckForMessageIdInFolder(folder, messageId);
|
messageHeader = CheckForMessageIdInFolder(folder, messageId);
|
||||||
|
|
||||||
// search subfolders recursively
|
// search subfolders recursively
|
||||||
var done = !folder.hasSubFolders;
|
while (subFolders.hasMoreElements() && !messageHeader)
|
||||||
while (!done && !messageHeader)
|
|
||||||
{
|
{
|
||||||
// search in current folder
|
// search in current folder
|
||||||
var currentFolder = subFolders.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
|
var currentFolder =
|
||||||
|
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||||
messageHeader = CheckForMessageIdInFolder(currentFolder, messageId);
|
messageHeader = CheckForMessageIdInFolder(currentFolder, messageId);
|
||||||
|
|
||||||
// search in its subfolder
|
// search in its subfolder
|
||||||
if (!messageHeader && currentFolder.hasSubFolders)
|
if (!messageHeader && currentFolder.hasSubFolders)
|
||||||
messageHeader = SearchForMessageIdInSubFolder(currentFolder, messageId);
|
messageHeader = SearchForMessageIdInSubFolder(currentFolder, messageId);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
subFolders.next();
|
|
||||||
}
|
|
||||||
catch(e)
|
|
||||||
{
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return messageHeader;
|
return messageHeader;
|
||||||
|
|
|
@ -355,24 +355,13 @@ var gFeedSubscriptionsWindow = {
|
||||||
container: true };
|
container: true };
|
||||||
|
|
||||||
// if a feed has any sub folders, we should add them to the list of children
|
// 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 folder =
|
||||||
var done = false;
|
folderEnumerator.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||||
|
folderObject.children.push(this.makeFolderObject(folder, aCurrentLevel + 1));
|
||||||
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 feeds = this.getFeedsInFolder(aFolder);
|
var feeds = this.getFeedsInFolder(aFolder);
|
||||||
|
@ -430,27 +419,16 @@ var gFeedSubscriptionsWindow = {
|
||||||
var numFolders = 0;
|
var numFolders = 0;
|
||||||
this.mFeedContainers = [];
|
this.mFeedContainers = [];
|
||||||
|
|
||||||
if (this.mRSSServer.rootFolder.hasSubFolders)
|
var folderEnumerator = this.mRSSServer.rootFolder.subFolders;
|
||||||
|
|
||||||
|
while (folderEnumerator.hasMoreElements())
|
||||||
{
|
{
|
||||||
var folderEnumerator = this.mRSSServer.rootFolder.subFoldersObsolete;
|
var folder = folderEnumerator.getNext()
|
||||||
var done = false;
|
.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||||
|
if (!folder.getFlag(MSG_FOLDER_FLAG_TRASH))
|
||||||
while (!done)
|
|
||||||
{
|
{
|
||||||
var folder = folderEnumerator.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
|
this.mFeedContainers.push(this.makeFolderObject(folder, 0));
|
||||||
if (folder && !folder.getFlag(MSG_FOLDER_FLAG_TRASH))
|
numFolders++;
|
||||||
{
|
|
||||||
this.mFeedContainers.push(this.makeFolderObject(folder, 0));
|
|
||||||
numFolders++;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
folderEnumerator.next();
|
|
||||||
}
|
|
||||||
catch (ex)
|
|
||||||
{
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.mView.mRowCount = numFolders;
|
this.mView.mRowCount = numFolders;
|
||||||
|
@ -942,21 +920,21 @@ var gFeedSubscriptionsWindow = {
|
||||||
|
|
||||||
generateOutline: function(baseFolder, parent, indentLevel)
|
generateOutline: function(baseFolder, parent, indentLevel)
|
||||||
{
|
{
|
||||||
var folderEnumerator = baseFolder.subFoldersObsolete;
|
var folderEnumerator = baseFolder.subFolders;
|
||||||
var done = false;
|
|
||||||
|
|
||||||
// pretty printing
|
// pretty printing
|
||||||
var indentString = "";
|
var indentString = "";
|
||||||
for(i = 0; i < indentLevel; i++)
|
for(i = 0; i < indentLevel; i++)
|
||||||
indentString = indentString + " ";
|
indentString = indentString + " ";
|
||||||
|
|
||||||
while (!done)
|
while (folderEnumerator.hasMoreElements())
|
||||||
{
|
{
|
||||||
var folder = folderEnumerator.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
|
var folder = folderEnumerator.getNext()
|
||||||
if (folder && !folder.getFlag(MSG_FOLDER_FLAG_TRASH))
|
.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||||
|
if (!folder.getFlag(MSG_FOLDER_FLAG_TRASH))
|
||||||
{
|
{
|
||||||
var outline;
|
var outline;
|
||||||
if(folder.hasSubFolders)
|
if (folder.hasSubFolders)
|
||||||
{
|
{
|
||||||
// Make a mostly empty outline element
|
// Make a mostly empty outline element
|
||||||
outline = parent.ownerDocument.createElement("outline");
|
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);
|
.createInstance(Components.interfaces.nsISupportsArray);
|
||||||
|
|
||||||
// Delete sub-folders.
|
// Delete sub-folders.
|
||||||
var iter = folder.subFoldersObsolete;
|
var iter = folder.subFolders;
|
||||||
while (true) {
|
while (iter.hasMoreElements())
|
||||||
try {
|
children.AppendElement(iter.getNext());
|
||||||
children.AppendElement(iter.currentItem());
|
|
||||||
iter.next();
|
for (var i = 0; i < children.Count(); ++i)
|
||||||
} catch (ex) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var i = 0; i < children.Count(); ++i) {
|
|
||||||
folder.propagateDelete(children.GetElementAt(i), true, msgWindow);
|
folder.propagateDelete(children.GetElementAt(i), true, msgWindow);
|
||||||
}
|
|
||||||
children.Clear();
|
children.Clear();
|
||||||
|
|
||||||
// Delete messages.
|
// Delete messages.
|
||||||
|
|
|
@ -734,32 +734,24 @@ function OpenMessageByHeader(messageHeader, openInNewWindow)
|
||||||
function SearchForMessageIdInSubFolder(folder, messageId)
|
function SearchForMessageIdInSubFolder(folder, messageId)
|
||||||
{
|
{
|
||||||
var messageHeader;
|
var messageHeader;
|
||||||
var subFolders = folder.subFoldersObsolete;
|
var subFolders = folder.subFolders;
|
||||||
|
|
||||||
// search in folder
|
// search in folder
|
||||||
if (!folder.isServer)
|
if (!folder.isServer)
|
||||||
messageHeader = CheckForMessageIdInFolder(folder, messageId);
|
messageHeader = CheckForMessageIdInFolder(folder, messageId);
|
||||||
|
|
||||||
// search subfolders recursively
|
// search subfolders recursively
|
||||||
var done = !folder.hasSubFolders;
|
while (subFolders.hasMoreElements() && !messageHeader)
|
||||||
while (!done && !messageHeader)
|
|
||||||
{
|
{
|
||||||
// search in current folder
|
// search in current folder
|
||||||
var currentFolder = subFolders.currentItem().QueryInterface(Components.interfaces.nsIMsgFolder);
|
var currentFolder =
|
||||||
|
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||||
|
|
||||||
messageHeader = CheckForMessageIdInFolder(currentFolder, messageId);
|
messageHeader = CheckForMessageIdInFolder(currentFolder, messageId);
|
||||||
|
|
||||||
// search in its subfolder
|
// search in its subfolder
|
||||||
if (!messageHeader && currentFolder.hasSubFolders)
|
if (!messageHeader && currentFolder.hasSubFolders)
|
||||||
messageHeader = SearchForMessageIdInSubFolder(currentFolder, messageId);
|
messageHeader = SearchForMessageIdInSubFolder(currentFolder, messageId);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
subFolders.next();
|
|
||||||
}
|
|
||||||
catch(e)
|
|
||||||
{
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return messageHeader;
|
return messageHeader;
|
||||||
|
|
|
@ -96,22 +96,13 @@ function compareFolderSortKey(folder1, folder2)
|
||||||
|
|
||||||
function GetSubFoldersInFolderPaneOrder(folder)
|
function GetSubFoldersInFolderPaneOrder(folder)
|
||||||
{
|
{
|
||||||
var subFolderEnumerator = folder.subFoldersObsolete;
|
var subFolders = folder.subFolders;
|
||||||
var done = false;
|
|
||||||
var msgFolders = Array();
|
var msgFolders = Array();
|
||||||
|
|
||||||
// get all the subfolders
|
// get all the subfolders
|
||||||
while (!done) {
|
while (subFolders.hasMoreElements()) {
|
||||||
try {
|
msgFolders[msgFolders.length] =
|
||||||
var element = subFolderEnumerator.currentItem();
|
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||||
var msgFolder = element.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
||||||
msgFolders[msgFolders.length] = msgFolder;
|
|
||||||
|
|
||||||
subFolderEnumerator.next();
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort the subfolders
|
// sort the subfolders
|
||||||
|
|
|
@ -437,31 +437,18 @@ function onSearch()
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddSubFolders(folder) {
|
function AddSubFolders(folder) {
|
||||||
if (folder.hasSubFolders)
|
var subFolders = folder.subFolders;
|
||||||
|
while (subFolders.hasMoreElements())
|
||||||
{
|
{
|
||||||
var subFolderEnumerator = folder.subFoldersObsolete;
|
var nextFolder =
|
||||||
var done = false;
|
subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||||
while (!done)
|
|
||||||
|
if (!(nextFolder.flags & MSG_FOLDER_FLAG_VIRTUAL))
|
||||||
{
|
{
|
||||||
var next = subFolderEnumerator.currentItem();
|
if (!nextFolder.noSelect)
|
||||||
if (next)
|
gSearchSession.addScopeTerm(GetScopeForFolder(nextFolder), nextFolder);
|
||||||
{
|
|
||||||
var nextFolder = next.QueryInterface(Components.interfaces.nsIMsgFolder);
|
AddSubFolders(nextFolder);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,42 +456,29 @@ function AddSubFolders(folder) {
|
||||||
function AddSubFoldersToURI(folder)
|
function AddSubFoldersToURI(folder)
|
||||||
{
|
{
|
||||||
var returnString = "";
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
var subFolders = folder.subFolders;
|
||||||
}
|
|
||||||
try
|
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();
|
if (returnString.length > 0)
|
||||||
}
|
returnString += '|';
|
||||||
catch (ex)
|
returnString += nextFolder.URI;
|
||||||
{
|
}
|
||||||
done = true;
|
var subFoldersString = AddSubFoldersToURI(nextFolder);
|
||||||
}
|
if (subFoldersString.length > 0)
|
||||||
|
{
|
||||||
|
if (returnString.length > 0)
|
||||||
|
returnString += '|';
|
||||||
|
returnString += subFoldersString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnString;
|
return returnString;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче