mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
fix twisties in the thread pane and account manager by responding to GetTarget() along the child arcs like #child and #MessageChild bug #13551
r=scottip
This commit is contained in:
parent
542a5aef6c
commit
e35216913e
@ -241,7 +241,8 @@ nsMsgAccountManagerDataSource::GetTarget(nsIRDFResource *source,
|
||||
}
|
||||
|
||||
// handle sorting of servers
|
||||
else if ((property == kNC_NameSort) || (property == kNC_FolderTreeNameSort)) {
|
||||
else if ((property == kNC_NameSort) ||
|
||||
(property == kNC_FolderTreeNameSort)) {
|
||||
// make sure we're handling a root folder that is a server
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(source,&rv);
|
||||
if (NS_FAILED(rv))
|
||||
@ -263,6 +264,20 @@ nsMsgAccountManagerDataSource::GetTarget(nsIRDFResource *source,
|
||||
accountNum += 1000;
|
||||
str.Append(accountNum);
|
||||
}
|
||||
|
||||
// GetTargets() stuff - need to return a valid answer so that
|
||||
// twisties will appear
|
||||
else if (property == kNC_Settings) {
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(source,&rv);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_RDF_NO_VALUE;
|
||||
|
||||
PRBool isServer=PR_FALSE;
|
||||
folder->GetIsServer(&isServer);
|
||||
// no need to localize this!
|
||||
if (isServer)
|
||||
str = "ServerSettings";
|
||||
}
|
||||
|
||||
if (str!="")
|
||||
rv = createNode(str, target, getRDFService());
|
||||
|
@ -316,13 +316,8 @@ NS_IMETHODIMP nsMsgMessageDataSource::GetTargets(nsIRDFResource* source,
|
||||
nsCOMPtr<nsIMessage> message(do_QueryInterface(source, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool showThreads;
|
||||
nsCOMPtr<nsIMessageView> messageView;
|
||||
rv = mWindow->GetMessageView(getter_AddRefs(messageView));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = messageView->GetShowThreads(&showThreads);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
GetIsThreaded(&showThreads);
|
||||
|
||||
if(showThreads && property == kNC_MessageChild)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> msgfolder;
|
||||
@ -438,11 +433,7 @@ NS_IMETHODIMP nsMsgMessageDataSource::ArcLabelsOut(nsIRDFResource* source,
|
||||
{
|
||||
|
||||
PRBool showThreads;
|
||||
nsCOMPtr<nsIMessageView> messageView;
|
||||
rv = mWindow->GetMessageView(getter_AddRefs(messageView));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = messageView->GetShowThreads(&showThreads);
|
||||
rv = GetIsThreaded(&showThreads);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
if(showThreads)
|
||||
@ -660,7 +651,9 @@ nsMsgMessageDataSource::createMessageNode(nsIMessage *message,
|
||||
return createMessageTotalNode(message, target);
|
||||
else if ((kNC_Unread == property))
|
||||
return createMessageUnreadNode(message, target);
|
||||
|
||||
else if ((kNC_MessageChild == property))
|
||||
return createMessageMessageChildNode(message, target);
|
||||
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
|
||||
@ -907,12 +900,7 @@ nsresult nsMsgMessageDataSource::createMessageTotalNode(nsIMessage *message, nsI
|
||||
nsString emptyString("");
|
||||
|
||||
PRBool showThreads;
|
||||
nsCOMPtr<nsIMessageView> messageView;
|
||||
rv = mWindow->GetMessageView(getter_AddRefs(messageView));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = messageView->GetShowThreads(&showThreads);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
GetIsThreaded(&showThreads);
|
||||
|
||||
if(!showThreads)
|
||||
rv = createNode(emptyString, target, getRDFService());
|
||||
@ -955,11 +943,7 @@ nsresult nsMsgMessageDataSource::createMessageUnreadNode(nsIMessage *message, ns
|
||||
nsString emptyString("");
|
||||
|
||||
PRBool showThreads;
|
||||
nsCOMPtr<nsIMessageView> messageView;
|
||||
rv = mWindow->GetMessageView(getter_AddRefs(messageView));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = messageView->GetShowThreads(&showThreads);
|
||||
rv = GetIsThreaded(&showThreads);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
if(!showThreads)
|
||||
@ -994,6 +978,39 @@ nsresult nsMsgMessageDataSource::createMessageUnreadNode(nsIMessage *message, ns
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgMessageDataSource::createMessageMessageChildNode(nsIMessage *message,
|
||||
nsIRDFNode **target)
|
||||
{
|
||||
nsresult rv;
|
||||
// this is slow, but for now, call GetTargets and then create
|
||||
// a node out of the first message, if any
|
||||
nsCOMPtr<nsIRDFResource> messageResource(do_QueryInterface(message));
|
||||
nsCOMPtr<nsISimpleEnumerator> messages;
|
||||
rv = GetTargets(messageResource, kNC_MessageChild, PR_TRUE,
|
||||
getter_AddRefs(messages));
|
||||
|
||||
PRBool hasMessages;
|
||||
messages->HasMoreElements(&hasMessages);
|
||||
|
||||
if (hasMessages)
|
||||
return createNode("has messages", target, getRDFService());
|
||||
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsMsgMessageDataSource::GetIsThreaded(PRBool *threaded)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMessageView> messageView;
|
||||
rv = mWindow->GetMessageView(getter_AddRefs(messageView));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return messageView->GetShowThreads(threaded);
|
||||
}
|
||||
|
||||
nsresult nsMsgMessageDataSource::GetMessageFolderAndThread(nsIMessage *message,
|
||||
nsIMsgFolder **folder,
|
||||
nsIMsgThread **thread)
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
protected:
|
||||
|
||||
nsresult GetSenderName(nsAutoString& sender, nsAutoString *senderUserName);
|
||||
|
||||
nsresult GetIsThreaded(PRBool *threaded);
|
||||
|
||||
nsresult createMessageNode(nsIMessage *message, nsIRDFResource *property,
|
||||
nsIRDFNode **target);
|
||||
@ -140,6 +140,7 @@ protected:
|
||||
|
||||
nsresult createMessageUnreadNode(nsIMessage *message, nsIRDFNode **target);
|
||||
nsresult createMessageTotalNode(nsIMessage *message, nsIRDFNode **target);
|
||||
nsresult createMessageMessageChildNode(nsIMessage* message, nsIRDFNode **target);
|
||||
nsresult GetMessageFolderAndThread(nsIMessage *message, nsIMsgFolder **folder,
|
||||
nsIMsgThread **thread);
|
||||
PRBool IsThreadsFirstMessage(nsIMsgThread *thread, nsIMessage *message);
|
||||
|
Loading…
x
Reference in New Issue
Block a user