зеркало из https://github.com/mozilla/pjs.git
Only remove the transaction manager if we're handling the command.
This commit is contained in:
Родитель
0fbde9c198
Коммит
d103d49bd4
|
@ -415,24 +415,6 @@ nsMsgMessageDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources
|
|||
nsISupportsArray/*<nsIRDFResource>*/* aArguments)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 cnt;
|
||||
|
||||
rv = aSources->Count(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsITransactionManager> transactionManager;
|
||||
if (cnt > 1)
|
||||
{
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
|
||||
supports = getter_AddRefs(aSources->ElementAt(0));
|
||||
transactionManager = do_QueryInterface(supports, &rv);
|
||||
if (NS_SUCCEEDED(rv) && transactionManager)
|
||||
{
|
||||
aSources->RemoveElementAt(0);
|
||||
cnt--;
|
||||
}
|
||||
}
|
||||
|
||||
if((aCommand == kNC_MarkRead))
|
||||
rv = DoMarkMessagesRead(aSources, PR_TRUE);
|
||||
|
@ -621,6 +603,11 @@ nsMsgMessageDataSource::DoMarkMessagesRead(nsISupportsArray *messages, PRBool ma
|
|||
PRUint32 count;
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsITransactionManager> transactionManager;
|
||||
rv = GetTransactionManager(messages, getter_AddRefs(transactionManager));
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = messages->Count(&count);
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
|
|
@ -334,3 +334,35 @@ nsMsgRDFDataSource::unassertEnumFunc(nsISupports *aElement, void *aData)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgRDFDataSource::GetTransactionManager(nsISupportsArray *aSources, nsITransactionManager **aTransactionManager)
|
||||
{
|
||||
if(!aTransactionManager)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aTransactionManager = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsITransactionManager> transactionManager;
|
||||
|
||||
PRUint32 cnt;
|
||||
|
||||
rv = aSources->Count(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (cnt > 0)
|
||||
{
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
|
||||
supports = getter_AddRefs(aSources->ElementAt(0));
|
||||
transactionManager = do_QueryInterface(supports, &rv);
|
||||
if (NS_SUCCEEDED(rv) && transactionManager)
|
||||
{
|
||||
aSources->RemoveElementAt(0);
|
||||
*aTransactionManager = transactionManager;
|
||||
NS_IF_ADDREF(*aTransactionManager);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsIRDFService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsITransactionManager.h"
|
||||
|
||||
class nsMsgRDFDataSource : public nsIRDFDataSource,
|
||||
public nsIShutdownListener
|
||||
|
@ -165,6 +166,7 @@ class nsMsgRDFDataSource : public nsIRDFDataSource,
|
|||
static PRBool unassertEnumFunc(nsISupports *aElement, void *aData);
|
||||
nsresult NotifyObservers(nsIRDFResource *subject, nsIRDFResource *property,
|
||||
nsIRDFNode *object, PRBool assert);
|
||||
nsresult GetTransactionManager(nsISupportsArray *sources, nsITransactionManager **aTransactionManager);
|
||||
|
||||
private:
|
||||
nsIRDFService *mRDFService;
|
||||
|
|
Загрузка…
Ссылка в новой задаче