Commit d3fa256d authored by Sandro Knauß's avatar Sandro Knauß
Browse files

refactor [messagecomposer]: Replace skeletonJobFinished with lambda function.

Test Plan: run autotests successfully

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D28447
parent 3c897dd0
......@@ -54,7 +54,6 @@ public:
void init();
void doStart(); // slot
void composeStep1();
void skeletonJobFinished(KJob *job); // slot
void composeStep2();
QList<ContentJobBase *> createEncryptJobs(ContentJobBase *contentJob, bool sign);
void contentJobFinished(KJob *job); // slot
......@@ -114,30 +113,23 @@ void ComposerPrivate::composeStep1()
// Create skeleton message (containing headers only; no content).
SkeletonMessageJob *skeletonJob = new SkeletonMessageJob(infoPart, globalPart, q);
QObject::connect(skeletonJob, &SkeletonMessageJob::finished, q, [this](KJob *job) {
skeletonJobFinished(job);
QObject::connect(skeletonJob, &SkeletonMessageJob::finished, q, [this, skeletonJob](KJob *job) {
if (job->error()) {
return; // KCompositeJob takes care of the error.
}
// SkeletonMessageJob is a special job creating a Message instead of a Content.
Q_ASSERT(skeletonMessage == nullptr);
skeletonMessage = skeletonJob->message();
Q_ASSERT(skeletonMessage);
skeletonMessage->assemble();
composeStep2();
});
q->addSubjob(skeletonJob);
skeletonJob->start();
}
void ComposerPrivate::skeletonJobFinished(KJob *job)
{
if (job->error()) {
return; // KCompositeJob takes care of the error.
}
Q_ASSERT(dynamic_cast<SkeletonMessageJob *>(job));
SkeletonMessageJob *sjob = static_cast<SkeletonMessageJob *>(job);
// SkeletonMessageJob is a special job creating a Message instead of a Content.
Q_ASSERT(skeletonMessage == nullptr);
skeletonMessage = sjob->message();
Q_ASSERT(skeletonMessage);
skeletonMessage->assemble();
composeStep2();
}
void ComposerPrivate::composeStep2()
{
Q_Q(Composer);
......
......@@ -85,7 +85,6 @@ private:
Q_DECLARE_PRIVATE(Composer)
Q_PRIVATE_SLOT(d_func(), void doStart())
Q_PRIVATE_SLOT(d_func(), void skeletonJobFinished(KJob *))
Q_PRIVATE_SLOT(d_func(), void contentJobFinished(KJob *))
Q_PRIVATE_SLOT(d_func(), void attachmentsFinished(KJob *))
};
......
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