From cb42919e0c938abe433362f5f3a7d528ae1d3cbd Mon Sep 17 00:00:00 2001 From: Pradeepto Bhattacharya Date: Thu, 10 Jul 2008 05:06:41 +0000 Subject: [PATCH] -- I could reproduce this bug on 3.5 branch as well. -- Details : https://www.intevation.de/roundup/kolab/issue2607 Merged revisions 830100 via svnmerge from svn+ssh://pradeepto@svn.kde.org/home/kde/branches/kdepim/enterprise/kdepim ........ r830100 | pradeepto | 2008-07-10 00:29:32 +0530 (Thu, 10 Jul 2008) | 4 lines -- kolab/issue2607 sync loop after deactivation of autosync. -- Check if the mail-check-interval changed to 0 / was disabled by the user and if yes, de-install the timer so that it doesn't trigger off and start a sync again and again. ........ svn path=/branches/KDE/3.5/kdepim/; revision=830307 --- accountmanager.cpp | 6 ++++++ kmaccount.cpp | 10 ++++++++++ kmaccount.h | 1 + 3 files changed, 17 insertions(+) diff --git a/accountmanager.cpp b/accountmanager.cpp index a2c0428ba..e729a0f04 100644 --- a/accountmanager.cpp +++ b/accountmanager.cpp @@ -113,6 +113,12 @@ void AccountManager::singleCheckMail(KMAccount *account, bool interactive) mNewMailArrived = false; mInteractive = interactive; + // if sync has been requested by the user then check if check-interval was disabled by user, if yes, then + // de-install the timer + // Safe guard against an infinite sync loop (kolab/issue2607) + if ( mInteractive ) + account->readTimerConfig(); + // queue the account mAcctTodo.append(account); diff --git a/kmaccount.cpp b/kmaccount.cpp index 4ad181c25..65222dd4b 100644 --- a/kmaccount.cpp +++ b/kmaccount.cpp @@ -163,6 +163,16 @@ void KMAccount::readConfig(KConfig& config) installTimer(); } +void KMAccount::readTimerConfig() +{ + // Re-reads and checks check-interval value and deinstalls timer incase check-interval + // for mail check is disabled. + // Or else, the mail sync goes into a infinite loop (kolab/issue2607) + if (mInterval == 0) + deinstallTimer(); + else + installTimer(); +} //----------------------------------------------------------------------------- void KMAccount::writeConfig(KConfig& config) diff --git a/kmaccount.h b/kmaccount.h index 14a2548ae..0f903938b 100644 --- a/kmaccount.h +++ b/kmaccount.h @@ -142,6 +142,7 @@ public: * already properly set by the caller. */ virtual void readConfig(KConfig& config); + virtual void readTimerConfig(); /** * Write all account information to given config file. The config group