Commit 6ab1446c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some clazy warning

parent f5f77dc7
Pipeline #45503 passed with stage
in 45 minutes and 20 seconds
......@@ -127,7 +127,7 @@ void CryptoComposerTest::testEncryptSameAttachments()
VERIFYEXEC(composer);
QCOMPARE(composer->resultMessages().size(), 1);
KMime::Message::Ptr message = composer->resultMessages().first();
KMime::Message::Ptr message = composer->resultMessages().constFirst();
delete composer;
composer = nullptr;
......@@ -249,7 +249,7 @@ void CryptoComposerTest::testEditEncryptAndLateAttachments()
VERIFYEXEC(composer);
QCOMPARE(composer->resultMessages().size(), 1);
KMime::Message::Ptr message = composer->resultMessages().first();
KMime::Message::Ptr message = composer->resultMessages().constFirst();
delete composer;
composer = nullptr;
......@@ -306,7 +306,7 @@ void CryptoComposerTest::testSignEncryptLateAttachments()
VERIFYEXEC(composer);
QCOMPARE(composer->resultMessages().size(), 1);
KMime::Message::Ptr message = composer->resultMessages().first();
KMime::Message::Ptr message = composer->resultMessages().constFirst();
delete composer;
composer = nullptr;
......@@ -365,7 +365,7 @@ void CryptoComposerTest::testBCCEncrypt()
VERIFYEXEC(composer);
QCOMPARE(composer->resultMessages().size(), 2);
KMime::Message::Ptr primMessage = composer->resultMessages().first();
KMime::Message::Ptr primMessage = composer->resultMessages().constFirst();
KMime::Message::Ptr secMessage = composer->resultMessages()[1];
delete composer;
composer = nullptr;
......@@ -415,7 +415,7 @@ void CryptoComposerTest::testOpenPGPInline()
VERIFYEXEC(composer);
QCOMPARE(composer->resultMessages().size(), 1);
KMime::Message::Ptr message = composer->resultMessages().first();
KMime::Message::Ptr message = composer->resultMessages().constFirst();
delete composer;
composer = nullptr;
......@@ -581,7 +581,7 @@ void CryptoComposerTest::runSMIMETest(bool sign, bool enc, bool opaque)
QVERIFY(result);
if (result) {
QCOMPARE(composer->resultMessages().size(), 1);
KMime::Message::Ptr message = composer->resultMessages().first();
KMime::Message::Ptr message = composer->resultMessages().constFirst();
delete composer;
composer = nullptr;
......
......@@ -429,7 +429,7 @@ void MessageFactoryTest::testCreateReplyAllWithMultiEmailsAsync()
"Content-Transfer-Encoding: 8Bit\nMIME-Version: 1.0\n"
"X-KMail-Link-Message: 0\n"
"X-KMail-Link-Type: reply\n\n> All happy families are alike; each unhappy family is unhappy in its own way.")
.arg(dateStr).arg(replyTo).arg(reference);
.arg(dateStr, replyTo, reference);
QCOMPARE_OR_DIFF(reply.msg->encodedContent(), ba.toLatin1());
msg.clear();
}
......@@ -636,11 +636,11 @@ void MessageFactoryTest::testCreateRedirectToAndCCAndBCC()
QString datetime = rdir->date()->asUnicodeString();
const QRegularExpression rx(QLatin1String("Resent-Message-ID: ([^\n]*)"));
const QRegularExpression rx(QStringLiteral("Resent-Message-ID: ([^\n]*)"));
const QRegularExpressionMatch rxMatch = rx.match(QString::fromLatin1(rdir->head()));
QVERIFY(rxMatch.hasMatch());
const QRegularExpression rxmessageid(QLatin1String("Message-ID: ([^\n]+)"));
const QRegularExpression rxmessageid(QStringLiteral("Message-ID: ([^\n]+)"));
const QRegularExpressionMatch rxmessageidMatch = rxmessageid.match(QString::fromLatin1(rdir->head()));
QVERIFY(rxmessageidMatch.hasMatch());
......@@ -685,11 +685,11 @@ void MessageFactoryTest::testCreateRedirectToAndCC()
QString datetime = rdir->date()->asUnicodeString();
const QRegularExpression rx(QLatin1String("Resent-Message-ID: ([^\n]*)"));
const QRegularExpression rx(QStringLiteral("Resent-Message-ID: ([^\n]*)"));
const QRegularExpressionMatch rxMatch = rx.match(QString::fromLatin1(rdir->head()));
QVERIFY(rxMatch.hasMatch());
const QRegularExpression rxmessageid(QLatin1String("Message-ID: ([^\n]+)"));
const QRegularExpression rxmessageid(QStringLiteral("Message-ID: ([^\n]+)"));
const QRegularExpressionMatch rxmessageidMatch = rxmessageid.match(QString::fromLatin1(rdir->head()));
QVERIFY(rxmessageidMatch.hasMatch());
......@@ -778,11 +778,11 @@ void MessageFactoryTest::testCreateResend()
QString datetime = rdir->date()->asUnicodeString();
const QRegularExpression rx(QLatin1String("Resent-Message-ID: ([^\n]*)"));
const QRegularExpression rx(QStringLiteral("Resent-Message-ID: ([^\n]*)"));
const QRegularExpressionMatch rxMatch = rx.match(QString::fromLatin1(rdir->head()));
QVERIFY(!rxMatch.hasMatch());
const QRegularExpression rxmessageid(QLatin1String("Message-ID: ([^\n]+)"));
const QRegularExpression rxmessageid(QStringLiteral("Message-ID: ([^\n]+)"));
const QRegularExpressionMatch rxmessageidMatch = rxmessageid.match(QString::fromLatin1(rdir->head()));
QVERIFY(rxmessageidMatch.hasMatch());
......@@ -822,7 +822,7 @@ void MessageFactoryTest::testCreateMDN()
QString mdnContent = QString::fromLatin1("The message sent on %1 to %2 with subject \"%3\" has been displayed. "
"This is no guarantee that the message has been read or understood.");
mdnContent = mdnContent.arg(KMime::DateFormatter::formatDate(KMime::DateFormatter::Localized, msg->date()->dateTime().toSecsSinceEpoch()))
.arg(msg->to()->asUnicodeString()).arg(msg->subject()->asUnicodeString());
.arg(msg->to()->asUnicodeString(), msg->subject()->asUnicodeString());
QCOMPARE_OR_DIFF(Util::findTypeInMessage(mdn.data(), "multipart", "report")->contents().at(0)->body(),
mdnContent.toLatin1());
......@@ -834,9 +834,9 @@ KMime::Message::Ptr MessageFactoryTest::createPlainTestMessage()
auto *composer = new Composer;
composer->globalPart()->setFallbackCharsetEnabled(true);
composer->infoPart()->setFrom(QStringLiteral("me@me.me"));
composer->infoPart()->setTo(QStringList(QLatin1String("you@you.you")));
composer->infoPart()->setCc(QStringList(QLatin1String("cc@cc.cc")));
composer->infoPart()->setBcc(QStringList(QLatin1String("bcc@bcc.bcc")));
composer->infoPart()->setTo(QStringList(QStringLiteral("you@you.you")));
composer->infoPart()->setCc(QStringList(QStringLiteral("cc@cc.cc")));
composer->infoPart()->setBcc(QStringList(QStringLiteral("bcc@bcc.bcc")));
composer->textPart()->setWrappedPlainText(QStringLiteral("All happy families are alike; each unhappy family is unhappy in its own way."));
composer->infoPart()->setSubject(QStringLiteral("Test Email Subject"));
composer->globalPart()->setMDNRequested(true);
......@@ -863,7 +863,7 @@ KMime::Message::Ptr MessageFactoryTest::createPlainTestMessageWithMultiEmails()
composer->globalPart()->setMDNRequested(true);
composer->exec();
KMime::Message::Ptr message = KMime::Message::Ptr(composer->resultMessages().first());
const KMime::Message::Ptr message = KMime::Message::Ptr(composer->resultMessages().constFirst());
delete composer;
MessageComposerSettings::self()->setPreferredCharsets(QStringList() << QStringLiteral("us-ascii") << QStringLiteral("iso-8859-1") << QStringLiteral("utf-8"));
......
......@@ -548,7 +548,6 @@ QList< ModelInvariantIndex * > *ModelInvariantRowMapper::modelRowsRemoved(int mo
void ModelInvariantRowMapper::modelReset()
{
// FIXME: optimize this (it probably can be optimized by providing a more complex user interface)
QHash< int, ModelInvariantIndex * >::ConstIterator end(d->mCurrentInvariantHash->constEnd());
for (const auto idx : qAsConst(*d->mCurrentInvariantHash)) {
idx->d->setRowMapper(nullptr);
......
......@@ -2457,7 +2457,7 @@ bool View::event(QEvent *e)
"</div>" \
"</td>" \
"</tr>"
).arg(txtColorName).arg(bckColorName).arg(ghi->label()).arg(textDirection);
).arg(txtColorName, bckColorName, ghi->label(), textDirection);
QString description;
......@@ -2599,7 +2599,7 @@ bool View::event(QEvent *e)
"%1" \
"</td>" \
"</tr>"
).arg(description).arg(textDirection);
).arg(description, textDirection);
}
if (ghi->hasChildren()) {
......
......@@ -117,7 +117,8 @@ void MessagePartRendererManager::initializeRenderer()
Grantlee::registerMetaType<const QGpgME::Protocol *>();
Grantlee::registerMetaType<std::pair<GpgME::DecryptionResult::Recipient, GpgME::Key> >();
m_engine = new GrantleeTheme::Engine;
for (const auto &p : QCoreApplication::libraryPaths()) {
const auto libraryPaths = QCoreApplication::libraryPaths();
for (const auto &p : libraryPaths) {
m_engine->addPluginPath(p + QStringLiteral("/messageviewer"));
}
m_engine->addDefaultLibrary(QStringLiteral("messageviewer_grantlee_extension"));
......
......@@ -31,7 +31,7 @@ RemoteContentInfo::RemoteContentInfoStatus RemoteContentInfo::status() const
return mStatus;
}
void RemoteContentInfo::setStatus(const RemoteContentInfoStatus &status)
void RemoteContentInfo::setStatus(RemoteContentInfoStatus status)
{
mStatus = status;
}
......
......@@ -30,7 +30,7 @@ public:
void setUrl(const QString &url);
Q_REQUIRED_RESULT RemoteContentInfoStatus status() const;
void setStatus(const RemoteContentInfoStatus &status);
void setStatus(MessageViewer::RemoteContentInfo::RemoteContentInfoStatus status);
Q_REQUIRED_RESULT bool isValid() const;
......
......@@ -132,7 +132,7 @@ void Viewer::setMessageItem(const Akonadi::Item &item, MimeTreeParser::UpdateMod
d->setMessageItem(item, updateMode);
} else {
Akonadi::ItemFetchJob *job = createFetchJob(item);
connect(job, &Akonadi::ItemFetchJob::result, [ d](KJob *job) {
connect(job, &Akonadi::ItemFetchJob::result, [d](KJob *job) {
d->itemFetchResult(job);
});
d->displaySplashPage(i18n("Loading message..."));
......
......@@ -422,7 +422,7 @@ void CreateDatabaseFileJobTest::shouldUpdateDataBase()
QCOMPARE(spy4.count(), 1);
successCreateDataBase = spy4.at(0).at(0).toBool();
QEXPECT_FAIL("successCreateDataBase", "Expected a success but not", Continue);
//QVERIFY(successCreateDataBase);
QVERIFY(successCreateDataBase);
}
QTEST_MAIN(CreateDatabaseFileJobTest)
......@@ -30,7 +30,7 @@ public:
QAction *mZoomOutAction = nullptr;
QAction *mZoomResetAction = nullptr;
KActionCollection *mActionCollection = nullptr;
KActionMenu *const q = nullptr;
KActionMenu *const q;
};
ZoomActionMenu::ZoomActionMenu(QObject *parent)
......
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