Commit 2993258e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

GIT_SILENT: coding style

parent f77fd7bf
Pipeline #24062 canceled with stage
......@@ -199,7 +199,7 @@ void EncryptJobTest::testProtectedHeaders_data()
void EncryptJobTest::testProtectedHeaders()
{
QFETCH(bool,protectedHeaders);
QFETCH(bool, protectedHeaders);
QFETCH(bool, protectedHeadersObvoscate);
QFETCH(QString, referenceFile);
......
......@@ -525,7 +525,6 @@ void MessageFactoryTest::testCreateReplyUTF16Base64Async()
TemplateParser::TemplateParserSettings::self()->setReplyUsingVisualFormat(true);
factory.setReplyAsHtml(true);
QSignalSpy spy(&factory, &MessageFactoryNG::createReplyDone);
factory.setIdentityManager(mIdentMan);
......
......@@ -98,9 +98,9 @@ void Test::compareFile(const QString &outFile, const QString &referenceFile)
// compare to reference file
const auto args = QStringList()
<< QStringLiteral("-u")
<< referenceFile
<< outFile;
<< QStringLiteral("-u")
<< referenceFile
<< outFile;
QProcess proc;
proc.setProcessChannelMode(QProcess::ForwardedChannels);
proc.start(QStringLiteral("diff"), args);
......
......@@ -52,10 +52,10 @@ void SignEncryptTest::testContent_data()
QTest::addColumn<int>("cryptoMessageFormat");
QTest::addColumn<QString>("error");
QTest::newRow("OpenPGPMimeFormat") << (int) Kleo::OpenPGPMIMEFormat << QString();
QTest::newRow("InlineOpenPGPFormat") << (int) Kleo::InlineOpenPGPFormat << QString();
QTest::newRow("SMIMEFormat") << (int) Kleo::SMIMEFormat << QStringLiteral("Not implemented");
QTest::newRow("SMIMEOpaqueFormat") << (int) Kleo::SMIMEOpaqueFormat << QStringLiteral("Not implemented");
QTest::newRow("OpenPGPMimeFormat") << (int)Kleo::OpenPGPMIMEFormat << QString();
QTest::newRow("InlineOpenPGPFormat") << (int)Kleo::InlineOpenPGPFormat << QString();
QTest::newRow("SMIMEFormat") << (int)Kleo::SMIMEFormat << QStringLiteral("Not implemented");
QTest::newRow("SMIMEOpaqueFormat") << (int)Kleo::SMIMEOpaqueFormat << QStringLiteral("Not implemented");
}
void SignEncryptTest::testContent()
......@@ -113,7 +113,7 @@ void SignEncryptTest::testContent()
void SignEncryptTest::testContentSubjobChained()
{
const std::vector< GpgME::Key > &keys = Test::getKeys();
const std::vector< GpgME::Key > &keys = Test::getKeys();
const QByteArray data(QString::fromLocal8Bit("one flew over the cuckoo's nest").toUtf8());
KMime::Message skeletonMessage;
......@@ -152,10 +152,9 @@ void SignEncryptTest::testContentSubjobChained()
delete result;
}
void SignEncryptTest::testHeaders()
{
const std::vector< GpgME::Key > &keys = Test::getKeys();
const std::vector< GpgME::Key > &keys = Test::getKeys();
Composer composer;
auto seJob = new SignEncryptJob(&composer);
......
......@@ -227,7 +227,7 @@ void SignJobTest::testProtectedHeaders_data()
void SignJobTest::testProtectedHeaders()
{
QFETCH(bool,protectedHeaders);
QFETCH(bool, protectedHeaders);
QFETCH(QString, referenceFile);
const std::vector< GpgME::Key > &keys = Test::getKeys();
......
......@@ -25,7 +25,6 @@
using namespace MessageComposer;
bool FollowUpReminder::isAvailableAndEnabled()
{
using Akonadi::ServerManager;
......@@ -37,4 +36,3 @@ bool FollowUpReminder::isAvailableAndEnabled()
return iface.isValid() && iface.enabledAgent();
}
......@@ -24,16 +24,10 @@
#include <QtGlobal>
namespace MessageComposer
{
namespace FollowUpReminder
{
namespace MessageComposer {
namespace FollowUpReminder {
Q_REQUIRED_RESULT MESSAGECOMPOSER_EXPORT bool isAvailableAndEnabled();
}
}
#endif
......@@ -127,7 +127,7 @@ void FollowupReminderCreateJob::writeFollowupReminderInfo()
Akonadi::ServerManager::agentServiceName(Akonadi::ServerManager::Agent, QStringLiteral("akonadi_followupreminder_agent")),
QStringLiteral("/FollowUpReminder"),
QDBusConnection::sessionBus()
}};
}};
if (!iface->isValid()) {
qCWarning(MESSAGECOMPOSER_LOG) << "The FollowUpReminder agent is not running!";
......@@ -138,16 +138,16 @@ void FollowupReminderCreateJob::writeFollowupReminderInfo()
auto wait = new QDBusPendingCallWatcher{call, this};
connect(wait, &QDBusPendingCallWatcher::finished,
this, [this, iface_ = std::move(iface)](QDBusPendingCallWatcher *watcher) mutable {
auto iface = std::move(iface_);
watcher->deleteLater();
const QDBusPendingReply<void> reply = *watcher;
if (reply.isError()) {
qCWarning(MESSAGECOMPOSER_LOG) << "Failed to write the new reminder, agent replied" << reply.error().message();
setError(KJob::UserDefinedError);
setErrorText(i18n("Failed to store a new reminder: %1", reply.error().message()));
}
emitResult();
});
auto iface = std::move(iface_);
watcher->deleteLater();
const QDBusPendingReply<void> reply = *watcher;
if (reply.isError()) {
qCWarning(MESSAGECOMPOSER_LOG) << "Failed to write the new reminder, agent replied" << reply.error().message();
setError(KJob::UserDefinedError);
setErrorText(i18n("Failed to store a new reminder: %1", reply.error().message()));
}
emitResult();
});
}
......@@ -942,8 +942,7 @@ QString MessageFactoryNG::replaceHeadersInString(const KMime::Message::Ptr &msg,
const auto replacement = hdr->asUnicodeString();
result.replace(idx, match.capturedLength(1), replacement);
idx += replacement.length();
}
else {
} else {
result.remove(idx, match.capturedLength(1));
}
}
......
......@@ -124,7 +124,7 @@ void EncryptJob::setRecipients(const QStringList &recipients)
d->recipients = recipients;
}
void EncryptJob::setSkeletonMessage(KMime::Message* skeletonMessage)
void EncryptJob::setSkeletonMessage(KMime::Message *skeletonMessage)
{
Q_D(EncryptJob);
......
......@@ -60,8 +60,7 @@ void ProtectedHeadersJob::setContent(KMime::Content *content)
Q_D(ProtectedHeadersJob);
d->content = content;
if (content)
{
if (content) {
d->content->assemble();
}
}
......@@ -80,39 +79,40 @@ void ProtectedHeadersJob::setObvoscate(bool obvoscate)
d->obvoscate = obvoscate;
}
void ProtectedHeadersJob::doStart() {
void ProtectedHeadersJob::doStart()
{
Q_D(ProtectedHeadersJob);
Q_ASSERT(d->resultContent == nullptr); // Not processed before.
Q_ASSERT(d->skeletonMessage); // We need a skeletonMessage to proceed
auto subject = d->skeletonMessage->header<KMime::Headers::Subject>();
if (d->obvoscate && subject) {
// Create protected header lagacy mimepart with replaced headers
SinglepartJob *cjob = new SinglepartJob;
cjob->contentType()->setMimeType("text/plain");
cjob->contentType()->setCharset(subject->rfc2047Charset());
cjob->contentType()->setParameter(QStringLiteral("protected-headers"), QStringLiteral("v1"));
cjob->contentDisposition()->setDisposition(KMime::Headers::contentDisposition::CDinline);
cjob->setData(subject->type() + QByteArray(": ") + subject->asUnicodeString().toUtf8());
QObject::connect(cjob, &SinglepartJob::finished, this, [d, cjob](KJob *job) {
KMime::Content *mixedPart = new KMime::Content();
const QByteArray boundary = KMime::multiPartBoundary();
mixedPart->contentType()->setMimeType("multipart/mixed");
mixedPart->contentType()->setBoundary(boundary);
mixedPart->addContent(cjob->content());
// if setContent hasn't been called, we assume that a subjob was added
// and we want to use that
if (!d->content || !d->content->hasContent()) {
Q_ASSERT(d->subjobContents.size() == 1);
d->content = d->subjobContents.first();
}
mixedPart->addContent(d->content);
d->content = mixedPart;
});
appendSubjob(cjob);
// Create protected header lagacy mimepart with replaced headers
SinglepartJob *cjob = new SinglepartJob;
cjob->contentType()->setMimeType("text/plain");
cjob->contentType()->setCharset(subject->rfc2047Charset());
cjob->contentType()->setParameter(QStringLiteral("protected-headers"), QStringLiteral("v1"));
cjob->contentDisposition()->setDisposition(KMime::Headers::contentDisposition::CDinline);
cjob->setData(subject->type() + QByteArray(": ") + subject->asUnicodeString().toUtf8());
QObject::connect(cjob, &SinglepartJob::finished, this, [d, cjob](KJob *job) {
KMime::Content *mixedPart = new KMime::Content();
const QByteArray boundary = KMime::multiPartBoundary();
mixedPart->contentType()->setMimeType("multipart/mixed");
mixedPart->contentType()->setBoundary(boundary);
mixedPart->addContent(cjob->content());
// if setContent hasn't been called, we assume that a subjob was added
// and we want to use that
if (!d->content || !d->content->hasContent()) {
Q_ASSERT(d->subjobContents.size() == 1);
d->content = d->subjobContents.first();
}
mixedPart->addContent(d->content);
d->content = mixedPart;
});
appendSubjob(cjob);
}
ContentJobBase::doStart();
......
......@@ -191,7 +191,6 @@ void SignEncryptJob::doStart()
ContentJobBase::doStart();
}
void SignEncryptJob::slotResult(KJob *job)
{
//Q_D(SignEncryptJob);
......
......@@ -27,7 +27,8 @@ using namespace MessageComposer;
SendLaterCreateJob::SendLaterCreateJob(const SendLaterInfo &info, QObject *parent)
: SendLaterJob(parent)
, mInfo(info)
{}
{
}
QDBusPendingReply<> SendLaterCreateJob::doCall(OrgFreedesktopAkonadiSendLaterAgentInterface *iface)
{
......
......@@ -26,7 +26,6 @@
#include "messagecomposer_export.h"
namespace MessageComposer {
class MESSAGECOMPOSER_EXPORT SendLaterCreateJob : public SendLaterJob
{
Q_OBJECT
......
......@@ -32,7 +32,6 @@ class SendLaterWidget;
}
namespace MessageComposer {
class SendLaterInfo;
/** Send later dialog. */
......
......@@ -26,7 +26,6 @@
#include "messagecomposer_export.h"
namespace MessageComposer {
/** Send later information. */
class MESSAGECOMPOSER_EXPORT SendLaterInfo
{
......
......@@ -33,7 +33,8 @@ using namespace MessageComposer;
SendLaterJob::SendLaterJob(QObject *parent)
: KJob(parent)
{}
{
}
void SendLaterJob::start()
{
......@@ -55,15 +56,15 @@ void SendLaterJob::start()
auto watcher = new QDBusPendingCallWatcher(reply);
connect(watcher, &QDBusPendingCallWatcher::finished,
this, [this, iface_ = std::move(iface)](QDBusPendingCallWatcher *call) mutable {
auto iface = std::move(iface_);
call->deleteLater();
QDBusPendingReply<void> reply = *call;
if (reply.isError()) {
qCWarning(MESSAGECOMPOSER_LOG) << "SendLater agent DBus call failed:" << reply.error().message();
setError(SendLaterJob::CallFailed);
setErrorText(getErrorString(SendLaterJob::CallFailed, reply.error().message()));
}
auto iface = std::move(iface_);
call->deleteLater();
QDBusPendingReply<void> reply = *call;
if (reply.isError()) {
qCWarning(MESSAGECOMPOSER_LOG) << "SendLater agent DBus call failed:" << reply.error().message();
setError(SendLaterJob::CallFailed);
setErrorText(getErrorString(SendLaterJob::CallFailed, reply.error().message()));
}
emitResult();
});
emitResult();
});
}
......@@ -28,8 +28,7 @@
class OrgFreedesktopAkonadiSendLaterAgentInterface;
namespace MessageComposer {
class MESSAGECOMPOSER_EXPORT SendLaterJob: public KJob
class MESSAGECOMPOSER_EXPORT SendLaterJob : public KJob
{
Q_OBJECT
public:
......@@ -45,7 +44,6 @@ public:
protected:
virtual QDBusPendingReply<> doCall(OrgFreedesktopAkonadiSendLaterAgentInterface *iface) = 0;
virtual QString getErrorString(Error error, const QString &desc) const = 0;
};
}
......
......@@ -27,7 +27,8 @@ using namespace MessageComposer;
SendLaterRemoveJob::SendLaterRemoveJob(Akonadi::Item::Id item, QObject *parent)
: SendLaterJob(parent)
, mItem(item)
{}
{
}
QDBusPendingReply<> SendLaterRemoveJob::doCall(OrgFreedesktopAkonadiSendLaterAgentInterface *iface)
{
......
......@@ -26,7 +26,6 @@
#include <AkonadiCore/Item>
namespace MessageComposer {
class MESSAGECOMPOSER_EXPORT SendLaterRemoveJob : public SendLaterJob
{
Q_OBJECT
......@@ -40,7 +39,6 @@ protected:
private:
Akonadi::Item::Id mItem;
};
}
#endif
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