mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 226270 Rationalization of folder listeners, part 2 r=bienvenu sr=mscott
This commit is contained in:
parent
804877d1af
commit
b76499f933
@ -52,23 +52,9 @@ var folderListener = {
|
||||
|
||||
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) {
|
||||
var currentLoadedFolder = GetLoadedMsgFolder();
|
||||
if (!currentLoadedFolder) return;
|
||||
var currentURI = currentLoadedFolder.URI;
|
||||
|
||||
//if we don't have a folder loaded, don't bother.
|
||||
if (currentURI) {
|
||||
if (item.Value == gCurrentFolderUri) {
|
||||
if (property.toString() == "TotalMessages" || property.toString() == "TotalUnreadMessages") {
|
||||
var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
if (folder) {
|
||||
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if (folderResource) {
|
||||
var folderURI = folderResource.Value;
|
||||
if (currentURI == folderURI) {
|
||||
UpdateStandAloneMessageCounts();
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateStandAloneMessageCounts();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -105,23 +105,9 @@ var folderListener = {
|
||||
OnItemPropertyChanged: function(item, property, oldValue, newValue) { },
|
||||
|
||||
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) {
|
||||
var currentLoadedFolder = GetThreadPaneFolder();
|
||||
if (!currentLoadedFolder) return;
|
||||
var currentURI = currentLoadedFolder.URI;
|
||||
|
||||
//if we don't have a folder loaded, don't bother.
|
||||
if(currentURI) {
|
||||
if (item == msgWindow.openFolder) {
|
||||
if(property.toString() == "TotalMessages" || property.toString() == "TotalUnreadMessages") {
|
||||
var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
if(folder) {
|
||||
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if(folderResource) {
|
||||
var folderURI = folderResource.Value;
|
||||
if(currentURI == folderURI) {
|
||||
UpdateStatusMessageCounts(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateStatusMessageCounts(msgWindow.openFolder);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -54,25 +54,25 @@ interface nsIFolderListener : nsISupports {
|
||||
in nsISupports item);
|
||||
|
||||
const folderListenerNotifyFlagValue propertyChanged = 0x4;
|
||||
void OnItemPropertyChanged(in nsISupports item,
|
||||
void OnItemPropertyChanged(in nsIRDFResource item,
|
||||
in nsIAtom property,
|
||||
in string oldValue,
|
||||
in string newValue);
|
||||
|
||||
const folderListenerNotifyFlagValue intPropertyChanged = 0x8;
|
||||
void OnItemIntPropertyChanged(in nsISupports item,
|
||||
void OnItemIntPropertyChanged(in nsIRDFResource item,
|
||||
in nsIAtom property,
|
||||
in long oldValue,
|
||||
in long newValue);
|
||||
|
||||
const folderListenerNotifyFlagValue boolPropertyChanged = 0x10;
|
||||
void OnItemBoolPropertyChanged(in nsISupports item,
|
||||
void OnItemBoolPropertyChanged(in nsIRDFResource item,
|
||||
in nsIAtom property,
|
||||
in boolean oldValue,
|
||||
in boolean newValue);
|
||||
|
||||
const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20;
|
||||
void OnItemUnicharPropertyChanged(in nsISupports item,
|
||||
void OnItemUnicharPropertyChanged(in nsIRDFResource item,
|
||||
in nsIAtom property,
|
||||
in wstring oldValue,
|
||||
in wstring newValue);
|
||||
|
@ -71,23 +71,9 @@ var folderListener = {
|
||||
|
||||
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
|
||||
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) {
|
||||
var currentLoadedFolder = GetLoadedMsgFolder();
|
||||
if (!currentLoadedFolder) return;
|
||||
var currentURI = currentLoadedFolder.URI;
|
||||
|
||||
//if we don't have a folder loaded, don't bother.
|
||||
if (currentURI) {
|
||||
if (item.Value == gCurrentFolderUri) {
|
||||
if (property.toString() == "TotalMessages" || property.toString() == "TotalUnreadMessages") {
|
||||
var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
if (folder) {
|
||||
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if (folderResource) {
|
||||
var folderURI = folderResource.Value;
|
||||
if (currentURI == folderURI) {
|
||||
UpdateStandAloneMessageCounts();
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateStandAloneMessageCounts();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -116,23 +116,9 @@ var folderListener = {
|
||||
OnItemPropertyChanged: function(item, property, oldValue, newValue) { },
|
||||
|
||||
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) {
|
||||
var currentLoadedFolder = GetThreadPaneFolder();
|
||||
if (!currentLoadedFolder) return;
|
||||
var currentURI = currentLoadedFolder.URI;
|
||||
|
||||
//if we don't have a folder loaded, don't bother.
|
||||
if(currentURI) {
|
||||
if (item == msgWindow.openFolder) {
|
||||
if(property.toString() == "TotalMessages" || property.toString() == "TotalUnreadMessages") {
|
||||
var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
if(folder) {
|
||||
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if(folderResource) {
|
||||
var folderURI = folderResource.Value;
|
||||
if(currentURI == folderURI) {
|
||||
UpdateStatusMessageCounts(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateStatusMessageCounts(msgWindow.openFolder);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -766,7 +766,7 @@ nsMsgSearchSession::OnItemRemoved(nsIRDFResource *parentItem,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::OnItemPropertyChanged(nsISupports *item,
|
||||
nsMsgSearchSession::OnItemPropertyChanged(nsIRDFResource *item,
|
||||
nsIAtom *property,
|
||||
const char* oldValue,
|
||||
const char* newValue)
|
||||
@ -776,7 +776,7 @@ nsMsgSearchSession::OnItemPropertyChanged(nsISupports *item,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::OnItemIntPropertyChanged(nsISupports *item,
|
||||
nsMsgSearchSession::OnItemIntPropertyChanged(nsIRDFResource *item,
|
||||
nsIAtom *property,
|
||||
PRInt32 oldValue,
|
||||
PRInt32 newValue)
|
||||
@ -785,7 +785,7 @@ nsMsgSearchSession::OnItemIntPropertyChanged(nsISupports *item,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::OnItemBoolPropertyChanged(nsISupports *item,
|
||||
nsMsgSearchSession::OnItemBoolPropertyChanged(nsIRDFResource *item,
|
||||
nsIAtom *property,
|
||||
PRBool oldValue,
|
||||
PRBool newValue)
|
||||
@ -794,7 +794,7 @@ nsMsgSearchSession::OnItemBoolPropertyChanged(nsISupports *item,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::OnItemUnicharPropertyChanged(nsISupports *item,
|
||||
nsMsgSearchSession::OnItemUnicharPropertyChanged(nsIRDFResource *item,
|
||||
nsIAtom *property,
|
||||
const PRUnichar* oldValue,
|
||||
const PRUnichar* newValue)
|
||||
|
@ -107,13 +107,13 @@ nsMessengerOS2Integration::Init()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessengerOS2Integration::OnItemPropertyChanged(nsISupports *, nsIAtom *, char const *, char const *)
|
||||
nsMessengerOS2Integration::OnItemPropertyChanged(nsIRDFResource *, nsIAtom *, char const *, char const *)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessengerOS2Integration::OnItemUnicharPropertyChanged(nsISupports *, nsIAtom *, const PRUnichar *, const PRUnichar *)
|
||||
nsMessengerOS2Integration::OnItemUnicharPropertyChanged(nsIRDFResource *, nsIAtom *, const PRUnichar *, const PRUnichar *)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -154,7 +154,7 @@ nsMessengerOS2Integration::OnItemAdded(nsIRDFResource *, nsISupports *)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessengerOS2Integration::OnItemBoolPropertyChanged(nsISupports *aItem,
|
||||
nsMessengerOS2Integration::OnItemBoolPropertyChanged(nsIRDFResource *aItem,
|
||||
nsIAtom *aProperty,
|
||||
PRBool aOldValue,
|
||||
PRBool aNewValue)
|
||||
@ -169,7 +169,7 @@ nsMessengerOS2Integration::OnItemEvent(nsIMsgFolder *, nsIAtom *)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessengerOS2Integration::OnItemIntPropertyChanged(nsISupports *aItem, nsIAtom *aProperty, PRInt32 aOldValue, PRInt32 aNewValue)
|
||||
nsMessengerOS2Integration::OnItemIntPropertyChanged(nsIRDFResource *aItem, nsIAtom *aProperty, PRInt32 aOldValue, PRInt32 aNewValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -472,13 +472,13 @@ nsMessengerWinIntegration::Init()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessengerWinIntegration::OnItemPropertyChanged(nsISupports *, nsIAtom *, char const *, char const *)
|
||||
nsMessengerWinIntegration::OnItemPropertyChanged(nsIRDFResource *, nsIAtom *, char const *, char const *)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessengerWinIntegration::OnItemUnicharPropertyChanged(nsISupports *, nsIAtom *, const PRUnichar *, const PRUnichar *)
|
||||
nsMessengerWinIntegration::OnItemUnicharPropertyChanged(nsIRDFResource *, nsIAtom *, const PRUnichar *, const PRUnichar *)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -849,7 +849,7 @@ nsMessengerWinIntegration::OnItemAdded(nsIRDFResource *, nsISupports *)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessengerWinIntegration::OnItemBoolPropertyChanged(nsISupports *aItem,
|
||||
nsMessengerWinIntegration::OnItemBoolPropertyChanged(nsIRDFResource *aItem,
|
||||
nsIAtom *aProperty,
|
||||
PRBool aOldValue,
|
||||
PRBool aNewValue)
|
||||
@ -885,18 +885,15 @@ nsMessengerWinIntegration::OnItemEvent(nsIMsgFolder *, nsIAtom *)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessengerWinIntegration::OnItemIntPropertyChanged(nsISupports *aItem, nsIAtom *aProperty, PRInt32 aOldValue, PRInt32 aNewValue)
|
||||
nsMessengerWinIntegration::OnItemIntPropertyChanged(nsIRDFResource *aItem, nsIAtom *aProperty, PRInt32 aOldValue, PRInt32 aNewValue)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (!mStoreUnreadCounts) return NS_OK; // don't do anything here if we aren't storing unread counts...
|
||||
|
||||
if (aProperty == mTotalUnreadMessagesAtom) {
|
||||
nsCOMPtr <nsIRDFResource> folderResource = do_QueryInterface(aItem, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
const char *itemURI = nsnull;
|
||||
rv = folderResource->GetValueConst(&itemURI);
|
||||
rv = aItem->GetValueConst(&itemURI);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// Today, if the user brings up the mail app and gets his/her mail and read
|
||||
|
@ -1203,16 +1203,9 @@ nsMsgAccountManagerDataSource::isContainment(nsIRDFResource *aProperty)
|
||||
nsresult
|
||||
nsMsgAccountManagerDataSource::getServerForFolderNode(nsIRDFNode *aResource,
|
||||
nsIMsgIncomingServer **aResult)
|
||||
{
|
||||
return getServerForObject(aResource, aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgAccountManagerDataSource::getServerForObject(nsISupports *aObject,
|
||||
nsIMsgIncomingServer **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(aObject, &rv);
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(aResource, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool isServer;
|
||||
rv = folder->GetIsServer(&isServer);
|
||||
@ -1317,13 +1310,13 @@ nsMsgAccountManagerDataSource::OnServerChanged(nsIMsgIncomingServer *server)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgAccountManagerDataSource::OnItemPropertyChanged(nsISupports *, nsIAtom *, char const *, char const *)
|
||||
nsMsgAccountManagerDataSource::OnItemPropertyChanged(nsIRDFResource *, nsIAtom *, char const *, char const *)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgAccountManagerDataSource::OnItemUnicharPropertyChanged(nsISupports *, nsIAtom *, const PRUnichar *, const PRUnichar *)
|
||||
nsMsgAccountManagerDataSource::OnItemUnicharPropertyChanged(nsIRDFResource *, nsIAtom *, const PRUnichar *, const PRUnichar *)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1348,30 +1341,13 @@ nsMsgAccountManagerDataSource::OnItemAdded(nsIRDFResource *, nsISupports *)
|
||||
|
||||
|
||||
nsresult
|
||||
nsMsgAccountManagerDataSource::OnItemBoolPropertyChanged(nsISupports *aItem,
|
||||
nsMsgAccountManagerDataSource::OnItemBoolPropertyChanged(nsIRDFResource *aItem,
|
||||
nsIAtom *aProperty,
|
||||
PRBool aOldValue,
|
||||
PRBool aNewValue)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// server properties
|
||||
// check property first because that's fast
|
||||
if (aProperty == kDefaultServerAtom) {
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = getServerForObject(aItem, getter_AddRefs(server));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
// tricky - turn aItem into a resource -
|
||||
// aItem should be an nsIMsgFolder
|
||||
nsCOMPtr<nsIRDFResource> serverResource = do_QueryInterface(aItem, &rv);
|
||||
if (NS_FAILED(rv)) return NS_OK;
|
||||
|
||||
NotifyObservers(serverResource, kNC_IsDefaultServer, kTrueLiteral, aNewValue, PR_FALSE);
|
||||
|
||||
}
|
||||
if (aProperty == kDefaultServerAtom)
|
||||
NotifyObservers(aItem, kNC_IsDefaultServer, kTrueLiteral, aNewValue, PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1382,7 +1358,7 @@ nsMsgAccountManagerDataSource::OnItemEvent(nsIMsgFolder *, nsIAtom *)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgAccountManagerDataSource::OnItemIntPropertyChanged(nsISupports *, nsIAtom *, PRInt32, PRInt32)
|
||||
nsMsgAccountManagerDataSource::OnItemIntPropertyChanged(nsIRDFResource *, nsIAtom *, PRInt32, PRInt32)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -114,8 +114,6 @@ protected:
|
||||
static PRBool isContainment(nsIRDFResource *aProperty);
|
||||
nsresult getServerForFolderNode(nsIRDFNode *aResource,
|
||||
nsIMsgIncomingServer **aResult);
|
||||
nsresult getServerForObject(nsISupports *aObject,
|
||||
nsIMsgIncomingServer **aResult);
|
||||
|
||||
nsresult createRootResources(nsIRDFResource *aProperty,
|
||||
nsISupportsArray* aNodeArray);
|
||||
|
@ -838,7 +838,7 @@ nsresult nsMsgFolderDataSource::OnItemAddedOrRemoved(nsIRDFResource *parentItem,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolderDataSource::OnItemPropertyChanged(nsISupports *item,
|
||||
nsMsgFolderDataSource::OnItemPropertyChanged(nsIRDFResource *resource,
|
||||
nsIAtom *property,
|
||||
const char *oldValue,
|
||||
const char *newValue)
|
||||
@ -848,63 +848,45 @@ nsMsgFolderDataSource::OnItemPropertyChanged(nsISupports *item,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolderDataSource::OnItemIntPropertyChanged(nsISupports *item,
|
||||
nsMsgFolderDataSource::OnItemIntPropertyChanged(nsIRDFResource *resource,
|
||||
nsIAtom *property,
|
||||
PRInt32 oldValue,
|
||||
PRInt32 newValue)
|
||||
{
|
||||
//We only care about folder changes
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(item);
|
||||
if(folder)
|
||||
{
|
||||
if (kTotalMessagesAtom == property)
|
||||
OnTotalMessagePropertyChanged(folder, oldValue, newValue);
|
||||
else if (kTotalUnreadMessagesAtom == property)
|
||||
OnUnreadMessagePropertyChanged(folder, oldValue, newValue);
|
||||
else if (kFolderSizeAtom == property)
|
||||
OnFolderSizePropertyChanged(folder, oldValue, newValue);
|
||||
}
|
||||
return NS_OK;
|
||||
if (kTotalMessagesAtom == property)
|
||||
OnTotalMessagePropertyChanged(resource, oldValue, newValue);
|
||||
else if (kTotalUnreadMessagesAtom == property)
|
||||
OnUnreadMessagePropertyChanged(resource, oldValue, newValue);
|
||||
else if (kFolderSizeAtom == property)
|
||||
OnFolderSizePropertyChanged(resource, oldValue, newValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolderDataSource::OnItemUnicharPropertyChanged(nsISupports *item,
|
||||
nsMsgFolderDataSource::OnItemUnicharPropertyChanged(nsIRDFResource *resource,
|
||||
nsIAtom *property,
|
||||
const PRUnichar *oldValue,
|
||||
const PRUnichar *newValue)
|
||||
{
|
||||
nsresult rv=NS_OK;
|
||||
|
||||
if (kNameAtom == property) {
|
||||
nsCOMPtr<nsIRDFResource> resource = do_QueryInterface(item, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(item, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 numUnread;
|
||||
folder->GetNumUnread(PR_FALSE, &numUnread);
|
||||
NotifyFolderTreeNameChanged(folder, numUnread);
|
||||
NotifyFolderTreeSimpleNameChanged(folder);
|
||||
NotifyFolderNameChanged(folder);
|
||||
}
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(resource));
|
||||
if (folder) {
|
||||
PRInt32 numUnread;
|
||||
folder->GetNumUnread(PR_FALSE, &numUnread);
|
||||
NotifyFolderTreeNameChanged(folder, resource, numUnread);
|
||||
NotifyFolderTreeSimpleNameChanged(folder, resource);
|
||||
NotifyFolderNameChanged(folder, resource);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolderDataSource::OnItemBoolPropertyChanged(nsISupports *item,
|
||||
nsMsgFolderDataSource::OnItemBoolPropertyChanged(nsIRDFResource *resource,
|
||||
nsIAtom *property,
|
||||
PRBool oldValue,
|
||||
PRBool newValue)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(item));
|
||||
if (!folder) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource(do_QueryInterface(item));
|
||||
if (!item) return rv;
|
||||
|
||||
if (newValue != oldValue) {
|
||||
nsIRDFNode* literalNode = newValue?kTrueLiteral:kFalseLiteral;
|
||||
if (kNewMessagesAtom == property) {
|
||||
@ -918,7 +900,7 @@ nsMsgFolderDataSource::OnItemBoolPropertyChanged(nsISupports *item,
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1679,10 +1661,10 @@ nsMsgFolderDataSource::createHasUnreadMessagesNode(nsIMsgFolder *folder, PRBool
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::OnUnreadMessagePropertyChanged(nsIMsgFolder *folder, PRInt32 oldValue, PRInt32 newValue)
|
||||
nsMsgFolderDataSource::OnUnreadMessagePropertyChanged(nsIRDFResource *folderResource, PRInt32 oldValue, PRInt32 newValue)
|
||||
{
|
||||
nsCOMPtr<nsIRDFResource> folderResource = do_QueryInterface(folder);
|
||||
if(folderResource)
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(folderResource);
|
||||
if(folder)
|
||||
{
|
||||
//First send a regular unread message changed notification
|
||||
nsCOMPtr<nsIRDFNode> newNode;
|
||||
@ -1703,13 +1685,13 @@ nsMsgFolderDataSource::OnUnreadMessagePropertyChanged(nsIMsgFolder *folder, PRIn
|
||||
}
|
||||
|
||||
//We will have to change the folderTreeName if the unread column is hidden
|
||||
NotifyFolderTreeNameChanged(folder, newValue);
|
||||
NotifyFolderTreeNameChanged(folder, folderResource, newValue);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::NotifyFolderNameChanged(nsIMsgFolder* aFolder)
|
||||
nsMsgFolderDataSource::NotifyFolderNameChanged(nsIMsgFolder* aFolder, nsIRDFResource *folderResource)
|
||||
{
|
||||
nsXPIDLString name;
|
||||
nsresult rv = aFolder->GetName(getter_Copies(name));
|
||||
@ -1717,21 +1699,19 @@ nsMsgFolderDataSource::NotifyFolderNameChanged(nsIMsgFolder* aFolder)
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIRDFNode> newNameNode;
|
||||
createNode(name.get(), getter_AddRefs(newNameNode), getRDFService());
|
||||
nsCOMPtr<nsIRDFResource> folderResource = do_QueryInterface(aFolder);
|
||||
NotifyPropertyChanged(folderResource, kNC_Name, newNameNode);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::NotifyFolderTreeSimpleNameChanged(nsIMsgFolder* aFolder)
|
||||
nsMsgFolderDataSource::NotifyFolderTreeSimpleNameChanged(nsIMsgFolder* aFolder, nsIRDFResource *folderResource)
|
||||
{
|
||||
nsXPIDLString abbreviatedName;
|
||||
nsresult rv = aFolder->GetAbbreviatedName(getter_Copies(abbreviatedName));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIRDFNode> newNameNode;
|
||||
createNode(abbreviatedName.get(), getter_AddRefs(newNameNode), getRDFService());
|
||||
nsCOMPtr<nsIRDFResource> folderResource = do_QueryInterface(aFolder);
|
||||
NotifyPropertyChanged(folderResource, kNC_FolderTreeSimpleName, newNameNode);
|
||||
}
|
||||
|
||||
@ -1740,6 +1720,7 @@ nsMsgFolderDataSource::NotifyFolderTreeSimpleNameChanged(nsIMsgFolder* aFolder)
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::NotifyFolderTreeNameChanged(nsIMsgFolder* aFolder,
|
||||
nsIRDFResource* aFolderResource,
|
||||
PRInt32 aUnreadMessages)
|
||||
{
|
||||
nsXPIDLString name;
|
||||
@ -1751,9 +1732,7 @@ nsMsgFolderDataSource::NotifyFolderTreeNameChanged(nsIMsgFolder* aFolder,
|
||||
|
||||
nsCOMPtr<nsIRDFNode> newNameNode;
|
||||
createNode(newNameString.get(), getter_AddRefs(newNameNode), getRDFService());
|
||||
nsCOMPtr<nsIRDFResource> folderResource =
|
||||
do_QueryInterface(aFolder);
|
||||
NotifyPropertyChanged(folderResource, kNC_FolderTreeName, newNameNode);
|
||||
NotifyPropertyChanged(aFolderResource, kNC_FolderTreeName, newNameNode);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1857,32 +1836,21 @@ nsMsgFolderDataSource::OnUnreadMessagePropertyChanged(nsIMsgFolder *folder, PRIn
|
||||
**/
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::OnFolderSizePropertyChanged(nsIMsgFolder *folder, PRInt32 oldValue, PRInt32 newValue)
|
||||
nsMsgFolderDataSource::OnFolderSizePropertyChanged(nsIRDFResource *folderResource, PRInt32 oldValue, PRInt32 newValue)
|
||||
{
|
||||
nsCOMPtr<nsIRDFResource> folderResource = do_QueryInterface(folder);
|
||||
if(folderResource)
|
||||
{
|
||||
nsCOMPtr<nsIRDFNode> newNode;
|
||||
|
||||
GetFolderSizeNode(newValue, getter_AddRefs(newNode));
|
||||
NotifyPropertyChanged(folderResource, kNC_FolderSize, newNode);
|
||||
}
|
||||
nsCOMPtr<nsIRDFNode> newNode;
|
||||
GetFolderSizeNode(newValue, getter_AddRefs(newNode));
|
||||
NotifyPropertyChanged(folderResource, kNC_FolderSize, newNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::OnTotalMessagePropertyChanged(nsIMsgFolder *folder, PRInt32 oldValue, PRInt32 newValue)
|
||||
nsMsgFolderDataSource::OnTotalMessagePropertyChanged(nsIRDFResource *folderResource, PRInt32 oldValue, PRInt32 newValue)
|
||||
{
|
||||
nsCOMPtr<nsIRDFResource> folderResource = do_QueryInterface(folder);
|
||||
if(folderResource)
|
||||
{
|
||||
//First send a regular unread message changed notification
|
||||
nsCOMPtr<nsIRDFNode> newNode;
|
||||
|
||||
GetNumMessagesNode(newValue, getter_AddRefs(newNode));
|
||||
NotifyPropertyChanged(folderResource, kNC_TotalMessages, newNode);
|
||||
}
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIRDFNode> newNode;
|
||||
GetNumMessagesNode(newValue, getter_AddRefs(newNode));
|
||||
NotifyPropertyChanged(folderResource, kNC_TotalMessages, newNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -198,12 +198,12 @@ protected:
|
||||
|
||||
nsresult OnItemAddedOrRemoved(nsIRDFResource *parentItem, nsISupports *item, PRBool added);
|
||||
|
||||
nsresult OnUnreadMessagePropertyChanged(nsIMsgFolder *folder, PRInt32 oldValue, PRInt32 newValue);
|
||||
nsresult OnTotalMessagePropertyChanged(nsIMsgFolder *folder, PRInt32 oldValue, PRInt32 newValue);
|
||||
nsresult OnFolderSizePropertyChanged(nsIMsgFolder *folder, PRInt32 oldValue, PRInt32 newValue);
|
||||
nsresult NotifyFolderTreeNameChanged(nsIMsgFolder *folder, PRInt32 aUnreadMessages);
|
||||
nsresult NotifyFolderTreeSimpleNameChanged(nsIMsgFolder *folder);
|
||||
nsresult NotifyFolderNameChanged(nsIMsgFolder *folder);
|
||||
nsresult OnUnreadMessagePropertyChanged(nsIRDFResource *folderResource, PRInt32 oldValue, PRInt32 newValue);
|
||||
nsresult OnTotalMessagePropertyChanged(nsIRDFResource *folderResource, PRInt32 oldValue, PRInt32 newValue);
|
||||
nsresult OnFolderSizePropertyChanged(nsIRDFResource *folderResource, PRInt32 oldValue, PRInt32 newValue);
|
||||
nsresult NotifyFolderTreeNameChanged(nsIMsgFolder *folder, nsIRDFResource *folderResource, PRInt32 aUnreadMessages);
|
||||
nsresult NotifyFolderTreeSimpleNameChanged(nsIMsgFolder *folder, nsIRDFResource *folderResource);
|
||||
nsresult NotifyFolderNameChanged(nsIMsgFolder *folder, nsIRDFResource *folderResource);
|
||||
nsresult NotifyAncestors(nsIMsgFolder *aFolder, nsIRDFResource *aPropertyResource, nsIRDFNode *aNode);
|
||||
nsresult GetNumMessagesNode(PRInt32 numMessages, nsIRDFNode **node);
|
||||
nsresult GetFolderSizeNode(PRInt32 folderSize, nsIRDFNode **node);
|
||||
|
@ -106,7 +106,7 @@ NS_IMETHODIMP nsMsgMailSession::RemoveFolderListener(nsIFolderListener * listene
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailSession::OnItemPropertyChanged(nsISupports *item,
|
||||
nsMsgMailSession::OnItemPropertyChanged(nsIRDFResource *item,
|
||||
nsIAtom *property,
|
||||
const char* oldValue,
|
||||
const char* newValue)
|
||||
@ -128,7 +128,7 @@ nsMsgMailSession::OnItemPropertyChanged(nsISupports *item,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailSession::OnItemUnicharPropertyChanged(nsISupports *item,
|
||||
nsMsgMailSession::OnItemUnicharPropertyChanged(nsIRDFResource *item,
|
||||
nsIAtom *property,
|
||||
const PRUnichar* oldValue,
|
||||
const PRUnichar* newValue)
|
||||
@ -150,7 +150,7 @@ nsMsgMailSession::OnItemUnicharPropertyChanged(nsISupports *item,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailSession::OnItemIntPropertyChanged(nsISupports *item,
|
||||
nsMsgMailSession::OnItemIntPropertyChanged(nsIRDFResource *item,
|
||||
nsIAtom *property,
|
||||
PRInt32 oldValue,
|
||||
PRInt32 newValue)
|
||||
@ -172,7 +172,7 @@ nsMsgMailSession::OnItemIntPropertyChanged(nsISupports *item,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailSession::OnItemBoolPropertyChanged(nsISupports *item,
|
||||
nsMsgMailSession::OnItemBoolPropertyChanged(nsIRDFResource *item,
|
||||
nsIAtom *property,
|
||||
PRBool oldValue,
|
||||
PRBool newValue)
|
||||
|
@ -236,25 +236,25 @@ nsStatusBarBiffManager::OnItemRemoved(nsIRDFResource *parentItem, nsISupports *i
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusBarBiffManager::OnItemPropertyChanged(nsISupports *item, nsIAtom *property, const char *oldValue, const char *newValue)
|
||||
nsStatusBarBiffManager::OnItemPropertyChanged(nsIRDFResource *item, nsIAtom *property, const char *oldValue, const char *newValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusBarBiffManager::OnItemIntPropertyChanged(nsISupports *item, nsIAtom *property, PRInt32 oldValue, PRInt32 newValue)
|
||||
nsStatusBarBiffManager::OnItemIntPropertyChanged(nsIRDFResource *item, nsIAtom *property, PRInt32 oldValue, PRInt32 newValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusBarBiffManager::OnItemBoolPropertyChanged(nsISupports *item, nsIAtom *property, PRBool oldValue, PRBool newValue)
|
||||
nsStatusBarBiffManager::OnItemBoolPropertyChanged(nsIRDFResource *item, nsIAtom *property, PRBool oldValue, PRBool newValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusBarBiffManager::OnItemUnicharPropertyChanged(nsISupports *item, nsIAtom *property, const PRUnichar *oldValue, const PRUnichar *newValue)
|
||||
nsStatusBarBiffManager::OnItemUnicharPropertyChanged(nsIRDFResource *item, nsIAtom *property, const PRUnichar *oldValue, const PRUnichar *newValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3915,7 +3915,7 @@ nsMsgDBFolder::NotifyPropertyChanged(nsIAtom *property,
|
||||
{
|
||||
//Folderlisteners aren't refcounted.
|
||||
nsIFolderListener* listener =(nsIFolderListener*)mListeners.ElementAt(i);
|
||||
listener->OnItemPropertyChanged((nsIRDFResource *)this, property, oldValue, newValue);
|
||||
listener->OnItemPropertyChanged(this, property, oldValue, newValue);
|
||||
}
|
||||
|
||||
//Notify listeners who listen to every folder
|
||||
@ -3923,7 +3923,7 @@ nsMsgDBFolder::NotifyPropertyChanged(nsIAtom *property,
|
||||
nsCOMPtr<nsIFolderListener> folderListenerManager =
|
||||
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
folderListenerManager->OnItemPropertyChanged((nsIRDFResource *)this, property, oldValue, newValue);
|
||||
folderListenerManager->OnItemPropertyChanged(this, property, oldValue, newValue);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@ -3940,14 +3940,14 @@ nsMsgDBFolder::NotifyUnicharPropertyChanged(nsIAtom *property,
|
||||
{
|
||||
// folderlisteners aren't refcounted in the array
|
||||
nsIFolderListener* listener=(nsIFolderListener*)mListeners.ElementAt(i);
|
||||
listener->OnItemUnicharPropertyChanged((nsIRDFResource *)this, property, oldValue, newValue);
|
||||
listener->OnItemUnicharPropertyChanged(this, property, oldValue, newValue);
|
||||
}
|
||||
|
||||
// Notify listeners who listen to every folder
|
||||
nsCOMPtr<nsIFolderListener> folderListenerManager =
|
||||
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = folderListenerManager->OnItemUnicharPropertyChanged((nsIRDFResource *)this,
|
||||
rv = folderListenerManager->OnItemUnicharPropertyChanged(this,
|
||||
property,
|
||||
oldValue,
|
||||
newValue);
|
||||
@ -3964,7 +3964,7 @@ nsresult nsMsgDBFolder::NotifyIntPropertyChanged(nsIAtom *property, PRInt32 oldV
|
||||
{
|
||||
//Folderlisteners aren't refcounted.
|
||||
nsIFolderListener* listener =(nsIFolderListener*)mListeners.ElementAt(i);
|
||||
listener->OnItemIntPropertyChanged((nsIRDFResource *)this, property, oldValue, newValue);
|
||||
listener->OnItemIntPropertyChanged(this, property, oldValue, newValue);
|
||||
}
|
||||
|
||||
//Notify listeners who listen to every folder
|
||||
@ -3972,7 +3972,7 @@ nsresult nsMsgDBFolder::NotifyIntPropertyChanged(nsIAtom *property, PRInt32 oldV
|
||||
nsCOMPtr<nsIFolderListener> folderListenerManager =
|
||||
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
folderListenerManager->OnItemIntPropertyChanged((nsIRDFResource *)this, property, oldValue, newValue);
|
||||
folderListenerManager->OnItemIntPropertyChanged(this, property, oldValue, newValue);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@ -3986,7 +3986,7 @@ nsMsgDBFolder::NotifyBoolPropertyChanged(nsIAtom* property,
|
||||
{
|
||||
//Folderlisteners aren't refcounted.
|
||||
nsIFolderListener* listener =(nsIFolderListener*)mListeners.ElementAt(i);
|
||||
listener->OnItemBoolPropertyChanged((nsIRDFResource *)this, property, oldValue, newValue);
|
||||
listener->OnItemBoolPropertyChanged(this, property, oldValue, newValue);
|
||||
}
|
||||
|
||||
//Notify listeners who listen to every folder
|
||||
@ -3994,7 +3994,7 @@ nsMsgDBFolder::NotifyBoolPropertyChanged(nsIAtom* property,
|
||||
nsCOMPtr<nsIFolderListener> folderListenerManager =
|
||||
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
folderListenerManager->OnItemBoolPropertyChanged((nsIRDFResource *)this, property, oldValue, newValue);
|
||||
folderListenerManager->OnItemBoolPropertyChanged(this, property, oldValue, newValue);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
@ -463,22 +463,22 @@ NS_IMETHODIMP nsLocalUndoFolderListener::OnItemRemoved(nsIRDFResource *parentIte
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemPropertyChanged(nsISupports *item, nsIAtom *property, const char *oldValue, const char *newValue)
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemPropertyChanged(nsIRDFResource *item, nsIAtom *property, const char *oldValue, const char *newValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemIntPropertyChanged(nsISupports *item, nsIAtom *property, PRInt32 oldValue, PRInt32 newValue)
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemIntPropertyChanged(nsIRDFResource *item, nsIAtom *property, PRInt32 oldValue, PRInt32 newValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemBoolPropertyChanged(nsISupports *item, nsIAtom *property, PRBool oldValue, PRBool newValue)
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemBoolPropertyChanged(nsIRDFResource *item, nsIAtom *property, PRBool oldValue, PRBool newValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemUnicharPropertyChanged(nsISupports *item, nsIAtom *property, const PRUnichar *oldValue, const PRUnichar *newValue)
|
||||
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemUnicharPropertyChanged(nsIRDFResource *item, nsIAtom *property, const PRUnichar *oldValue, const PRUnichar *newValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user