summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2018-01-11 07:03:45 +0100
committerLaurent Montel <[email protected]>2018-01-11 07:03:45 +0100
commit49cebe23efa327d304cf9466250a181adcd60160 (patch)
treedec9d94a126711fe1d72a1a5a8b0777cb107d232
parent9766a9d66b7a869ff3d642b7316dd7b7180f52a3 (diff)
Use lambda
-rw-r--r--agents/maildispatcher/maildispatcheragent.cpp8
-rw-r--r--agents/maildispatcher/outboxqueue.cpp24
-rw-r--r--agents/maildispatcher/sendjob.cpp24
-rw-r--r--agents/maildispatcher/storeresultjob.cpp8
4 files changed, 16 insertions, 48 deletions
diff --git a/agents/maildispatcher/maildispatcheragent.cpp b/agents/maildispatcher/maildispatcheragent.cpp
index d029098..c3d7e12 100644
--- a/agents/maildispatcher/maildispatcheragent.cpp
+++ b/agents/maildispatcher/maildispatcheragent.cpp
@@ -161,9 +161,7 @@ MailDispatcherAgent::MailDispatcherAgent(const QString &id)
mQueue = new OutboxQueue(this);
connect(mQueue, &OutboxQueue::newItems,
- this, [this]() {
- dispatch();
- });
+ this, &MailDispatcherAgent::dispatch);
connect(mQueue, &OutboxQueue::itemReady,
this, [this](const Akonadi::Item &item) {
itemFetched(item);
@@ -173,9 +171,7 @@ MailDispatcherAgent::MailDispatcherAgent(const QString &id)
connect(this, &MailDispatcherAgent::itemProcessed,
mQueue, &OutboxQueue::itemProcessed);
connect(this, &MailDispatcherAgent::abortRequested,
- this, [this]() {
- abort();
- });
+ this, &MailDispatcherAgent::abort);
mSentActionHandler = new SentActionHandler(this);
diff --git a/agents/maildispatcher/outboxqueue.cpp b/agents/maildispatcher/outboxqueue.cpp
index 19cf4a9..524060b 100644
--- a/agents/maildispatcher/outboxqueue.cpp
+++ b/agents/maildispatcher/outboxqueue.cpp
@@ -56,9 +56,7 @@ void OutboxQueue::initQueue()
ItemFetchJob *job = new ItemFetchJob(mOutbox);
job->fetchScope().fetchAllAttributes();
job->fetchScope().fetchFullPayload(false);
- connect(job, &ItemFetchJob::result, this, [this](KJob *job) {
- collectionFetched(job);
- });
+ connect(job, &ItemFetchJob::result, this, &OutboxQueue::collectionFetched);
}
void OutboxQueue::addIfComplete(const Item &item)
@@ -246,9 +244,7 @@ void OutboxQueue::localFoldersChanged()
SpecialMailCollectionsRequestJob *job = new SpecialMailCollectionsRequestJob(this);
job->requestDefaultCollection(SpecialMailCollections::Outbox);
- connect(job, &SpecialMailCollectionsRequestJob::result, this, [this](KJob *job) {
- localFoldersRequestResult(job);
- });
+ connect(job, &SpecialMailCollectionsRequestJob::result, this, &OutboxQueue::localFoldersRequestResult);
qCDebug(MAILDISPATCHER_LOG) << "Requesting outbox folder.";
job->start();
@@ -346,19 +342,13 @@ OutboxQueue::OutboxQueue(QObject *parent)
this, &OutboxQueue::itemChanged);
connect(mMonitor, &Monitor::itemMoved,
this, &OutboxQueue::itemMoved);
- connect(mMonitor, &Monitor::itemRemoved, this, [this](const Akonadi::Item &item) {
- itemRemoved(item);
- });
+ connect(mMonitor, &Monitor::itemRemoved, this, &OutboxQueue::itemRemoved);
- connect(SpecialMailCollections::self(), &SpecialMailCollections::defaultCollectionsChanged, this, [this]() {
- localFoldersChanged();
- });
+ connect(SpecialMailCollections::self(), &SpecialMailCollections::defaultCollectionsChanged, this, &OutboxQueue::localFoldersChanged);
localFoldersChanged();
mFutureTimer = new QTimer(this);
- connect(mFutureTimer, &QTimer::timeout, this, [this]() {
- checkFuture();
- });
+ connect(mFutureTimer, &QTimer::timeout, this, &OutboxQueue::checkFuture);
mFutureTimer->start(60 * 60 * 1000); // 1 hour
}
@@ -402,9 +392,7 @@ void OutboxQueue::fetchOne()
ItemFetchJob *job = new ItemFetchJob(item);
job->fetchScope().fetchAllAttributes();
job->fetchScope().fetchFullPayload();
- connect(job, &ItemFetchJob::result, this, [this](KJob *job) {
- itemFetched(job);
- });
+ connect(job, &ItemFetchJob::result, this, &OutboxQueue::itemFetched);
}
#include "moc_outboxqueue.cpp"
diff --git a/agents/maildispatcher/sendjob.cpp b/agents/maildispatcher/sendjob.cpp
index 93bb677..44d25a9 100644
--- a/agents/maildispatcher/sendjob.cpp
+++ b/agents/maildispatcher/sendjob.cpp
@@ -167,9 +167,7 @@ void SendJob::doTraditionalTransport()
job->setBcc(addressAttribute->bcc());
// Signals.
- connect(job, &TransportJob::result, this, [this](KJob *job) {
- transportResult(job);
- });
+ connect(job, &TransportJob::result, this, &SendJob::transportResult);
//Wait kf6 We have a private signal
//connect(job, thisOverload<KJob*, ulong>::of(&TransportJob::percent), this, [this](KJob *job,ulong val) {transportPercent(job, val); });
connect(job, SIGNAL(percent(KJob *,ulong)),
@@ -258,25 +256,19 @@ void SendJob::doPostJob(bool transportSuccess, const QString &transportMessage)
if (attribute->sentBehaviour() == SentBehaviourAttribute::Delete) {
qCDebug(MAILDISPATCHER_LOG) << "Deleting item from outbox.";
mCurrentJob = new ItemDeleteJob(mItem);
- QObject::connect(mCurrentJob, &ItemDeleteJob::result, this, [this](KJob *job) {
- postJobResult(job);
- });
+ QObject::connect(mCurrentJob, &ItemDeleteJob::result, this, &SendJob::postJobResult);
} else {
if (attribute->sentBehaviour() == SentBehaviourAttribute::MoveToDefaultSentCollection) {
if (SpecialMailCollections::self()->hasDefaultCollection(SpecialMailCollections::SentMail)) {
mCurrentJob = new ItemMoveJob(mItem, SpecialMailCollections::self()->defaultCollection(SpecialMailCollections::SentMail), this);
- QObject::connect(mCurrentJob, &ItemMoveJob::result, this, [this](KJob *job) {
- postJobResult(job);
- });
+ QObject::connect(mCurrentJob, &ItemMoveJob::result, this, &SendJob::postJobResult);
} else {
abortPostJob();
}
} else {
qCDebug(MAILDISPATCHER_LOG) << "sentBehaviour=" << attribute->sentBehaviour() << "using collection from attribute";
mCurrentJob = new CollectionFetchJob(attribute->moveToCollection(), Akonadi::CollectionFetchJob::Base);
- QObject::connect(mCurrentJob, &CollectionFetchJob::result, this, [this](KJob *job) {
- slotSentMailCollectionFetched(job);
- });
+ QObject::connect(mCurrentJob, &CollectionFetchJob::result, this, &SendJob::slotSentMailCollectionFetched);
}
}
}
@@ -325,9 +317,7 @@ void SendJob::slotSentMailCollectionFetched(KJob *job)
fetchCol = SpecialMailCollections::self()->defaultCollection(SpecialMailCollections::SentMail);
}
mCurrentJob = new ItemMoveJob(mItem, fetchCol, this);
- QObject::connect(mCurrentJob, &ItemMoveJob::result, this, [this](KJob *job) {
- postJobResult(job);
- });
+ QObject::connect(mCurrentJob, &ItemMoveJob::result, this, &SendJob::postJobResult);
}
void SendJob::postJobResult(KJob *job)
@@ -373,9 +363,7 @@ void SendJob::storeResult(bool success, const QString &message)
Q_ASSERT(mCurrentJob == nullptr);
mCurrentJob = new StoreResultJob(mItem, success, message);
- connect(mCurrentJob, &StoreResultJob::result, this, [this](KJob *job) {
- doEmitResult(job);
- });
+ connect(mCurrentJob, &StoreResultJob::result, this, &SendJob::doEmitResult);
}
void SendJob::doEmitResult(KJob *job)
diff --git a/agents/maildispatcher/storeresultjob.cpp b/agents/maildispatcher/storeresultjob.cpp
index d289fea..478b79a 100644
--- a/agents/maildispatcher/storeresultjob.cpp
+++ b/agents/maildispatcher/storeresultjob.cpp
@@ -47,9 +47,7 @@ void StoreResultJob::doStart()
{
// Fetch item in case it was modified elsewhere.
ItemFetchJob *job = new ItemFetchJob(mItem, this);
- connect(job, &ItemFetchJob::result, this, [this](KJob *job) {
- fetchDone(job);
- });
+ connect(job, &ItemFetchJob::result, this, &StoreResultJob::fetchDone);
}
bool StoreResultJob::success() const
@@ -103,9 +101,7 @@ void StoreResultJob::fetchDone(KJob *job)
}
ItemModifyJob *modifyJob = new ItemModifyJob(item, this);
- QObject::connect(modifyJob, &ItemModifyJob::result, this, [this](KJob *job) {
- modifyDone(job);
- });
+ QObject::connect(modifyJob, &ItemModifyJob::result, this, &StoreResultJob::modifyDone);
}
void StoreResultJob::modifyDone(KJob *job)