зеркало из https://github.com/mozilla/pjs.git
fix for #19254. propagate unread state of subfolders to parents if the parent is closed.
r/sr=bienvenu
This commit is contained in:
Родитель
5a0204a688
Коммит
873429e94e
|
@ -73,6 +73,9 @@
|
|||
<binding subject="?member"
|
||||
predicate="http://home.netscape.com/NC-rdf#HasUnreadMessages"
|
||||
object="?hasUnreadMessages" />
|
||||
<binding subject="?member"
|
||||
predicate="http://home.netscape.com/NC-rdf#SubfoldersHaveUnreadMessages"
|
||||
object="?subfoldersHaveUnreadMessages" />
|
||||
<binding subject="?member"
|
||||
predicate="http://home.netscape.com/NC-rdf#IsSecure"
|
||||
object="?isSecure" />
|
||||
|
@ -100,15 +103,18 @@
|
|||
isServer-?isServer
|
||||
newMessages-?newMessages
|
||||
hasUnreadMessages-?hasUnreadMessages
|
||||
subfoldersHaveUnreadMessages-?subfoldersHaveUnreadMessages
|
||||
isSecure-?isSecure
|
||||
serverType-?serverType
|
||||
noSelect-?noSelect"/>
|
||||
<outlinercell ref="folderUnreadCol"
|
||||
label="?unreadCount"
|
||||
properties="hasUnreadMessages-?hasUnreadMessages"/>
|
||||
properties="hasUnreadMessages-?hasUnreadMessages
|
||||
subfoldersHaveUnreadMessages-?subfoldersHaveUnreadMessages"/>
|
||||
<outlinercell ref="folderTotalCol"
|
||||
label="?totalCount"
|
||||
properties="hasUnreadMessages-?hasUnreadMessages"/>
|
||||
properties="hasUnreadMessages-?hasUnreadMessages
|
||||
subfoldersHaveUnreadMessages-?subfoldersHaveUnreadMessages"/>
|
||||
</outlinerrow>
|
||||
</action>
|
||||
</rule>
|
||||
|
|
|
@ -1021,11 +1021,11 @@ nsresult nsMsgFolderDataSource::createFolderNode(nsIMsgFolder* folder,
|
|||
else if ((kNC_BiffState == property))
|
||||
rv = createBiffStateNodeFromFolder(folder, target);
|
||||
else if ((kNC_HasUnreadMessages == property))
|
||||
rv = createHasUnreadMessagesNode(folder, target);
|
||||
rv = createHasUnreadMessagesNode(folder, PR_FALSE, target);
|
||||
else if ((kNC_NewMessages == property))
|
||||
rv = createNewMessagesNode(folder, target);
|
||||
else if ((kNC_SubfoldersHaveUnreadMessages == property))
|
||||
rv = createSubfoldersHaveUnreadMessagesNode(folder, target);
|
||||
rv = createHasUnreadMessagesNode(folder, PR_TRUE, target);
|
||||
else if ((kNC_Child == property))
|
||||
rv = createFolderChildNode(folder, target);
|
||||
else if ((kNC_NoSelect == property))
|
||||
|
@ -1565,29 +1565,29 @@ nsMsgFolderDataSource::createUnreadMessagesNode(nsIMsgFolder *folder,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::createHasUnreadMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target)
|
||||
nsMsgFolderDataSource::createHasUnreadMessagesNode(nsIMsgFolder *folder, PRBool aIncludeSubfolders, nsIRDFNode **target)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsresult rv;
|
||||
PRBool isServer;
|
||||
rv = folder->GetIsServer(&isServer);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool isServer;
|
||||
rv = folder->GetIsServer(&isServer);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
*target = kFalseLiteral;
|
||||
|
||||
*target = kFalseLiteral;
|
||||
PRInt32 totalUnreadMessages;
|
||||
if(!isServer)
|
||||
{
|
||||
rv = folder->GetNumUnread(aIncludeSubfolders, &totalUnreadMessages);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
if(totalUnreadMessages > 0)
|
||||
*target = kTrueLiteral;
|
||||
else
|
||||
*target = kFalseLiteral;
|
||||
}
|
||||
|
||||
PRInt32 totalUnreadMessages;
|
||||
if(!isServer)
|
||||
{
|
||||
rv = folder->GetNumUnread(PR_FALSE, &totalUnreadMessages);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
if(totalUnreadMessages > 0)
|
||||
*target = kTrueLiteral;
|
||||
else
|
||||
*target = kFalseLiteral;
|
||||
}
|
||||
NS_IF_ADDREF(*target);
|
||||
return NS_OK;
|
||||
NS_IF_ADDREF(*target);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1603,18 +1603,15 @@ nsMsgFolderDataSource::OnUnreadMessagePropertyChanged(nsIMsgFolder *folder, PRIn
|
|||
NotifyPropertyChanged(folderResource, kNC_TotalUnreadMessages, newNode);
|
||||
|
||||
//Now see if hasUnreadMessages has changed
|
||||
nsCOMPtr<nsIRDFNode> oldHasUnreadMessages;
|
||||
nsCOMPtr<nsIRDFNode> newHasUnreadMessages;
|
||||
if(oldValue <=0 && newValue >0)
|
||||
{
|
||||
oldHasUnreadMessages = kFalseLiteral;
|
||||
newHasUnreadMessages = kTrueLiteral;
|
||||
NotifyPropertyChanged(folderResource, kNC_HasUnreadMessages, newHasUnreadMessages);
|
||||
NotifyPropertyChanged(folderResource, kNC_HasUnreadMessages, kTrueLiteral);
|
||||
NotifyAncestors(folder, kNC_SubfoldersHaveUnreadMessages, kTrueLiteral);
|
||||
}
|
||||
else if(oldValue > 0 && newValue <= 0)
|
||||
{
|
||||
newHasUnreadMessages = kFalseLiteral;
|
||||
NotifyPropertyChanged(folderResource, kNC_HasUnreadMessages, newHasUnreadMessages);
|
||||
NotifyPropertyChanged(folderResource, kNC_HasUnreadMessages, kFalseLiteral);
|
||||
NotifyAncestors(folder, kNC_SubfoldersHaveUnreadMessages, kFalseLiteral);
|
||||
}
|
||||
|
||||
//We will have to change the folderTreeName also
|
||||
|
@ -1673,6 +1670,36 @@ nsMsgFolderDataSource::NotifyFolderTreeNameChanged(nsIMsgFolder* aFolder,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::NotifyAncestors(nsIMsgFolder *aFolder, nsIRDFResource *aPropertyResource, nsIRDFNode *aNode)
|
||||
{
|
||||
PRBool isServer = PR_FALSE;
|
||||
nsresult rv = aFolder->GetIsServer(&isServer);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (isServer) {
|
||||
// done, stop
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr <nsIFolder> folder = do_QueryInterface(aFolder, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr <nsIFolder> parentFolder;
|
||||
rv = folder->GetParent(getter_AddRefs(parentFolder));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> parentFolderResource = do_QueryInterface(parentFolder,&rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NotifyPropertyChanged(parentFolderResource, aPropertyResource, aNode);
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> parentMsgFolder = do_QueryInterface(parentFolder, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
return NotifyAncestors(parentMsgFolder, aPropertyResource, aNode);
|
||||
}
|
||||
|
||||
// New Messages
|
||||
|
||||
nsresult
|
||||
|
@ -1762,13 +1789,6 @@ nsMsgFolderDataSource::GetNumMessagesNode(PRInt32 numMessages, nsIRDFNode **node
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::createSubfoldersHaveUnreadMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target)
|
||||
{
|
||||
createNode(NS_LITERAL_STRING("true").get(), target, getRDFService());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::createFolderChildNode(nsIMsgFolder *folder,
|
||||
nsIRDFNode **target)
|
||||
|
|
|
@ -153,18 +153,17 @@ protected:
|
|||
nsIRDFNode **target);
|
||||
nsresult createFolderCanCompactNode(nsIMsgFolder *folder,
|
||||
nsIRDFNode **target);
|
||||
nsresult createTotalMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createUnreadMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createCharsetNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createTotalMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createUnreadMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createCharsetNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createBiffStateNodeFromFolder(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createBiffStateNodeFromFlag(PRUint32 flag, nsIRDFNode **target);
|
||||
nsresult createHasUnreadMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createNewMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createSubfoldersHaveUnreadMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createHasUnreadMessagesNode(nsIMsgFolder *folder, PRBool aIncludeSubfolders, nsIRDFNode **target);
|
||||
nsresult createNewMessagesNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createFolderNoSelectNode(nsIMsgFolder *folder,
|
||||
nsIRDFNode **target);
|
||||
nsresult createFolderSynchronizeNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createFolderSyncDisabledNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createFolderSynchronizeNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
nsresult createFolderSyncDisabledNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
|
||||
nsresult createFolderChildNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
|
||||
|
@ -201,10 +200,9 @@ protected:
|
|||
nsresult NotifyFolderTreeNameChanged(nsIMsgFolder *folder, PRInt32 aUnreadMessages);
|
||||
nsresult NotifyFolderTreeSimpleNameChanged(nsIMsgFolder *folder);
|
||||
nsresult NotifyFolderNameChanged(nsIMsgFolder *folder);
|
||||
|
||||
nsresult GetNumMessagesNode(PRInt32 numMessages, nsIRDFNode **node);
|
||||
|
||||
nsresult CreateLiterals(nsIRDFService *rdf);
|
||||
nsresult NotifyAncestors(nsIMsgFolder *aFolder, nsIRDFResource *aPropertyResource, nsIRDFNode *aNode);
|
||||
nsresult GetNumMessagesNode(PRInt32 numMessages, nsIRDFNode **node);
|
||||
nsresult CreateLiterals(nsIRDFService *rdf);
|
||||
|
||||
static nsIRDFResource* kNC_Child;
|
||||
static nsIRDFResource* kNC_Folder;
|
||||
|
|
|
@ -143,6 +143,11 @@ outlinerbody:-moz-outliner-image(folderNameCol, isServer-true, serverType-nntp,
|
|||
|
||||
/* All Servers */
|
||||
|
||||
outlinerbody:-moz-outliner-cell-text(closed, subfoldersHaveUnreadMessages-true)
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
outlinerbody:-moz-outliner-cell-text(folderNameCol, isServer-true),
|
||||
outlinerbody:-moz-outliner-cell-text(hasUnreadMessages-true) {
|
||||
font-weight: bold;
|
||||
|
|
|
@ -139,6 +139,11 @@ outlinerbody:-moz-outliner-image(folderNameCol, isServer-true, serverType-nntp,
|
|||
|
||||
/* ::::: All Servers ::::: */
|
||||
|
||||
outlinerbody:-moz-outliner-cell-text(closed, subfoldersHaveUnreadMessages-true)
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
outlinerbody:-moz-outliner-cell-text(folderNameCol, isServer-true),
|
||||
outlinerbody:-moz-outliner-cell-text(hasUnreadMessages-true) {
|
||||
font-weight: bold;
|
||||
|
|
|
@ -136,6 +136,11 @@ outlinerbody:-moz-outliner-image(folderNameCol, isServer-true, serverType-nntp,
|
|||
|
||||
/* ::::: All Servers ::::: */
|
||||
|
||||
outlinerbody:-moz-outliner-cell-text(closed, subfoldersHaveUnreadMessages-true)
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
outlinerbody:-moz-outliner-cell-text(folderNameCol, isServer-true),
|
||||
outlinerbody:-moz-outliner-cell-text(hasUnreadMessages-true) {
|
||||
font-weight: bold;
|
||||
|
|
Загрузка…
Ссылка в новой задаче