diff --git a/kmacctmgr.cpp b/kmacctmgr.cpp index 703f6f147..83a24d307 100644 --- a/kmacctmgr.cpp +++ b/kmacctmgr.cpp @@ -248,7 +248,6 @@ bool KMAcctMgr::remove(KMAccount* acct) void KMAcctMgr::checkMail(bool _interactive) { newMailArrived = false; - interactive = _interactive; if (checking) return; @@ -261,54 +260,14 @@ void KMAcctMgr::checkMail(bool _interactive) return; } - checking = true; - - kernel->serverReady (false); - mAccountIt->toFirst(); - lastAccountChecked = 0; - processNextAccount(false); -} - -void KMAcctMgr::processNextAccount(bool _newMail) -{ - KMAccount *cur = mAccountIt->current(); - newMailArrived |= _newMail; - if (lastAccountChecked) - disconnect( lastAccountChecked, SIGNAL(finishedCheck(bool)), - this, SLOT(processNextAccount(bool)) ); - - if (!cur) { - kernel->filterMgr()->cleanup(); - kdDebug(5006) << "checked mail, server ready" << endl; - kernel->serverReady (true); - checking = false; - emit checkedMail(newMailArrived, TRUE); - return; + while (TRUE) + { + if (!mAccountIt->current()->checkExclude()) + singleCheckMail(mAccountIt->current(), _interactive); + if (mAccountIt->atLast()) break; + ++(*mAccountIt); } - - connect( cur, SIGNAL(finishedCheck(bool)), - this, SLOT(processNextAccount(bool)) ); - - lastAccountChecked = cur; - ++(*mAccountIt); - - if (cur->type() != "imap" && cur->folder() == 0) - { - QString tmp; - tmp = i18n("Account %1 has no mailbox defined!\n" - "Mail checking aborted\n" - "Check your account settings!") - .arg(cur->name()); - KMessageBox::information(0,tmp); - processNextAccount(false); - } - else if (cur->checkExclude()) - { - // Account excluded from mail check. - processNextAccount(false); - } - else cur->processNewMail(interactive); } @@ -330,7 +289,6 @@ void KMAcctMgr::intCheckMail(int item, bool _interactive) { KMAccount* cur; newMailArrived = false; - interactive = _interactive; if (checking) return; @@ -364,18 +322,7 @@ void KMAcctMgr::intCheckMail(int item, bool _interactive) { return; } - checking = true; - - kdDebug(5006) << "checking mail, server busy" << endl; - kernel->serverReady (false); - - mAccountIt->toLast(); - ++(*mAccountIt); - - lastAccountChecked = cur; - connect( cur, SIGNAL(finishedCheck(bool)), - this, SLOT(processNextAccount(bool)) ); - cur->processNewMail(interactive); + singleCheckMail(cur, _interactive); } diff --git a/kmacctmgr.h b/kmacctmgr.h index b5660fac4..3d39c2bb9 100644 --- a/kmacctmgr.h +++ b/kmacctmgr.h @@ -63,7 +63,6 @@ public slots: virtual void singleCheckMail(KMAccount *, bool _interactive = true); virtual void intCheckMail(int, bool _interactive = true); - virtual void processNextAccount(bool newMail); virtual void processNextCheck(bool _newMail); signals: