Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 49cebe23 authored by Laurent Montel's avatar Laurent Montel 😁

Use lambda

parent 9766a9d6
......@@ -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);
......
......@@ -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"
......@@ -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)
......
......@@ -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)
......
Markdown is supported
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