Bug 1683590 - Remove nsISupport use in nsIFolderListener.OnItemAdded/Removed callbacks. r=mkmelin
Breaks up OnItemAdded() and OnItemRemoved() into folder and message-specific versions. Also tidies up naming of the callback functions in the .idl while we're here e.g. OnItemEvent() becomes onFolderEvent(). Differential Revision: https://phabricator.services.mozilla.com/D126593 --HG-- extra : amend_source : 7e86abd0191c081cbce48965b6d064f146fc7f88
This commit is contained in:
Родитель
d52485e055
Коммит
0bc654a66d
|
@ -2745,12 +2745,9 @@ var gFolderTreeView = {
|
|||
/**
|
||||
* This is our implementation of nsIMsgFolderListener to watch for changes
|
||||
*/
|
||||
OnItemAdded(aParentItem, aItem) {
|
||||
// Ignore this item if it's not a folder, or we knew about it.
|
||||
if (
|
||||
!(aItem instanceof Ci.nsIMsgFolder) ||
|
||||
this.getIndexOfFolder(aItem) != null
|
||||
) {
|
||||
onFolderAdded(aParentItem, aItem) {
|
||||
// Ignore this folder if we already know about it.
|
||||
if (this.getIndexOfFolder(aItem) != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2778,6 +2775,8 @@ var gFolderTreeView = {
|
|||
}
|
||||
},
|
||||
|
||||
onMessageAdded(parentFolder, msg) {},
|
||||
|
||||
addFolder(aParentItem, aItem) {
|
||||
// This intentionally adds any new folder even if it would not pass the
|
||||
// _filterFunction. The idea is that the user can add new folders even
|
||||
|
@ -2825,11 +2824,7 @@ var gFolderTreeView = {
|
|||
this._addChildToView(parent, parentIndex, newChild);
|
||||
},
|
||||
|
||||
OnItemRemoved(aParentItem, aItem) {
|
||||
if (!(aItem instanceof Ci.nsIMsgFolder)) {
|
||||
return;
|
||||
}
|
||||
|
||||
onFolderRemoved(aParentItem, aItem) {
|
||||
let index = this.getIndexOfFolder(aItem);
|
||||
if (index == null) {
|
||||
return;
|
||||
|
@ -2859,9 +2854,9 @@ var gFolderTreeView = {
|
|||
gFolderDisplay.show();
|
||||
}
|
||||
},
|
||||
|
||||
OnItemPropertyChanged(aItem, aProperty, aOld, aNew) {},
|
||||
OnItemIntPropertyChanged(aItem, aProperty, aOld, aNew) {
|
||||
onMessageRemoved(parentFolder, msg) {},
|
||||
onFolderPropertyChanged(aItem, aProperty, aOld, aNew) {},
|
||||
onFolderIntPropertyChanged(aItem, aProperty, aOld, aNew) {
|
||||
// First try mode specific handling of the changed property.
|
||||
for (let mode of this.activeModes) {
|
||||
if (
|
||||
|
@ -2892,7 +2887,7 @@ var gFolderTreeView = {
|
|||
}
|
||||
},
|
||||
|
||||
OnItemBoolPropertyChanged(aItem, aProperty, aOld, aNew) {
|
||||
onFolderBoolPropertyChanged(aItem, aProperty, aOld, aNew) {
|
||||
let index = this.getIndexOfFolder(aItem);
|
||||
if (index != null) {
|
||||
this.clearFolderCacheProperty(aItem, "properties");
|
||||
|
@ -2900,7 +2895,7 @@ var gFolderTreeView = {
|
|||
}
|
||||
},
|
||||
|
||||
OnItemUnicharPropertyChanged(aItem, aProperty, aOld, aNew) {
|
||||
onFolderUnicharPropertyChanged(aItem, aProperty, aOld, aNew) {
|
||||
let index = this.getIndexOfFolder(aItem);
|
||||
if (index != null) {
|
||||
this.clearFolderCacheProperty(aItem, "properties");
|
||||
|
@ -2908,8 +2903,8 @@ var gFolderTreeView = {
|
|||
}
|
||||
},
|
||||
|
||||
OnItemPropertyFlagChanged(aItem, aProperty, aOld, aNew) {},
|
||||
OnItemEvent(aFolder, aEvent) {
|
||||
onFolderPropertyFlagChanged(aItem, aProperty, aOld, aNew) {},
|
||||
onFolderEvent(aFolder, aEvent) {
|
||||
let index = this.getIndexOfFolder(aFolder);
|
||||
if (index != null) {
|
||||
this.clearFolderCacheProperty(aFolder, "properties");
|
||||
|
|
|
@ -201,13 +201,14 @@ var gSummaryFrameManager;
|
|||
|
||||
// the folderListener object
|
||||
var folderListener = {
|
||||
OnItemAdded(parentItem, item) {},
|
||||
onFolderAdded(parentFolder, child) {},
|
||||
onMessageAdded(parentFolder, msg) {},
|
||||
onFolderRemoved(parentFolder, child) {},
|
||||
onMessageRemoved(parentFolder, msg) {},
|
||||
|
||||
OnItemRemoved(parentItem, item) {},
|
||||
onFolderPropertyChanged(item, property, oldValue, newValue) {},
|
||||
|
||||
OnItemPropertyChanged(item, property, oldValue, newValue) {},
|
||||
|
||||
OnItemIntPropertyChanged(item, property, oldValue, newValue) {
|
||||
onFolderIntPropertyChanged(item, property, oldValue, newValue) {
|
||||
if (item == gFolderDisplay.displayedFolder) {
|
||||
if (property == "TotalMessages" || property == "TotalUnreadMessages") {
|
||||
UpdateStatusMessageCounts(gFolderDisplay.displayedFolder);
|
||||
|
@ -215,12 +216,12 @@ var folderListener = {
|
|||
}
|
||||
},
|
||||
|
||||
OnItemBoolPropertyChanged(item, property, oldValue, newValue) {},
|
||||
onFolderBoolPropertyChanged(item, property, oldValue, newValue) {},
|
||||
|
||||
OnItemUnicharPropertyChanged(item, property, oldValue, newValue) {},
|
||||
OnItemPropertyFlagChanged(item, property, oldFlag, newFlag) {},
|
||||
onFolderUnicharPropertyChanged(item, property, oldValue, newValue) {},
|
||||
onFolderPropertyFlagChanged(item, property, oldFlag, newFlag) {},
|
||||
|
||||
OnItemEvent(folder, event) {
|
||||
onFolderEvent(folder, event) {
|
||||
if (event == "ImapHdrDownloaded") {
|
||||
if (folder) {
|
||||
var imapFolder = folder.QueryInterface(Ci.nsIMsgImapMailFolder);
|
||||
|
|
|
@ -71,7 +71,7 @@ var folderTracker = new (class extends EventEmitter {
|
|||
|
||||
// nsIFolderListener
|
||||
|
||||
OnItemIntPropertyChanged(item, property, oldValue, newValue) {
|
||||
onFolderIntPropertyChanged(item, property, oldValue, newValue) {
|
||||
if (!(item instanceof Ci.nsIMsgFolder)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1843,7 +1843,7 @@ var messageTracker = new (class extends EventEmitter {
|
|||
|
||||
// nsIFolderListener
|
||||
|
||||
OnItemPropertyFlagChanged(item, property, oldFlag, newFlag) {
|
||||
onFolderPropertyFlagChanged(item, property, oldFlag, newFlag) {
|
||||
switch (property) {
|
||||
case "Status":
|
||||
if ((oldFlag ^ newFlag) & Ci.nsMsgMessageFlags.Read) {
|
||||
|
@ -1865,7 +1865,7 @@ var messageTracker = new (class extends EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
OnItemIntPropertyChanged(folder, property, oldValue, newValue) {
|
||||
onFolderIntPropertyChanged(folder, property, oldValue, newValue) {
|
||||
switch (property) {
|
||||
case "BiffState":
|
||||
if (newValue == Ci.nsIMsgFolder.nsMsgBiffState_NewMail) {
|
||||
|
|
|
@ -201,7 +201,7 @@ var FolderNotificationHelper = {
|
|||
}
|
||||
},
|
||||
|
||||
OnItemEvent(aFolder, aEvent) {
|
||||
onFolderEvent(aFolder, aEvent) {
|
||||
if (aEvent == "FolderLoaded") {
|
||||
let folderURI = aFolder.URI;
|
||||
let widgets = this._pendingFolderUriToViewWrapperLists[folderURI];
|
||||
|
@ -243,7 +243,7 @@ var FolderNotificationHelper = {
|
|||
}
|
||||
},
|
||||
|
||||
OnItemIntPropertyChanged(aFolder, aProperty, aOldValue, aNewValue) {
|
||||
onFolderIntPropertyChanged(aFolder, aProperty, aOldValue, aNewValue) {
|
||||
if (aProperty == "TotalMessages" || aProperty == "TotalUnreadMessages") {
|
||||
this._notifyHelper(aFolder, "_messageCountsChanged");
|
||||
}
|
||||
|
|
|
@ -2021,7 +2021,7 @@ var FolderListener = {
|
|||
}
|
||||
},
|
||||
|
||||
OnItemEvent(aFolder, aEvent) {
|
||||
onFolderEvent(aFolder, aEvent) {
|
||||
if (!this.watchingFor) {
|
||||
return;
|
||||
}
|
||||
|
@ -2033,7 +2033,7 @@ var FolderListener = {
|
|||
};
|
||||
|
||||
/**
|
||||
* Plan to wait for an nsIFolderListener.OnItemEvent matching one of the
|
||||
* Plan to wait for an nsIFolderListener.onFolderEvent matching one of the
|
||||
* provided strings. Call this before you do the thing that triggers the
|
||||
* event, then call |wait_for_folder_events| after the event. This ensures
|
||||
* that we see the event, because it might be too late after you initiate
|
||||
|
|
|
@ -265,29 +265,28 @@
|
|||
}
|
||||
},
|
||||
|
||||
_itemAddedOrRemoved(item) {
|
||||
if (!(item instanceof Ci.nsIMsgFolder)) {
|
||||
return;
|
||||
}
|
||||
if (this._filterFunction && !this._filterFunction(item)) {
|
||||
_folderAddedOrRemoved(folder) {
|
||||
if (this._filterFunction && !this._filterFunction(folder)) {
|
||||
return;
|
||||
}
|
||||
// xxx we can optimize this later
|
||||
this._clearMenu(this._menu);
|
||||
},
|
||||
|
||||
OnItemAdded(ParentItem, item) {
|
||||
this._itemAddedOrRemoved(item);
|
||||
onFolderAdded(parentFolder, child) {
|
||||
this._folderAddedOrRemoved(child);
|
||||
},
|
||||
OnItemRemoved(ParentItem, item) {
|
||||
this._itemAddedOrRemoved(item);
|
||||
onMessageAdded(parentFolder, msg) {},
|
||||
onFolderRemoved(parentFolder, child) {
|
||||
this._folderAddedOrRemoved(child);
|
||||
},
|
||||
onMessageRemoved(parentFolder, msg) {},
|
||||
|
||||
// xxx I stole this listener list from nsMsgFolderDatasource.cpp, but
|
||||
// someone should really document what events are fired when, so that
|
||||
// we make sure we're updating at the right times.
|
||||
OnItemPropertyChanged(item, property, old, newItem) {},
|
||||
OnItemIntPropertyChanged(item, property, old, aNew) {
|
||||
onFolderPropertyChanged(item, property, old, newItem) {},
|
||||
onFolderIntPropertyChanged(item, property, old, aNew) {
|
||||
if (item instanceof Ci.nsIMsgFolder) {
|
||||
if (property == "FolderFlag") {
|
||||
if (
|
||||
|
@ -307,15 +306,15 @@
|
|||
}
|
||||
this._setCssSelectorsForItem(item);
|
||||
},
|
||||
OnItemBoolPropertyChanged(item, property, old, newItem) {
|
||||
onFolderBoolPropertyChanged(item, property, old, newItem) {
|
||||
this._setCssSelectorsForItem(item);
|
||||
},
|
||||
OnItemUnicharPropertyChanged(item, property, old, newItem) {
|
||||
onFolderUnicharPropertyChanged(item, property, old, newItem) {
|
||||
this._setCssSelectorsForItem(item);
|
||||
},
|
||||
OnItemPropertyFlagChanged(item, property, old, newItem) {},
|
||||
onFolderPropertyFlagChanged(item, property, old, newItem) {},
|
||||
|
||||
OnItemEvent(folder, eventName) {
|
||||
onFolderEvent(folder, eventName) {
|
||||
if (eventName == "MRMTimeChanged") {
|
||||
if (
|
||||
this._menu.getAttribute("showRecent") != "true" ||
|
||||
|
|
|
@ -21,48 +21,50 @@ typedef unsigned long folderListenerNotifyFlagValue;
|
|||
*/
|
||||
[scriptable, uuid(f60ee1a2-6d81-422c-958f-d408b1b2daa7)]
|
||||
interface nsIFolderListener : nsISupports {
|
||||
// "added" flag covers adding both messages and child folders.
|
||||
const folderListenerNotifyFlagValue added = 0x1;
|
||||
void OnItemAdded(in nsIMsgFolder aParentItem,
|
||||
in nsISupports aItem);
|
||||
void onFolderAdded(in nsIMsgFolder parent, in nsIMsgFolder child);
|
||||
void onMessageAdded(in nsIMsgFolder parent, in nsIMsgDBHdr msg);
|
||||
|
||||
// "removed" flag covers removing both messages and child folders.
|
||||
const folderListenerNotifyFlagValue removed = 0x2;
|
||||
void OnItemRemoved(in nsIMsgFolder aParentItem,
|
||||
in nsISupports aItem);
|
||||
void onFolderRemoved(in nsIMsgFolder parent, in nsIMsgFolder child);
|
||||
void onMessageRemoved(in nsIMsgFolder parent, in nsIMsgDBHdr msg);
|
||||
|
||||
const folderListenerNotifyFlagValue propertyChanged = 0x4;
|
||||
void OnItemPropertyChanged(in nsIMsgFolder aItem,
|
||||
in ACString aProperty,
|
||||
in AUTF8String aOldValue,
|
||||
in AUTF8String aNewValue);
|
||||
void onFolderPropertyChanged(in nsIMsgFolder folder,
|
||||
in ACString property,
|
||||
in AUTF8String oldValue,
|
||||
in AUTF8String newValue);
|
||||
|
||||
const folderListenerNotifyFlagValue intPropertyChanged = 0x8;
|
||||
// While this property handles long long (64bit wide) values,
|
||||
// the Javascript engine will only pass values up to 2^53 to the consumers.
|
||||
void OnItemIntPropertyChanged(in nsIMsgFolder aItem,
|
||||
in ACString aProperty,
|
||||
in long long aOldValue,
|
||||
in long long aNewValue);
|
||||
void onFolderIntPropertyChanged(in nsIMsgFolder folder,
|
||||
in ACString property,
|
||||
in long long oldValue,
|
||||
in long long newValue);
|
||||
|
||||
const folderListenerNotifyFlagValue boolPropertyChanged = 0x10;
|
||||
void OnItemBoolPropertyChanged(in nsIMsgFolder aItem,
|
||||
in ACString aProperty,
|
||||
in boolean aOldValue,
|
||||
in boolean aNewValue);
|
||||
void onFolderBoolPropertyChanged(in nsIMsgFolder folder,
|
||||
in ACString property,
|
||||
in boolean oldValue,
|
||||
in boolean newValue);
|
||||
|
||||
const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20;
|
||||
void OnItemUnicharPropertyChanged(in nsIMsgFolder aItem,
|
||||
in ACString aProperty,
|
||||
in AString aOldValue,
|
||||
in AString aNewValue);
|
||||
void onFolderUnicharPropertyChanged(in nsIMsgFolder folder,
|
||||
in ACString property,
|
||||
in AString oldValue,
|
||||
in AString newValue);
|
||||
|
||||
const folderListenerNotifyFlagValue propertyFlagChanged = 0x40;
|
||||
void OnItemPropertyFlagChanged(in nsIMsgDBHdr aItem,
|
||||
in ACString aProperty,
|
||||
in unsigned long aOldFlag,
|
||||
in unsigned long aNewFlag);
|
||||
void onFolderPropertyFlagChanged(in nsIMsgDBHdr msg,
|
||||
in ACString property,
|
||||
in unsigned long oldFlag,
|
||||
in unsigned long newFlag);
|
||||
|
||||
const folderListenerNotifyFlagValue event = 0x80;
|
||||
void OnItemEvent(in nsIMsgFolder aItem, in ACString aEvent);
|
||||
void onFolderEvent(in nsIMsgFolder folder, in ACString event);
|
||||
|
||||
const folderListenerNotifyFlagValue all = 0xFFFFFFFF;
|
||||
};
|
||||
|
|
|
@ -120,31 +120,22 @@ class MailNotificationManager {
|
|||
/**
|
||||
* Following are nsIFolderListener interfaces. Do nothing about them.
|
||||
*/
|
||||
OnItemAdded() {}
|
||||
|
||||
OnItemRemoved() {}
|
||||
|
||||
OnItemPropertyChanged() {}
|
||||
|
||||
OnItemBoolPropertyChanged() {}
|
||||
|
||||
OnItemUnicharPropertyChanged() {}
|
||||
|
||||
OnItemPropertyFlagChanged() {}
|
||||
|
||||
OnItemEvent() {}
|
||||
|
||||
onFolderAdded() {}
|
||||
onMessageAdded() {}
|
||||
onFolderRemoved() {}
|
||||
onMessageRemoved() {}
|
||||
onFolderPropertyChanged() {}
|
||||
/**
|
||||
* The only nsIFolderListener interface we care about.
|
||||
* @see nsIFolderListener
|
||||
*/
|
||||
OnItemIntPropertyChanged(folder, property, oldValue, newValue) {
|
||||
onFolderIntPropertyChanged(folder, property, oldValue, newValue) {
|
||||
if (!Services.prefs.getBoolPref("mail.biff.show_alert")) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._logger.debug(
|
||||
`OnItemIntPropertyChanged; property=${property}: ${oldValue} => ${newValue}, folder.URI=${folder.URI}`
|
||||
`onFolderIntPropertyChanged; property=${property}: ${oldValue} => ${newValue}, folder.URI=${folder.URI}`
|
||||
);
|
||||
|
||||
switch (property) {
|
||||
|
@ -160,6 +151,10 @@ class MailNotificationManager {
|
|||
break;
|
||||
}
|
||||
}
|
||||
onFolderBoolPropertyChanged() {}
|
||||
onFolderUnicharPropertyChanged() {}
|
||||
onFolderPropertyFlagChanged() {}
|
||||
onFolderEvent() {}
|
||||
|
||||
/**
|
||||
* @see mozINewMailNotificationService
|
||||
|
|
|
@ -197,20 +197,13 @@ NewMailNotificationService.prototype = {
|
|||
return shouldCount.data;
|
||||
},
|
||||
|
||||
OnItemIntPropertyChanged(folder, property, oldValue, newValue) {
|
||||
onFolderIntPropertyChanged(folder, property, oldValue, newValue) {
|
||||
try {
|
||||
if (property == "FolderSize") {
|
||||
return;
|
||||
}
|
||||
this._log.trace(
|
||||
"NMNS_OnItemIntPropertyChanged: folder " +
|
||||
folder.URI +
|
||||
" " +
|
||||
property +
|
||||
" " +
|
||||
oldValue +
|
||||
" " +
|
||||
newValue
|
||||
`Changed int ${property} of ${folder.folderURL}: ${oldValue} -> ${newValue}`
|
||||
);
|
||||
if (property == "BiffState") {
|
||||
this._biffStateChanged(folder, oldValue, newValue);
|
||||
|
@ -220,7 +213,7 @@ NewMailNotificationService.prototype = {
|
|||
this._newMailReceived(folder, oldValue, newValue);
|
||||
}
|
||||
} catch (error) {
|
||||
this._log.error("NMNS_OnItemIntPropertyChanged: exception " + error);
|
||||
this._log.error("onFolderIntPropertyChanged: exception " + error);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -337,47 +330,39 @@ NewMailNotificationService.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
OnItemAdded(parentItem, item) {
|
||||
if (item instanceof Ci.nsIMsgDBHdr) {
|
||||
if (this.confirmShouldCount(item.folder)) {
|
||||
this._log.trace(
|
||||
"NMNS_OnItemAdded: item " +
|
||||
item.folder.getUriForMsg(item) +
|
||||
" added to " +
|
||||
item.folder.folderURL
|
||||
);
|
||||
}
|
||||
onFolderAdded(parentFolder, child) {
|
||||
this._log.trace(
|
||||
`Added child folder ${child.folderURL} to ${parentFolder.folderURL}`
|
||||
);
|
||||
},
|
||||
|
||||
onMessageAdded(parentFolder, msg) {
|
||||
if (this.confirmShouldCount(msg.folder)) {
|
||||
this._log.trace(`Added <${msg.messageId}> to ${msg.folder.folderURL}`);
|
||||
}
|
||||
},
|
||||
|
||||
OnItemPropertyFlagChanged(item, property, oldFlag, newFlag) {
|
||||
if (item instanceof Ci.nsIMsgDBHdr) {
|
||||
if (
|
||||
oldFlag & Ci.nsMsgMessageFlags.New &&
|
||||
!(newFlag & Ci.nsMsgMessageFlags.New)
|
||||
) {
|
||||
this._log.trace(
|
||||
"NMNS_OnItemPropertyFlagChanged: item " +
|
||||
item.folder.getUriForMsg(item) +
|
||||
" marked read"
|
||||
);
|
||||
} else if (newFlag & Ci.nsMsgMessageFlags.New) {
|
||||
this._log.trace(
|
||||
"NMNS_OnItemPropertyFlagChanged: item " +
|
||||
item.folder.getUriForMsg(item) +
|
||||
" marked unread"
|
||||
);
|
||||
}
|
||||
onFolderPropertyFlagChanged(msg, property, oldFlag, newFlag) {
|
||||
if (
|
||||
oldFlag & Ci.nsMsgMessageFlags.New &&
|
||||
!(newFlag & Ci.nsMsgMessageFlags.New)
|
||||
) {
|
||||
this._log.trace(`<${msg.messageId}> marked read`);
|
||||
} else if (newFlag & Ci.nsMsgMessageFlags.New) {
|
||||
this._log.trace(`<${msg.messageId}> marked unread`);
|
||||
}
|
||||
},
|
||||
|
||||
OnItemRemoved(parentItem, item) {
|
||||
if (item instanceof Ci.nsIMsgDBHdr && !item.isRead) {
|
||||
onFolderRemoved(parentFolder, child) {
|
||||
this._log.trace(
|
||||
`Removed child folder ${child.folderURL} from ${parentFolder.folderURL}`
|
||||
);
|
||||
},
|
||||
|
||||
onMessageRemoved(parentFolder, msg) {
|
||||
if (!msg.isRead) {
|
||||
this._log.trace(
|
||||
"NMNS_OnItemRemoved: unread item " +
|
||||
item.folder.getUriForMsg(item) +
|
||||
" removed from " +
|
||||
item.folder.folderURL
|
||||
`Removed unread <${msg.messageId}> from ${msg.folder.folderURL}`
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -2037,32 +2037,39 @@ nsMessenger::FormatFileSize(uint64_t aSize, bool aUseKB,
|
|||
return ::FormatFileSize(aSize, aUseKB, aFormattedSize);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessenger::OnItemAdded(nsIMsgFolder* parentItem,
|
||||
nsISupports* item) {
|
||||
NS_IMETHODIMP nsMessenger::OnFolderAdded(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* child) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessenger::OnItemRemoved(nsIMsgFolder* parentItem,
|
||||
nsISupports* item) {
|
||||
NS_IMETHODIMP nsMessenger::OnMessageAdded(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr* msg) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessenger::OnFolderRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* child) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessenger::OnMessageRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr* msgHdr) {
|
||||
// check if this item is a message header that's in our history list. If so,
|
||||
// remove it from the history list.
|
||||
nsCOMPtr<nsIMsgDBHdr> msgHdr = do_QueryInterface(item);
|
||||
if (msgHdr) {
|
||||
nsCOMPtr<nsIMsgFolder> folder;
|
||||
msgHdr->GetFolder(getter_AddRefs(folder));
|
||||
if (folder) {
|
||||
nsCString msgUri;
|
||||
nsMsgKey msgKey;
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
folder->GenerateMessageURI(msgKey, msgUri);
|
||||
// need to remove the corresponding folder entry, and
|
||||
// adjust the current history pos.
|
||||
size_t uriPos = mLoadedMsgHistory.IndexOf(msgUri);
|
||||
if (uriPos != mLoadedMsgHistory.NoIndex) {
|
||||
mLoadedMsgHistory.RemoveElementAt(uriPos);
|
||||
mLoadedMsgHistory.RemoveElementAt(uriPos); // and the folder uri entry
|
||||
if (mCurHistoryPos >= (int32_t)uriPos) mCurHistoryPos -= 2;
|
||||
}
|
||||
nsCOMPtr<nsIMsgFolder> folder;
|
||||
msgHdr->GetFolder(getter_AddRefs(folder));
|
||||
if (folder) {
|
||||
nsCString msgUri;
|
||||
nsMsgKey msgKey;
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
folder->GenerateMessageURI(msgKey, msgUri);
|
||||
// need to remove the corresponding folder entry, and
|
||||
// adjust the current history pos.
|
||||
size_t uriPos = mLoadedMsgHistory.IndexOf(msgUri);
|
||||
if (uriPos != mLoadedMsgHistory.NoIndex) {
|
||||
mLoadedMsgHistory.RemoveElementAt(uriPos);
|
||||
mLoadedMsgHistory.RemoveElementAt(uriPos); // and the folder uri entry
|
||||
if (mCurHistoryPos >= (int32_t)uriPos) mCurHistoryPos -= 2;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -128,7 +128,7 @@ nsMsgAccount::SetIncomingServer(nsIMsgIncomingServer* aIncomingServer) {
|
|||
nsCOMPtr<nsIFolderListener> mailSession =
|
||||
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mailSession->OnItemAdded(nullptr, rootFolder);
|
||||
mailSession->OnFolderAdded(nullptr, rootFolder);
|
||||
nsCOMPtr<nsIMsgFolderNotificationService> notifier(
|
||||
do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -145,7 +145,7 @@ nsMsgAccount::SetIncomingServer(nsIMsgIncomingServer* aIncomingServer) {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (nsIMsgFolder* msgFolder : subFolders) {
|
||||
mailSession->OnItemAdded(rootFolder, msgFolder);
|
||||
mailSession->OnFolderAdded(rootFolder, msgFolder);
|
||||
notifier->NotifyFolderAdded(msgFolder);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -505,11 +505,11 @@ nsMsgAccountManager::RemoveIncomingServer(nsIMsgIncomingServer* aServer,
|
|||
if (mailSession) {
|
||||
nsCOMPtr<nsIMsgFolder> parentFolder;
|
||||
folder->GetParent(getter_AddRefs(parentFolder));
|
||||
mailSession->OnItemRemoved(parentFolder, folder);
|
||||
mailSession->OnFolderRemoved(parentFolder, folder);
|
||||
}
|
||||
}
|
||||
if (notifier) notifier->NotifyFolderDeleted(rootFolder);
|
||||
if (mailSession) mailSession->OnItemRemoved(nullptr, rootFolder);
|
||||
if (mailSession) mailSession->OnFolderRemoved(nullptr, rootFolder);
|
||||
|
||||
removeListenersFromFolder(rootFolder);
|
||||
NotifyServerUnloaded(aServer);
|
||||
|
@ -2947,12 +2947,8 @@ NS_IMETHODIMP nsMsgAccountManager::GetAllFolders(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgAccountManager::OnItemAdded(nsIMsgFolder* parentItem,
|
||||
nsISupports* item) {
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(item);
|
||||
// just kick out with a success code if the item in question is not a folder
|
||||
if (!folder) return NS_OK;
|
||||
|
||||
NS_IMETHODIMP nsMsgAccountManager::OnFolderAdded(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* folder) {
|
||||
uint32_t folderFlags;
|
||||
folder->GetFlags(&folderFlags);
|
||||
bool addToSmartFolders = false;
|
||||
|
@ -3028,10 +3024,10 @@ NS_IMETHODIMP nsMsgAccountManager::OnItemAdded(nsIMsgFolder* parentItem,
|
|||
rv = folder->GetDescendants(allDescendants);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> parent;
|
||||
nsCOMPtr<nsIMsgFolder> parentFolder;
|
||||
for (auto subFolder : allDescendants) {
|
||||
subFolder->GetParent(getter_AddRefs(parent));
|
||||
OnItemAdded(parent, subFolder);
|
||||
subFolder->GetParent(getter_AddRefs(parentFolder));
|
||||
OnFolderAdded(parentFolder, subFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3058,11 +3054,13 @@ NS_IMETHODIMP nsMsgAccountManager::OnItemAdded(nsIMsgFolder* parentItem,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgAccountManager::OnItemRemoved(nsIMsgFolder* parentItem,
|
||||
nsISupports* item) {
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(item);
|
||||
// just kick out with a success code if the item in question is not a folder
|
||||
if (!folder) return NS_OK;
|
||||
NS_IMETHODIMP nsMsgAccountManager::OnMessageAdded(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr* msg) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgAccountManager::OnFolderRemoved(nsIMsgFolder* parentFolder,
|
||||
nsIMsgFolder* folder) {
|
||||
nsresult rv = NS_OK;
|
||||
uint32_t folderFlags;
|
||||
folder->GetFlags(&folderFlags);
|
||||
|
@ -3135,6 +3133,11 @@ NS_IMETHODIMP nsMsgAccountManager::OnItemRemoved(nsIMsgFolder* parentItem,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgAccountManager::OnMessageRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr* msg) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgAccountManager::OnItemPropertyChanged(
|
||||
nsIMsgFolder* item, const nsACString& property, const nsACString& oldValue,
|
||||
const nsACString& newValue) {
|
||||
|
@ -3152,11 +3155,11 @@ nsMsgAccountManager::OnItemIntPropertyChanged(nsIMsgFolder* aFolder,
|
|||
(nsMsgFolderFlags::SpecialUse & ~nsMsgFolderFlags::Queue);
|
||||
if (smartFlagsChanged) {
|
||||
if (smartFlagsChanged & newValue) {
|
||||
// if the smart folder flag was set, calling OnItemAdded will
|
||||
// if the smart folder flag was set, calling OnFolderAdded will
|
||||
// do the right thing.
|
||||
nsCOMPtr<nsIMsgFolder> parent;
|
||||
aFolder->GetParent(getter_AddRefs(parent));
|
||||
return OnItemAdded(parent, aFolder);
|
||||
return OnFolderAdded(parent, aFolder);
|
||||
}
|
||||
RemoveFolderFromSmartFolder(aFolder, smartFlagsChanged);
|
||||
// sent|archive flag removed, remove sub-folders from smart folder.
|
||||
|
|
|
@ -4520,50 +4520,50 @@ nsMsgDBFolder::NotifyPropertyFlagChanged(nsIMsgDBHdr* aItem,
|
|||
|
||||
NS_IMETHODIMP nsMsgDBFolder::NotifyMessageAdded(nsIMsgDBHdr* msg) {
|
||||
// Notify our directly-registered listeners.
|
||||
NOTIFY_LISTENERS(OnItemAdded, (this, msg));
|
||||
NOTIFY_LISTENERS(OnMessageAdded, (this, msg));
|
||||
// Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFolderListener> folderListenerManager =
|
||||
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = folderListenerManager->OnItemAdded(this, msg);
|
||||
rv = folderListenerManager->OnMessageAdded(this, msg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMsgDBFolder::NotifyMessageRemoved(nsIMsgDBHdr* msg) {
|
||||
// Notify our directly-registered listeners.
|
||||
NOTIFY_LISTENERS(OnItemRemoved, (this, msg));
|
||||
NOTIFY_LISTENERS(OnMessageRemoved, (this, msg));
|
||||
// Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFolderListener> folderListenerManager =
|
||||
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = folderListenerManager->OnItemRemoved(this, msg);
|
||||
rv = folderListenerManager->OnMessageRemoved(this, msg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::NotifyFolderAdded(nsIMsgFolder* child) {
|
||||
NOTIFY_LISTENERS(OnItemAdded, (this, child));
|
||||
NOTIFY_LISTENERS(OnFolderAdded, (this, child));
|
||||
|
||||
// Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFolderListener> folderListenerManager =
|
||||
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return folderListenerManager->OnItemAdded(this, child);
|
||||
return folderListenerManager->OnFolderAdded(this, child);
|
||||
}
|
||||
|
||||
nsresult nsMsgDBFolder::NotifyFolderRemoved(nsIMsgFolder* child) {
|
||||
NOTIFY_LISTENERS(OnItemRemoved, (this, child));
|
||||
NOTIFY_LISTENERS(OnFolderRemoved, (this, child));
|
||||
|
||||
// Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFolderListener> folderListenerManager =
|
||||
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return folderListenerManager->OnItemRemoved(this, child);
|
||||
return folderListenerManager->OnFolderRemoved(this, child);
|
||||
}
|
||||
|
||||
nsresult nsMsgDBFolder::NotifyFolderEvent(const nsACString& aEvent) {
|
||||
|
|
|
@ -131,15 +131,26 @@ nsMsgMailSession::OnItemPropertyFlagChanged(nsIMsgDBHdr* aItem,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailSession::OnItemAdded(nsIMsgFolder* aParentItem,
|
||||
nsISupports* aItem) {
|
||||
NOTIFY_FOLDER_LISTENERS(added, OnItemAdded, (aParentItem, aItem));
|
||||
NS_IMETHODIMP nsMsgMailSession::OnFolderAdded(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* child) {
|
||||
NOTIFY_FOLDER_LISTENERS(added, OnFolderAdded, (parent, child));
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsMsgMailSession::OnMessageAdded(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr* msg) {
|
||||
NOTIFY_FOLDER_LISTENERS(added, OnMessageAdded, (parent, msg));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailSession::OnItemRemoved(nsIMsgFolder* aParentItem,
|
||||
nsISupports* aItem) {
|
||||
NOTIFY_FOLDER_LISTENERS(removed, OnItemRemoved, (aParentItem, aItem));
|
||||
NS_IMETHODIMP nsMsgMailSession::OnFolderRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* child) {
|
||||
NOTIFY_FOLDER_LISTENERS(removed, OnFolderRemoved, (parent, child));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailSession::OnMessageRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr* msg) {
|
||||
NOTIFY_FOLDER_LISTENERS(removed, OnMessageRemoved, (parent, msg));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -174,7 +185,7 @@ NS_IMETHODIMP
|
|||
nsMsgMailSession::AlertUser(const nsAString& aMessage,
|
||||
nsIMsgMailNewsUrl* aUrl) {
|
||||
bool listenersNotified = false;
|
||||
nsTObserverArray<nsCOMPtr<nsIMsgUserFeedbackListener> >::ForwardIterator iter(
|
||||
nsTObserverArray<nsCOMPtr<nsIMsgUserFeedbackListener>>::ForwardIterator iter(
|
||||
mFeedbackListeners);
|
||||
nsCOMPtr<nsIMsgUserFeedbackListener> listener;
|
||||
|
||||
|
|
|
@ -142,14 +142,25 @@ nsresult nsStatusBarBiffManager::PlayBiffSound(const char* aPrefBranch) {
|
|||
|
||||
// nsIFolderListener methods....
|
||||
NS_IMETHODIMP
|
||||
nsStatusBarBiffManager::OnItemAdded(nsIMsgFolder* parentItem,
|
||||
nsISupports* item) {
|
||||
nsStatusBarBiffManager::OnFolderAdded(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* child) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusBarBiffManager::OnItemRemoved(nsIMsgFolder* parentItem,
|
||||
nsISupports* item) {
|
||||
nsStatusBarBiffManager::OnMessageAdded(nsIMsgFolder* parent, nsIMsgDBHdr* msg) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusBarBiffManager::OnFolderRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* child) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusBarBiffManager::OnMessageRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr* msg) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ function CreateVirtualFolder(
|
|||
// use acctMgr to setup the virtual folder listener
|
||||
var acctMgr = MailServices.accounts.QueryInterface(Ci.nsIFolderListener);
|
||||
// print(acctMgr);
|
||||
acctMgr.OnItemAdded(null, newFolder);
|
||||
acctMgr.onFolderAdded(parentFolder, newFolder);
|
||||
return newFolder;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ add_test(function testNotifyInbox() {
|
|||
let notif = MailServices.newMailNotification.wrappedJSObject;
|
||||
notif.addListener(mockListener, iNMNS.count);
|
||||
|
||||
notif.OnItemIntPropertyChanged(folder, "TotalUnreadMessages", 0, 2);
|
||||
notif.onFolderIntPropertyChanged(folder, "TotalUnreadMessages", 0, 2);
|
||||
Assert.ok(notified);
|
||||
|
||||
// Special folders should never count
|
||||
|
@ -93,7 +93,7 @@ add_test(function testNotifyInbox() {
|
|||
flags: Ci.nsMsgFolderFlags.Mail | Ci.nsMsgFolderFlags.Junk,
|
||||
};
|
||||
notified = false;
|
||||
notif.OnItemIntPropertyChanged(special, "TotalUnreadMessages", 0, 2);
|
||||
notif.onFolderIntPropertyChanged(special, "TotalUnreadMessages", 0, 2);
|
||||
Assert.ok(!notified);
|
||||
|
||||
// by default, non-inbox should not count
|
||||
|
@ -102,13 +102,13 @@ add_test(function testNotifyInbox() {
|
|||
flags: Ci.nsMsgFolderFlags.Mail,
|
||||
};
|
||||
notified = false;
|
||||
notif.OnItemIntPropertyChanged(nonInbox, "TotalUnreadMessages", 0, 2);
|
||||
notif.onFolderIntPropertyChanged(nonInbox, "TotalUnreadMessages", 0, 2);
|
||||
Assert.ok(!notified);
|
||||
|
||||
// Try setting the pref to count non-inboxes and notifying a non-inbox
|
||||
Services.prefs.setBoolPref(countInboxesPref, false);
|
||||
notified = false;
|
||||
notif.OnItemIntPropertyChanged(nonInbox, "TotalUnreadMessages", 0, 2);
|
||||
notif.onFolderIntPropertyChanged(nonInbox, "TotalUnreadMessages", 0, 2);
|
||||
Assert.ok(notified);
|
||||
|
||||
run_next_test();
|
||||
|
|
|
@ -14,14 +14,16 @@ load("../../../resources/MessageGenerator.jsm");
|
|||
load("../../../resources/messageInjection.js");
|
||||
|
||||
var folderListener = {
|
||||
OnItemAdded() {},
|
||||
OnItemRemoved() {},
|
||||
OnItemPropertyChanged() {},
|
||||
OnItemIntPropertyChanged() {},
|
||||
OnItemBoolPropertyChanged() {},
|
||||
OnItemUnicharPropertyChanged() {},
|
||||
OnItemPropertyFlagChanged() {},
|
||||
OnItemEvent() {},
|
||||
onFolderAdded() {},
|
||||
onMessageAdded() {},
|
||||
onFolderRemoved() {},
|
||||
onMessageRemoved() {},
|
||||
onFolderPropertyChanged() {},
|
||||
onFolderIntPropertyChanged() {},
|
||||
onFolderBoolPropertyChanged() {},
|
||||
onFolderUnicharPropertyChanged() {},
|
||||
onFolderPropertyFlagChanged() {},
|
||||
onFolderEvent() {},
|
||||
};
|
||||
|
||||
var targetFolder;
|
||||
|
|
|
@ -24,49 +24,61 @@ fL.prototype = {
|
|||
mReceived: 0,
|
||||
mAutoRemoveItem: false,
|
||||
|
||||
OnItemAdded(parentItem, item) {
|
||||
onFolderAdded(parentFolder, child) {
|
||||
this.mReceived |= Ci.nsIFolderListener.added;
|
||||
if (this.mAutoRemoveItem) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
}
|
||||
},
|
||||
OnItemRemoved(parentItem, item) {
|
||||
onMessageAdded(parentFolder, msg) {
|
||||
this.mReceived |= Ci.nsIFolderListener.added;
|
||||
if (this.mAutoRemoveItem) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
}
|
||||
},
|
||||
onFolderRemoved(parentFolder, child) {
|
||||
this.mReceived |= Ci.nsIFolderListener.removed;
|
||||
if (this.mAutoRemoveItem) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
}
|
||||
},
|
||||
OnItemPropertyChanged(item, property, oldValue, newValue) {
|
||||
onMessageRemoved(parentFolder, msg) {
|
||||
this.mReceived |= Ci.nsIFolderListener.removed;
|
||||
if (this.mAutoRemoveItem) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
}
|
||||
},
|
||||
onFolderPropertyChanged(item, property, oldValue, newValue) {
|
||||
this.mReceived |= Ci.nsIFolderListener.propertyChanged;
|
||||
if (this.mAutoRemoveItem) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
}
|
||||
},
|
||||
OnItemIntPropertyChanged(item, property, oldValue, newValue) {
|
||||
onFolderIntPropertyChanged(item, property, oldValue, newValue) {
|
||||
this.mReceived |= Ci.nsIFolderListener.intPropertyChanged;
|
||||
if (this.mAutoRemoveItem) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
}
|
||||
},
|
||||
OnItemBoolPropertyChanged(item, property, oldValue, newValue) {
|
||||
onFolderBoolPropertyChanged(item, property, oldValue, newValue) {
|
||||
this.mReceived |= Ci.nsIFolderListener.boolPropertyChanged;
|
||||
if (this.mAutoRemoveItem) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
}
|
||||
},
|
||||
OnItemUnicharPropertyChanged(item, property, oldValue, newValue) {
|
||||
onFolderUnicharPropertyChanged(item, property, oldValue, newValue) {
|
||||
this.mReceived |= Ci.nsIFolderListener.unicharPropertyChanged;
|
||||
if (this.mAutoRemoveItem) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
}
|
||||
},
|
||||
OnItemPropertyFlagChanged(item, property, oldValue, newValue) {
|
||||
onFolderPropertyFlagChanged(item, property, oldValue, newValue) {
|
||||
this.mReceived |= Ci.nsIFolderListener.propertyFlagChanged;
|
||||
if (this.mAutoRemoveItem) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
}
|
||||
},
|
||||
OnItemEvent(parentItem, item) {
|
||||
onFolderEvent(parentItem, item) {
|
||||
this.mReceived |= Ci.nsIFolderListener.event;
|
||||
if (this.mAutoRemoveItem) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
|
@ -75,14 +87,16 @@ fL.prototype = {
|
|||
};
|
||||
|
||||
function NotifyMailSession() {
|
||||
gMailSessionNotifier.OnItemAdded(null, null);
|
||||
gMailSessionNotifier.OnItemRemoved(null, null);
|
||||
gMailSessionNotifier.OnItemPropertyChanged(null, null, null, null);
|
||||
gMailSessionNotifier.OnItemIntPropertyChanged(null, null, null, null);
|
||||
gMailSessionNotifier.OnItemBoolPropertyChanged(null, null, null, null);
|
||||
gMailSessionNotifier.OnItemUnicharPropertyChanged(null, null, null, null);
|
||||
gMailSessionNotifier.OnItemPropertyFlagChanged(null, null, null, null);
|
||||
gMailSessionNotifier.OnItemEvent(null, null);
|
||||
gMailSessionNotifier.onFolderAdded(null, null);
|
||||
gMailSessionNotifier.onMessageAdded(null, null);
|
||||
gMailSessionNotifier.onFolderRemoved(null, null);
|
||||
gMailSessionNotifier.onMessageRemoved(null, null);
|
||||
gMailSessionNotifier.onFolderPropertyChanged(null, null, null, null);
|
||||
gMailSessionNotifier.onFolderIntPropertyChanged(null, null, null, null);
|
||||
gMailSessionNotifier.onFolderBoolPropertyChanged(null, null, null, null);
|
||||
gMailSessionNotifier.onFolderUnicharPropertyChanged(null, null, null, null);
|
||||
gMailSessionNotifier.onFolderPropertyFlagChanged(null, null, null, null);
|
||||
gMailSessionNotifier.onFolderEvent(null, null);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -1279,8 +1279,7 @@ nsresult nsMsgSendLater::GetIdentityFromKey(const char* aKey,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSendLater::OnItemAdded(nsIMsgFolder* aParentItem, nsISupports* aItem) {
|
||||
nsresult nsMsgSendLater::StartTimer() {
|
||||
// No need to trigger if timer is already set
|
||||
if (mTimerSet) return NS_OK;
|
||||
|
||||
|
@ -1304,7 +1303,25 @@ nsMsgSendLater::OnItemAdded(nsIMsgFolder* aParentItem, nsISupports* aItem) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSendLater::OnItemRemoved(nsIMsgFolder* aParentItem, nsISupports* aItem) {
|
||||
nsMsgSendLater::OnFolderAdded(nsIMsgFolder* /*parent*/,
|
||||
nsIMsgFolder* /*child*/) {
|
||||
return StartTimer();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSendLater::OnMessageAdded(nsIMsgFolder* /*parent*/, nsIMsgDBHdr* /*msg*/) {
|
||||
return StartTimer();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSendLater::OnFolderRemoved(nsIMsgFolder* /*parent*/,
|
||||
nsIMsgFolder* /*child*/) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSendLater::OnMessageRemoved(nsIMsgFolder* /*parent*/,
|
||||
nsIMsgDBHdr* /*msg*/) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ class nsMsgSendLater : public nsIMsgSendLater,
|
|||
nsresult GetIdentityFromKey(const char* aKey, nsIMsgIdentity** aIdentity);
|
||||
nsresult ReparseDBIfNeeded(nsIUrlListener* aListener);
|
||||
nsresult InternalSendMessages(bool aUserInitiated, nsIMsgIdentity* aIdentity);
|
||||
nsresult StartTimer();
|
||||
|
||||
nsTObserverArray<nsCOMPtr<nsIMsgSendLaterListener> > mListenerArray;
|
||||
nsCOMPtr<nsIMsgDBHdr> mMessage;
|
||||
|
|
|
@ -2917,15 +2917,17 @@ var GlodaMsgIndexer = {
|
|||
this.indexer = aIndexer;
|
||||
},
|
||||
|
||||
OnItemAdded(aParentItem, aItem) {},
|
||||
OnItemRemoved(aParentItem, aItem) {},
|
||||
OnItemPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
onFolderAdded(parentFolder, child) {},
|
||||
onMessageAdded(parentFolder, msg) {},
|
||||
onFolderRemoved(parentFolder, child) {},
|
||||
onMessageRemoved(parentFolder, msg) {},
|
||||
onFolderPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
/**
|
||||
* Detect changes to folder flags and reset our indexing priority. This
|
||||
* is important because (all?) folders start out without any flags and
|
||||
* then get their flags added to them.
|
||||
*/
|
||||
OnItemIntPropertyChanged(aFolderItem, aProperty, aOldValue, aNewValue) {
|
||||
onFolderIntPropertyChanged(aFolderItem, aProperty, aOldValue, aNewValue) {
|
||||
if (aProperty !== "FolderFlag") {
|
||||
return;
|
||||
}
|
||||
|
@ -2941,13 +2943,13 @@ var GlodaMsgIndexer = {
|
|||
}
|
||||
GlodaMsgIndexer.resetFolderIndexingPriority(aFolderItem);
|
||||
},
|
||||
OnItemBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
OnItemUnicharPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
onFolderBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
onFolderUnicharPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
/**
|
||||
* Notice when user activity adds/removes tags or changes a message's
|
||||
* status.
|
||||
*/
|
||||
OnItemPropertyFlagChanged(aMsgHdr, aProperty, aOldValue, aNewValue) {
|
||||
onFolderPropertyFlagChanged(aMsgHdr, aProperty, aOldValue, aNewValue) {
|
||||
if (
|
||||
aProperty == "Keywords" ||
|
||||
// We could care less about the new flag changing.
|
||||
|
@ -2966,7 +2968,7 @@ var GlodaMsgIndexer = {
|
|||
* Get folder loaded notifications for folders that had to do some
|
||||
* (asynchronous) processing before they could be opened.
|
||||
*/
|
||||
OnItemEvent(aFolder, aEvent) {
|
||||
onFolderEvent(aFolder, aEvent) {
|
||||
if (aEvent == "FolderLoaded") {
|
||||
this.indexer._onFolderLoaded(aFolder);
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ function* endTest() {
|
|||
}
|
||||
|
||||
var gFolderListener = {
|
||||
OnItemBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
|
||||
onFolderBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
|
||||
// This means that the STAT on "folder 2" has finished.
|
||||
if (aProperty == "NewMessages" && aNewValue) {
|
||||
async_driver();
|
||||
|
|
|
@ -419,7 +419,7 @@ function endTest() {
|
|||
|
||||
// nsIFolderListener implementation
|
||||
var FolderListener = {
|
||||
OnItemEvent(aEventFolder, aEvent) {
|
||||
onFolderEvent(aEventFolder, aEvent) {
|
||||
dump(
|
||||
"received folder event " + aEvent + " folder " + aEventFolder.name + "\n"
|
||||
);
|
||||
|
|
|
@ -251,7 +251,7 @@ function endTest() {
|
|||
|
||||
// nsIFolderListener implementation
|
||||
var FolderListener = {
|
||||
OnItemEvent(aEventFolder, aEvent) {
|
||||
onFolderEvent(aEventFolder, aEvent) {
|
||||
dump(
|
||||
"received folder event " + aEvent + " folder " + aEventFolder.name + "\n"
|
||||
);
|
||||
|
|
|
@ -34,7 +34,7 @@ var dummyMsgWindow = {
|
|||
|
||||
var gFolderListener = {
|
||||
_gotNewMailBiff: false,
|
||||
OnItemIntPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
|
||||
onFolderIntPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
|
||||
if (
|
||||
aProperty == "BiffState" &&
|
||||
aNewValue == Ci.nsIMsgFolder.nsMsgBiffState_NewMail
|
||||
|
|
|
@ -359,34 +359,42 @@ nsLocalMoveCopyMsgTxn::RedoTransaction() {
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemAdded(nsIMsgFolder* parentItem,
|
||||
nsISupports* item) {
|
||||
nsCOMPtr<nsIMsgDBHdr> msgHdr(do_QueryInterface(item));
|
||||
if (msgHdr) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgFolder> folder =
|
||||
do_QueryReferent(m_undoing ? m_srcFolder : m_dstFolder, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCString messageId;
|
||||
msgHdr->GetMessageId(getter_Copies(messageId));
|
||||
if (m_copiedMsgIds.Contains(messageId)) {
|
||||
nsMsgKey msgKey;
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
if (m_undoing)
|
||||
m_srcKeyArray.AppendElement(msgKey);
|
||||
else
|
||||
m_dstKeyArray.AppendElement(msgKey);
|
||||
if (++m_numHdrsCopied == m_copiedMsgIds.Length()) {
|
||||
folder->RemoveFolderListener(this);
|
||||
m_copiedMsgIds.Clear();
|
||||
}
|
||||
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnFolderAdded(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* child) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnMessageAdded(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr
|
||||
: msgHdr) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgFolder> folder =
|
||||
do_QueryReferent(m_undoing ? m_srcFolder : m_dstFolder, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCString messageId;
|
||||
msgHdr->GetMessageId(getter_Copies(messageId));
|
||||
if (m_copiedMsgIds.Contains(messageId)) {
|
||||
nsMsgKey msgKey;
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
if (m_undoing)
|
||||
m_srcKeyArray.AppendElement(msgKey);
|
||||
else
|
||||
m_dstKeyArray.AppendElement(msgKey);
|
||||
if (++m_numHdrsCopied == m_copiedMsgIds.Length()) {
|
||||
folder->RemoveFolderListener(this);
|
||||
m_copiedMsgIds.Clear();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemRemoved(nsIMsgFolder* parentItem,
|
||||
nsISupports* item) {
|
||||
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnFolderRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* child) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnMessageRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr* msg) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -435,13 +443,23 @@ nsLocalUndoFolderListener::nsLocalUndoFolderListener(
|
|||
|
||||
nsLocalUndoFolderListener::~nsLocalUndoFolderListener() {}
|
||||
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemAdded(nsIMsgFolder* parentItem,
|
||||
nsISupports* item) {
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnFolderAdded(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* child) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemRemoved(nsIMsgFolder* parentItem,
|
||||
nsISupports* item) {
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnMessageAdded(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr* msg) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnFolderRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgFolder* child) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnMessageRemoved(nsIMsgFolder* parent,
|
||||
nsIMsgDBHdr* msg) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,10 +79,13 @@ var FListener = {
|
|||
return this.totalMsgs[this.totalMsgs.length - 1 - aBack];
|
||||
},
|
||||
|
||||
OnItemAdded: function act_add(aRDFParentItem, aItem) {},
|
||||
OnItemRemoved: function act_remove(aRDFParentItem, aItem) {},
|
||||
OnItemPropertyChanged(aItem, aProperty, aOld, aNew) {},
|
||||
OnItemIntPropertyChanged(aItem, aProperty, aOld, aNew) {
|
||||
onFolderAdded: function act_add(parentFolder, child) {},
|
||||
onMessageAdded: function act_add(parentFolder, msg) {},
|
||||
onFolderRemoved: function act_remove(parentFolder, child) {},
|
||||
onMessageRemoved: function act_remove(parentFolder, msg) {},
|
||||
|
||||
onFolderPropertyChanged(aItem, aProperty, aOld, aNew) {},
|
||||
onFolderIntPropertyChanged(aItem, aProperty, aOld, aNew) {
|
||||
if (aItem === gInbox) {
|
||||
dump(
|
||||
"Property change on folder Inbox:" +
|
||||
|
@ -100,10 +103,10 @@ var FListener = {
|
|||
}
|
||||
}
|
||||
},
|
||||
OnItemBoolPropertyChanged(aItem, aProperty, aOld, aNew) {},
|
||||
OnItemUnicharPropertyChanged(aItem, aProperty, aOld, aNew) {},
|
||||
OnItemPropertyFlagChanged(aItem, aProperty, aOld, aNew) {},
|
||||
OnItemEvent(aFolder, aEvent) {},
|
||||
onFolderBoolPropertyChanged(aItem, aProperty, aOld, aNew) {},
|
||||
onFolderUnicharPropertyChanged(aItem, aProperty, aOld, aNew) {},
|
||||
onFolderPropertyFlagChanged(aItem, aProperty, aOld, aNew) {},
|
||||
onFolderEvent(aFolder, aEvent) {},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -365,7 +368,7 @@ function downloadOver4GiB_success_check() {
|
|||
Assert.equal(gInbox.sizeOnDisk, localInboxSize);
|
||||
|
||||
// Bug 813459
|
||||
// Check if the OnItemIntPropertyChanged folder listener hook can return
|
||||
// Check if the onFolderIntPropertyChanged folder listener hook can return
|
||||
// values above 2^32 for properties where it is relevant.
|
||||
Assert.equal(FListener.sizeHistory(0), gInbox.sizeOnDisk);
|
||||
Assert.ok(FListener.sizeHistory(1) < FListener.sizeHistory(0));
|
||||
|
@ -560,7 +563,7 @@ var ParseListener_run_test = {
|
|||
Assert.notEqual(gInbox.msgDatabase, null);
|
||||
Assert.ok(gInbox.msgDatabase.summaryValid);
|
||||
// Bug 813459
|
||||
// Check if the OnItemIntPropertyChanged folder listener hook can return
|
||||
// Check if the onFolderIntPropertyChanged folder listener hook can return
|
||||
// values below 2^32 for properties which are not 64 bits long.
|
||||
Assert.equal(FListener.msgsHistory(0), gExpectedNewMessages);
|
||||
Assert.equal(FListener.msgsHistory(0), gInbox.getTotalMessages(false));
|
||||
|
|
|
@ -82,7 +82,7 @@ add_task(async function trigger_bug() {
|
|||
return new Promise((resolve, reject) => {
|
||||
let folderListener = {
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIFolderListener"]),
|
||||
OnItemEvent(aEventFolder, aEvent) {
|
||||
onFolderEvent(aEventFolder, aEvent) {
|
||||
if (
|
||||
aEvent == "FolderLoaded" &&
|
||||
aEventFolder.prettyName == "test.subscribe.simple"
|
||||
|
|
|
@ -79,7 +79,7 @@ function* test_cancel() {
|
|||
let hdr = db.GetMsgHdrForKey(4);
|
||||
|
||||
let folderListener = {
|
||||
OnItemEvent(aEventFolder, aEvent) {
|
||||
onFolderEvent(aEventFolder, aEvent) {
|
||||
if (aEvent == "DeleteOrMoveMsgCompleted") {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
}
|
||||
|
|
|
@ -519,7 +519,7 @@ var mailTestUtils = {
|
|||
// register for the folder loaded notification ahead of time... even though
|
||||
// we may not need it...
|
||||
let folderListener = {
|
||||
OnItemEvent(aEventFolder, aEvent) {
|
||||
onFolderEvent(aEventFolder, aEvent) {
|
||||
if (aEvent == "FolderLoaded" && aFolder.URI == aEventFolder.URI) {
|
||||
MailServices.mailSession.RemoveFolderListener(this);
|
||||
aCallback.apply(aCallbackThis, aCallbackArgs);
|
||||
|
|
|
@ -178,7 +178,7 @@ PromiseTestUtils.promiseFolderEvent = function(folder, event) {
|
|||
return new Promise((resolve, reject) => {
|
||||
let folderListener = {
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIFolderListener"]),
|
||||
OnItemEvent(aEventFolder, aEvent) {
|
||||
onFolderEvent(aEventFolder, aEvent) {
|
||||
if (folder === aEventFolder && event == aEvent) {
|
||||
MailServices.mailSession.RemoveFolderListener(folderListener);
|
||||
resolve();
|
||||
|
|
|
@ -144,18 +144,20 @@ var _folderEventLogHelper_msgFolderListener = {
|
|||
* nsIFolderListener implementation to logHelper stuff that gloda cares about.
|
||||
*/
|
||||
var _folderEventLogHelper_folderListener = {
|
||||
OnItemAdded(aParentItem, aItem) {},
|
||||
OnItemRemoved(aParentItem, aItem) {},
|
||||
OnItemPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
OnItemIntPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
OnItemBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
OnItemUnicharPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
onFolderAdded(parentFolder, child) {},
|
||||
onMessageAdded(parentFolder, msg) {},
|
||||
onFolderRemoved(parentFolder, child) {},
|
||||
onMessageRemoved(parentFolder, msg) {},
|
||||
onFolderPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
onFolderIntPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
onFolderBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
onFolderUnicharPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
|
||||
/**
|
||||
* Notice when user activity adds/removes tags or changes a message's
|
||||
* status.
|
||||
*/
|
||||
OnItemPropertyFlagChanged(aMsgHdr, aProperty, aOldValue, aNewValue) {
|
||||
mark_action("msgEvent", "OnItemPropertyFlagChanged", [
|
||||
onFolderPropertyFlagChanged(aMsgHdr, aProperty, aOldValue, aNewValue) {
|
||||
mark_action("msgEvent", "onFolderPropertyFlagChanged", [
|
||||
"Header",
|
||||
aMsgHdr,
|
||||
"had property " +
|
||||
|
@ -170,7 +172,7 @@ var _folderEventLogHelper_folderListener = {
|
|||
* Get folder loaded notifications for folders that had to do some
|
||||
* (asynchronous) processing before they could be opened.
|
||||
*/
|
||||
OnItemEvent(aFolder, aEvent) {
|
||||
mark_action("msgEvent", "OnItemEvent", [aFolder, aEvent]);
|
||||
onFolderEvent(aFolder, aEvent) {
|
||||
mark_action("msgEvent", "onFolderEvent", [aFolder, aEvent]);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -190,20 +190,21 @@ var gSearchNotificationListener =
|
|||
|
||||
// the folderListener object
|
||||
var gFolderListener = {
|
||||
OnItemAdded: function(parentItem, item) {},
|
||||
onFolderAdded: function(parentFolder, child) {},
|
||||
onMessageAdded: function(parentFolder, msg) {},
|
||||
onFolderRemoved: function(parentFolder, child) {},
|
||||
onMessageRemoved: function(parentFolder, msg) {},
|
||||
|
||||
OnItemRemoved: function(parentItem, item){},
|
||||
onFolderPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
|
||||
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
onFolderIntPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
|
||||
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
onFolderBoolPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
|
||||
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
onFolderUnicharPropertyChanged: function(item, property, oldValue, newValue){},
|
||||
onFolderPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
|
||||
|
||||
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){},
|
||||
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
|
||||
|
||||
OnItemEvent: function(folder, event) {
|
||||
onFolderEvent: function(folder, event) {
|
||||
if (event == "DeleteOrMoveMsgCompleted") {
|
||||
HandleDeleteOrMoveMessageCompleted(folder);
|
||||
}
|
||||
|
|
|
@ -1391,10 +1391,9 @@ let gFolderTreeView = {
|
|||
/**
|
||||
* This is our implementation of nsIMsgFolderListener to watch for changes
|
||||
*/
|
||||
OnItemAdded: function ftl_add(aParentItem, aItem) {
|
||||
onFolderAdded: function ftl_add(aParentItem, aItem) {
|
||||
// Ignore this item if it's not a folder, or we knew about it.
|
||||
if (!(aItem instanceof Ci.nsIMsgFolder) ||
|
||||
this.getIndexOfFolder(aItem) != null)
|
||||
if (this.getIndexOfFolder(aItem) != null)
|
||||
return;
|
||||
|
||||
// If no parent, this is an account, so let's rebuild.
|
||||
|
@ -1406,6 +1405,7 @@ let gFolderTreeView = {
|
|||
this._modes[this._mode].onFolderAdded(
|
||||
aParentItem.QueryInterface(Ci.nsIMsgFolder), aItem);
|
||||
},
|
||||
onMessageAdded: function(parentFolder, msg) {},
|
||||
|
||||
addFolder: function ftl_add_folder(aParentItem, aItem) {
|
||||
// This intentionally adds any new folder even if it would not pass the
|
||||
|
@ -1452,10 +1452,7 @@ let gFolderTreeView = {
|
|||
this._addChildToView(parent, parentIndex, newChild);
|
||||
},
|
||||
|
||||
OnItemRemoved: function ftl_remove(aRDFParentItem, aItem) {
|
||||
if (!(aItem instanceof Ci.nsIMsgFolder))
|
||||
return;
|
||||
|
||||
onFolderRemoved: function ftl_remove(aRDFParentItem, aItem) {
|
||||
this._persistItemClosed(aItem.URI);
|
||||
|
||||
let index = this.getIndexOfFolder(aItem);
|
||||
|
@ -1476,8 +1473,10 @@ let gFolderTreeView = {
|
|||
this._tree.invalidateRow(index);
|
||||
},
|
||||
|
||||
OnItemPropertyChanged: function(aItem, aProperty, aOld, aNew) {},
|
||||
OnItemIntPropertyChanged: function(aItem, aProperty, aOld, aNew) {
|
||||
onMessageRemoved: function(parentFolder, msg) {},
|
||||
|
||||
onFolderPropertyChanged: function(aItem, aProperty, aOld, aNew) {},
|
||||
onFolderIntPropertyChanged: function(aItem, aProperty, aOld, aNew) {
|
||||
// First try mode specific handling of the changed property.
|
||||
if (this._modes[this.mode].handleChangedIntProperty(aItem, aProperty, aOld,
|
||||
aNew))
|
||||
|
@ -1499,14 +1498,14 @@ let gFolderTreeView = {
|
|||
}
|
||||
},
|
||||
|
||||
OnItemBoolPropertyChanged: function(aItem, aProperty, aOld, aNew) {
|
||||
onFolderBoolPropertyChanged: function(aItem, aProperty, aOld, aNew) {
|
||||
let index = this.getIndexOfFolder(aItem);
|
||||
if (index != null)
|
||||
this._tree.invalidateRow(index);
|
||||
},
|
||||
OnItemUnicharPropertyChanged: function(aItem, aProperty, aOld, aNew) {},
|
||||
OnItemPropertyFlagChanged: function(aItem, aProperty, aOld, aNew) {},
|
||||
OnItemEvent: function(aFolder, aEvent) {
|
||||
onFolderUnicharPropertyChanged: function(aItem, aProperty, aOld, aNew) {},
|
||||
onFolderPropertyFlagChanged: function(aItem, aProperty, aOld, aNew) {},
|
||||
onFolderEvent: function(aFolder, aEvent) {
|
||||
let index = this.getIndexOfFolder(aFolder);
|
||||
if (index != null)
|
||||
this._tree.invalidateRow(index);
|
||||
|
|
|
@ -24,31 +24,30 @@ var gNextMessageAfterLoad = null;
|
|||
|
||||
// the folderListener object
|
||||
var folderListener = {
|
||||
OnItemAdded: function(parentItem, item) {},
|
||||
|
||||
OnItemRemoved: function(parentItem, item)
|
||||
onFolderAdded: function(parentFolder, child) {},
|
||||
onMessageAdded: function(parentFolder, msg) {},
|
||||
onFolderRemoved: function(parentFolder, child) {},
|
||||
onMessageRemoved: function(parentFolder, msg)
|
||||
{
|
||||
if (parentItem.URI != gCurrentFolderUri)
|
||||
if (parentFolder.URI != gCurrentFolderUri)
|
||||
return;
|
||||
|
||||
if (item instanceof Ci.nsIMsgDBHdr &&
|
||||
extractMsgKeyFromURI() == item.messageKey)
|
||||
if (extractMsgKeyFromURI() == msg.messageKey)
|
||||
gCurrentMessageIsDeleted = true;
|
||||
},
|
||||
|
||||
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) {
|
||||
onFolderPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
onFolderIntPropertyChanged: function(item, property, oldValue, newValue) {
|
||||
if (item.URI == gCurrentFolderUri) {
|
||||
if (property == "TotalMessages" || property == "TotalUnreadMessages") {
|
||||
UpdateStandAloneMessageCounts();
|
||||
}
|
||||
}
|
||||
},
|
||||
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){},
|
||||
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
|
||||
onFolderBoolPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
onFolderUnicharPropertyChanged: function(item, property, oldValue, newValue){},
|
||||
onFolderPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
|
||||
|
||||
OnItemEvent: function(folder, event) {
|
||||
onFolderEvent: function(folder, event) {
|
||||
if (event == "DeleteOrMoveMsgCompleted")
|
||||
HandleDeleteOrMoveMsgCompleted(folder);
|
||||
else if (event == "DeleteOrMoveMsgFailed")
|
||||
|
|
|
@ -113,15 +113,17 @@ function ScrollToMessageAfterFolderLoad(folder)
|
|||
// the folderListener object
|
||||
var folderListener =
|
||||
{
|
||||
OnItemAdded: function(parentItem, item) {},
|
||||
OnItemRemoved: function(parentItem, item) {},
|
||||
onFolderAdded: function(parentFolder, child) {},
|
||||
onMessageAdded: function(parentFolder, msg) {},
|
||||
onFolderRemoved: function(parentFolder, child) {},
|
||||
onMessageRemoved: function(parentFolder, msg) {},
|
||||
|
||||
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
|
||||
onFolderPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
onFolderBoolPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
onFolderUnicharPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
onFolderPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
|
||||
|
||||
OnItemIntPropertyChanged: function(item, property, oldValue, newValue)
|
||||
onFolderIntPropertyChanged: function(item, property, oldValue, newValue)
|
||||
{
|
||||
// handle the currently visible folder
|
||||
if (item == gMsgFolderSelected)
|
||||
|
@ -151,7 +153,7 @@ var folderListener =
|
|||
}
|
||||
},
|
||||
|
||||
OnItemEvent: function(folder, event) {
|
||||
onFolderEvent: function(folder, event) {
|
||||
if (event == "FolderLoaded") {
|
||||
if (folder) {
|
||||
var scrolled = false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче