Commit dd318f7e authored by Krzysztof Nowicki's avatar Krzysztof Nowicki Committed by Laurent Montel
Browse files

Reduce boilerplace



Use a helper template function to proxy status and progress signals.
Signed-off-by: Krzysztof Nowicki's avatarKrzysztof Nowicki <krissn@op.pl>
parent c1d01eae
......@@ -321,12 +321,7 @@ void EwsResource::retrieveItems(const Collection &collection)
job->setQueuedUpdates(mQueuedUpdates.value(collection.remoteId()));
mQueuedUpdates.remove(collection.remoteId());
connect(job, &EwsFetchItemsJob::result, this, &EwsResource::itemFetchJobFinished);
connect(job, &EwsFetchItemsJob::status, this, [this](int s, const QString &message) {
Q_EMIT status(s, message);
});
connect(job, &EwsFetchItemsJob::percent, this, [this](int p) {
Q_EMIT percent(p);
});
connectStatusSignals(job);
job->start();
}
......@@ -1413,4 +1408,15 @@ void EwsResource::setInitialReconnectTimeout(int timeout)
mInitialReconnectTimeout = mReconnectTimeout = timeout;
}
template<class Job>
void EwsResource::connectStatusSignals(Job *job)
{
connect(job, &Job::status, this, [this](int s, const QString &message) {
Q_EMIT status(s, message);
});
connect(job, &Job::percent, this, [this](int p) {
Q_EMIT percent(p);
});
}
AKONADI_RESOURCE_MAIN(EwsResource)
/*
SPDX-FileCopyrightText: 2015-2018 Krzysztof Nowicki <krissn@op.pl>
SPDX-FileCopyrightText: 2015-2019 Krzysztof Nowicki <krissn@op.pl>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......@@ -141,6 +141,9 @@ private:
void reauthNotificationDismissed(bool accepted);
void reauthenticate();
template<class Job>
void connectStatusSignals(Job *job);
EwsClient mEwsClient;
Akonadi::Collection mRootCollection;
QScopedPointer<EwsSubscriptionManager> mSubManager;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment