From 707f3191fc74ce183911da6d771ff08d6da485c8 Mon Sep 17 00:00:00 2001 From: Bruno Virlet Date: Wed, 29 Aug 2007 16:38:48 +0000 Subject: [PATCH] Fix precommand. Fix local Mailbox and Maildir accounts. svn path=/branches/kdepim/enterprise/kdepim/; revision=706179 --- kmaccount.cpp | 17 ++++++++++++----- kmaccount.h | 4 ++++ kmacctlocal.cpp | 6 +++++- kmacctmaildir.cpp | 3 +++ kmacctmaildir.h | 2 ++ kmsender.cpp | 1 - 6 files changed, 26 insertions(+), 7 deletions(-) diff --git a/kmaccount.cpp b/kmaccount.cpp index 0f3f994ce..869ac88f5 100644 --- a/kmaccount.cpp +++ b/kmaccount.cpp @@ -89,7 +89,8 @@ KMAccount::KMAccount(AccountManager* aOwner, const QString& aName, uint id) mExclude(false), mCheckingMail(false), mHasInbox(false), - mMailCheckProgressItem(0) + mMailCheckProgressItem(0), + mPrecommandProcess(0) { assert(aOwner != 0); } @@ -355,19 +356,25 @@ void KMAccount::startPrecommand(const QString &precommand) if ( precommand.isEmpty() ) emit precommandExited( true ); - KMPrecommand precommandProcess(precommand, this); + KMPrecommand *mPrecommandProcess = new KMPrecommand(precommand, this); BroadcastStatus::instance()->setStatusMsg( i18n("Executing precommand %1").arg(precommand )); - connect(&precommandProcess, SIGNAL(finished(bool)), - SLOT(precommandExited(bool))); + connect(mPrecommandProcess, SIGNAL(finished(bool)), + SLOT(precommandFinished(bool))); kdDebug(5006) << "Running precommand " << precommand << endl; - if (!precommandProcess.start()) + if (!mPrecommandProcess->start()) emit precommandExited( false ); } +//----------------------------------------------------------------------------- +void KMAccount::precommandFinished( bool success ) +{ + delete mPrecommandProcess; mPrecommandProcess = 0; + emit precommandExited( success ); +} //----------------------------------------------------------------------------- void KMAccount::mailCheck() { diff --git a/kmaccount.h b/kmaccount.h index 4147062eb..55a6da053 100644 --- a/kmaccount.h +++ b/kmaccount.h @@ -269,6 +269,9 @@ protected slots: virtual void mailCheck(); virtual void sendReceipts(); +private slots: + void precommandFinished( bool success ); + protected: KMAccount( AccountManager* owner, const QString& accountName, uint id); @@ -324,6 +327,7 @@ private: private: // for detailed (per folder) new mail notification QMap mNewInFolder; + KMPrecommand *mPrecommandProcess; }; #endif /*kmaccount_h*/ diff --git a/kmacctlocal.cpp b/kmacctlocal.cpp index d41863635..015459ddb 100644 --- a/kmacctlocal.cpp +++ b/kmacctlocal.cpp @@ -76,7 +76,7 @@ void KMAcctLocal::processNewMail(bool) { mHasNewMail = false; - connect( this, SIGNAL(preProcessExited(bool)), SLOT(continueProcess()) ); + connect( this, SIGNAL(preProcessExited(bool)), SLOT(continueProcess(bool)) ); preProcess(); } @@ -112,6 +112,7 @@ void KMAcctLocal::preProcess() BroadcastStatus::instance()->setStatusMsgTransmissionCompleted( mName, 0 ); checkDone( mHasNewMail, CheckOK ); emit preProcessExited( false ); + return; } } @@ -127,6 +128,7 @@ void KMAcctLocal::preProcess() checkDone( mHasNewMail, CheckError ); BroadcastStatus::instance()->setStatusMsg( i18n( "Transmission failed." )); emit preProcessExited( false ); + return; } //BroadcastStatus::instance()->reset(); @@ -155,6 +157,7 @@ void KMAcctLocal::continuePreProcess( bool precommandSuccess ) checkDone( mHasNewMail, CheckError ); BroadcastStatus::instance()->setStatusMsg( i18n( "Running precommand failed." )); emit preProcessExited( false ); + return; } const int rc = mMailFolder->open(); @@ -178,6 +181,7 @@ void KMAcctLocal::continuePreProcess( bool precommandSuccess ) .arg( mMailFolder->location() ); BroadcastStatus::instance()->setStatusMsg( errMsg ); emit preProcessExited( false ); + return; } mFolder->open(); diff --git a/kmacctmaildir.cpp b/kmacctmaildir.cpp index 19d55c3bb..359eb9d11 100644 --- a/kmacctmaildir.cpp +++ b/kmacctmaildir.cpp @@ -238,3 +238,6 @@ void KMAcctMaildir::setLocation(const QString& aLocation) { mLocation = aLocation; } + +#include "kmacctmaildir.moc" + diff --git a/kmacctmaildir.h b/kmacctmaildir.h index ef13fdb72..3b304ec0c 100644 --- a/kmacctmaildir.h +++ b/kmacctmaildir.h @@ -9,6 +9,8 @@ class KMAcctMaildir: public KMAccount { + Q_OBJECT + protected: friend class ::AccountManager; diff --git a/kmsender.cpp b/kmsender.cpp index 15afe0ec3..41af698a9 100644 --- a/kmsender.cpp +++ b/kmsender.cpp @@ -759,7 +759,6 @@ void KMSender::slotIdle() cleanup(); } - //----------------------------------------------------------------------------- void KMSender::slotPrecommandFinished(bool normalExit) {