summaryrefslogtreecommitdiff
path: root/lib/kolabaccount.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kolabaccount.cpp')
-rw-r--r--lib/kolabaccount.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/kolabaccount.cpp b/lib/kolabaccount.cpp
index a0b616c..a395f2f 100644
--- a/lib/kolabaccount.cpp
+++ b/lib/kolabaccount.cpp
@@ -50,6 +50,14 @@ KolabAccount::KolabAccount(QObject* parent)
}
+KolabAccount::~KolabAccount()
+{
+ if (mSession) {
+ mSession->close();
+ mSession->deleteLater();
+ }
+}
+
void KolabAccount::setVersion(Kolab::Version version)
{
mVersion = version;
@@ -212,17 +220,12 @@ void KolabAccount::appendObjectSync(Object obj, const QString& folder)
}
}
-void KolabAccount::logout()
+KJob *KolabAccount::logout()
{
if (!mSession) {
- return;
+ return 0;
}
- KIMAP::LogoutJob *logoutJob = new KIMAP::LogoutJob(mSession);
- logoutJob->exec();
- mSession->close();
-// mSession->deleteLater();
- mSession = 0;
- Debug() << "logout done";
+ return new KIMAP::LogoutJob(mSession);
}
const char* FlagDeleted2 = "\\Deleted";
@@ -303,7 +306,13 @@ void KolabAccount::cleanAccount()
mFolders.append(QLatin1String("inbox"));
//logging out and logging in again seems to help with the "NO Mailbox is locked" problem when creating folders afterwards.
- logout();
+ KJob *logoutJob = logout();
+ if (logoutJob) {
+ logoutJob->exec();
+ }
+ mSession->close();
+ mSession->deleteLater();
+ mSession = 0;
init();
}