fixed bug 17928 - undo is not working for thread pane; this is the backend fix of the problem; creating TransactionManager in nsMsgWindow instead of in nsMessenger; r=bienvenu,a=chofmann

This commit is contained in:
jefft%netscape.com 1999-11-05 05:23:15 +00:00
Родитель 49357d5655
Коммит 6bd8333c52
2 изменённых файлов: 21 добавлений и 18 удалений

Просмотреть файл

@ -66,7 +66,6 @@
#include "nsMsgLocalCID.h" #include "nsMsgLocalCID.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsTransactionManagerCID.h"
#include "nsIMsgSendLater.h" #include "nsIMsgSendLater.h"
#include "nsMsgCompCID.h" #include "nsMsgCompCID.h"
@ -99,7 +98,6 @@ static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID); static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
static NS_DEFINE_CID(kTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kMsgSendLaterCID, NS_MSGSENDLATER_CID); static NS_DEFINE_CID(kMsgSendLaterCID, NS_MSGSENDLATER_CID);
static NS_DEFINE_CID(kCopyMessageStreamListenerCID, NS_COPYMESSAGESTREAMLISTENER_CID); static NS_DEFINE_CID(kCopyMessageStreamListenerCID, NS_COPYMESSAGESTREAMLISTENER_CID);
@ -324,6 +322,8 @@ nsMessenger::SetWindow(nsIDOMWindow *aWin, nsIMsgWindow *aMsgWindow)
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv); NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);
if(NS_SUCCEEDED(rv)) if(NS_SUCCEEDED(rv))
mailSession->SetTemporaryMsgWindow(aMsgWindow); mailSession->SetTemporaryMsgWindow(aMsgWindow);
aMsgWindow->GetTransactionManager(getter_AddRefs(mTxnMgr));
} }
} }
NS_RELEASE(rootWebShell); NS_RELEASE(rootWebShell);
@ -366,17 +366,6 @@ void nsMessenger::InitializeFolderRoot()
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
m_folderPath += "Inbox"; m_folderPath += "Inbox";
} // if we have a folder root for the current server } // if we have a folder root for the current server
// create Undo/Redo Transaction Manager
NS_WITH_SERVICE (nsIComponentManager, compMgr, kComponentManagerCID, &rv);
if (NS_SUCCEEDED(rv))
{
rv = compMgr->CreateInstance(kTransactionManagerCID, nsnull,
nsCOMTypeInfo<nsITransactionManager>::GetIID(),
getter_AddRefs(mTxnMgr));
if (NS_SUCCEEDED(rv))
mTxnMgr->SetMaxTransactionCount(-1);
}
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -681,10 +670,6 @@ nsMessenger::DoCommand(nsIRDFCompositeDataSource* db, char *command,
rv = rdfService->GetResource(command, getter_AddRefs(commandResource)); rv = rdfService->GetResource(command, getter_AddRefs(commandResource));
if(NS_SUCCEEDED(rv)) if(NS_SUCCEEDED(rv))
{ {
// ** jt - temporary solution for pickybacking the undo manager into
// the nsISupportArray
if (mTxnMgr)
srcArray->InsertElementAt(mTxnMgr, 0);
rv = db->DoCommand(srcArray, commandResource, argumentArray); rv = db->DoCommand(srcArray, commandResource, argumentArray);
} }

Просмотреть файл

@ -20,6 +20,11 @@
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "nsIDOMWindow.h" #include "nsIDOMWindow.h"
#include "nsTransactionManagerCID.h"
#include "nsIComponentManager.h"
static NS_DEFINE_CID(kTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
NS_IMPL_ISUPPORTS(nsMsgWindow, nsCOMTypeInfo<nsIMsgWindow>::GetIID()) NS_IMPL_ISUPPORTS(nsMsgWindow, nsCOMTypeInfo<nsIMsgWindow>::GetIID())
@ -27,6 +32,7 @@ nsMsgWindow::nsMsgWindow()
{ {
NS_INIT_REFCNT(); NS_INIT_REFCNT();
mRootWebShell = nsnull; mRootWebShell = nsnull;
Init();
} }
nsMsgWindow::~nsMsgWindow() nsMsgWindow::~nsMsgWindow()
@ -36,7 +42,19 @@ nsMsgWindow::~nsMsgWindow()
nsresult nsMsgWindow::Init() nsresult nsMsgWindow::Init()
{ {
return NS_OK; nsresult rv = NS_OK;
// create Undo/Redo Transaction Manager
NS_WITH_SERVICE (nsIComponentManager, compMgr, kComponentManagerCID, &rv);
if (NS_SUCCEEDED(rv))
{
rv = compMgr->CreateInstance(kTransactionManagerCID, nsnull,
nsCOMTypeInfo<nsITransactionManager>::GetIID(),
getter_AddRefs(mTransactionManager));
if (NS_SUCCEEDED(rv))
mTransactionManager->SetMaxTransactionCount(-1);
}
return rv;
} }
NS_IMETHODIMP nsMsgWindow::GetStatusFeedback(nsIMsgStatusFeedback * *aStatusFeedback) NS_IMETHODIMP nsMsgWindow::GetStatusFeedback(nsIMsgStatusFeedback * *aStatusFeedback)