From 01076fa80882191963d3271be722c65284f60a9f Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Fri, 6 Nov 2015 08:10:42 +0100 Subject: [PATCH] Make it async --- pimsettingexporter/core/synchronizeresourcejob.cpp | 7 ++++--- pimsettingexporter/core/synchronizeresourcejob.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pimsettingexporter/core/synchronizeresourcejob.cpp b/pimsettingexporter/core/synchronizeresourcejob.cpp index 62e0cbc59d..f9fec887dc 100644 --- a/pimsettingexporter/core/synchronizeresourcejob.cpp +++ b/pimsettingexporter/core/synchronizeresourcejob.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "pimsettingexportcore_debug.h" SynchronizeResourceJob::SynchronizeResourceJob(QObject *parent) @@ -38,13 +39,13 @@ SynchronizeResourceJob::~SynchronizeResourceJob() void SynchronizeResourceJob::start() { if (!mListResources.isEmpty()) { - nextSync(); + QTimer::singleShot(0, this, &SynchronizeResourceJob::slotNextSync); } else { Q_EMIT synchronizationFinished(); } } -void SynchronizeResourceJob::nextSync() +void SynchronizeResourceJob::slotNextSync() { if (mIndex < mListResources.count()) { const Akonadi::AgentInstance resource = Akonadi::AgentManager::self()->instance(mListResources.at(mIndex)); @@ -68,7 +69,7 @@ void SynchronizeResourceJob::slotSynchronizationFinished(KJob *job) Q_EMIT synchronizationInstanceDone(instanceName); } ++mIndex; - nextSync(); + QTimer::singleShot(0, this, &SynchronizeResourceJob::slotNextSync); } void SynchronizeResourceJob::setListResources(const QStringList &resources) diff --git a/pimsettingexporter/core/synchronizeresourcejob.h b/pimsettingexporter/core/synchronizeresourcejob.h index b4605d130c..73338b14b9 100644 --- a/pimsettingexporter/core/synchronizeresourcejob.h +++ b/pimsettingexporter/core/synchronizeresourcejob.h @@ -40,9 +40,9 @@ Q_SIGNALS: private Q_SLOTS: void slotSynchronizationFinished(KJob *); + void slotNextSync(); private: - void nextSync(); QStringList mListResources; int mIndex; bool mOnlyCollection; -- 2.11.4.GIT