Commit d9604d7b authored by Laurent Montel's avatar Laurent Montel 😁

Fix clazy warning

parent 16bc00ce
Pipeline #29653 passed with stage
in 70 minutes and 19 seconds
......@@ -413,8 +413,6 @@ void MessageFactoryTest::testCreateReplyAllWithMultiEmailsAsync()
QDateTime date = msg->date()->dateTime();
QString datetime = QLocale::system().toString(date.date(), QLocale::LongFormat);
datetime += QLatin1Char(' ') + QLocale::system().toString(date.time(), QLocale::LongFormat);
QString replyStr
= QString::fromLatin1(QByteArray(QByteArray("On ") + datetime.toLatin1() + QByteArray(" you wrote:\n> All happy families are alike; each unhappy family is unhappy in its own way.\n\n")));
QCOMPARE(reply.msg->subject()->asUnicodeString(), QLatin1String("Re: Test Email Subject"));
QString replyTo = reply.msg->inReplyTo()->asUnicodeString();
......
......@@ -59,7 +59,7 @@ void RecipientsEditorTest::test_addLineOnCommaPress()
QTest::keyClicks(lineEdit, QStringLiteral("\"Vratil, Daniel\" <dvratil@kde.org>"), Qt::NoModifier, 10);
QCOMPARE(editor.recipients().size(), 1);
QCOMPARE(editor.recipients().first()->email(), QStringLiteral("\"Vratil, Daniel\" <dvratil@kde.org>"));
QCOMPARE(editor.recipients().constFirst()->email(), QStringLiteral("\"Vratil, Daniel\" <dvratil@kde.org>"));
QTest::keyClick(lineEdit, Qt::Key_Comma, Qt::NoModifier, 0);
......
......@@ -173,7 +173,7 @@ void AttachmentControllerBase::Private::compressJobResult(KJob *job)
return;
}
AttachmentCompressJob *ajob = dynamic_cast<AttachmentCompressJob *>(job);
AttachmentCompressJob *ajob = qobject_cast<AttachmentCompressJob *>(job);
Q_ASSERT(ajob);
AttachmentPart::Ptr originalPart = ajob->originalPart();
AttachmentPart::Ptr compressedPart = ajob->compressedPart();
......@@ -207,7 +207,7 @@ void AttachmentControllerBase::Private::loadJobResult(KJob *job)
return;
}
AttachmentLoadJob *ajob = dynamic_cast<AttachmentLoadJob *>(job);
AttachmentLoadJob *ajob = qobject_cast<AttachmentLoadJob *>(job);
Q_ASSERT(ajob);
AttachmentPart::Ptr part = ajob->attachmentPart();
q->addAttachment(part);
......@@ -238,7 +238,7 @@ void AttachmentControllerBase::Private::editSelectedAttachment()
void AttachmentControllerBase::Private::editSelectedAttachmentWith()
{
Q_ASSERT(selectedParts.count() == 1);
q->editAttachment(selectedParts.first(), MessageViewer::EditorWatcher::OpenWithDialog);
q->editAttachment(selectedParts.constFirst(), MessageViewer::EditorWatcher::OpenWithDialog);
}
void AttachmentControllerBase::Private::removeSelectedAttachments()
......@@ -279,7 +279,7 @@ void AttachmentControllerBase::Private::updateJobResult(KJob *job)
KMessageBox::sorry(wParent, job->errorString(), i18n("Failed to reload attachment"));
return;
}
AttachmentUpdateJob *ajob = dynamic_cast<AttachmentUpdateJob *>(job);
AttachmentUpdateJob *ajob = qobject_cast<AttachmentUpdateJob *>(job);
Q_ASSERT(ajob);
AttachmentPart::Ptr originalPart = ajob->originalPart();
AttachmentPart::Ptr updatedPart = ajob->updatedPart();
......
......@@ -94,7 +94,7 @@ void ProtectedHeadersJob::doStart()
// and we want to use that
if (!d->content || !d->content->hasContent()) {
Q_ASSERT(d->subjobContents.size() == 1);
d->content = d->subjobContents.first();
d->content = d->subjobContents.constFirst();
}
mixedPart->addContent(d->content);
......@@ -114,7 +114,7 @@ void ProtectedHeadersJob::process()
// and we want to use that
if (!d->content || !d->content->hasContent()) {
Q_ASSERT(d->subjobContents.size() == 1);
d->content = d->subjobContents.first();
d->content = d->subjobContents.constFirst();
}
auto subject = d->skeletonMessage->header<KMime::Headers::Subject>();
......
......@@ -188,7 +188,7 @@ void SignEncryptJob::slotResult(KJob *job)
if (subjobs().size() == 2) {
auto pjob = static_cast<ProtectedHeadersJob *>(subjobs().last());
if (pjob) {
auto cjob = dynamic_cast<ContentJobBase *>(job);
auto cjob = qobject_cast<ContentJobBase *>(job);
Q_ASSERT(cjob);
pjob->setContent(cjob->content());
}
......
......@@ -65,7 +65,7 @@ QVector<PluginActionType> PluginEditorConvertTextInterface::actionTypes() const
return d->mActionTypes;
}
void PluginEditorConvertTextInterface::addActionType(const PluginActionType &type)
void PluginEditorConvertTextInterface::addActionType(PluginActionType type)
{
d->mActionTypes += type;
}
......
......@@ -50,7 +50,7 @@ public:
void setRichTextEditor(KPIMTextEdit::RichTextComposer *richTextEditor);
void setActionType(const QVector<PluginActionType> &type);
void addActionType(const PluginActionType &type);
void addActionType(PluginActionType type);
Q_REQUIRED_RESULT QVector<PluginActionType> actionTypes() const;
virtual void createAction(KActionCollection *ac);
......
......@@ -2441,7 +2441,7 @@ bool View::event(QEvent *e)
"<nobr>%2</nobr>" \
"</td>" \
"</tr>"
).arg(darkerColorName).arg(statsText).arg(textDirection);
).arg(darkerColorName, statsText, textDirection);
}
break;
......
......@@ -343,7 +343,8 @@ QString DKIMCheckSignatureJob::headerCanonizationRelaxed(bool removeQuoteOnConte
QString headers;
DKIMHeaderParser parser = mHeaderParser;
for (const QString &header : mDkimInfo.listSignedHeader()) {
const auto listSignedHeader = mDkimInfo.listSignedHeader();
for (const QString &header : listSignedHeader) {
const QString str = parser.headerType(header.toLower());
if (!str.isEmpty()) {
if (!headers.isEmpty()) {
......
......@@ -81,7 +81,7 @@ bool DKIMInfo::parseDKIM(const QString &header)
mVersion = 1;
}
if (mQuery.isEmpty()) {
mQuery = QLatin1String("dns/txt");
mQuery = QStringLiteral("dns/txt");
}
if (mAgentOrUserIdentifier.isEmpty()) {
mAgentOrUserIdentifier = QLatin1Char('@') + mDomain;
......
......@@ -98,6 +98,7 @@ void DKIMManagerKeyWidget::loadKeys()
void DKIMManagerKeyWidget::saveKeys()
{
QVector<MessageViewer::KeyInfo> lst;
lst.reserve(mTreeWidget->topLevelItemCount());
for (int i = 0, total = mTreeWidget->topLevelItemCount(); i < total; ++i) {
QTreeWidgetItem *item = mTreeWidget->topLevelItem(i);
const MessageViewer::KeyInfo info {item->text(2), item->text(1), item->text(0)};
......
......@@ -700,7 +700,8 @@ void DefaultRendererPrivate::render(const AlternativeMessagePart::Ptr &mp, HtmlW
auto mode = mp->preferredMode();
if (mode == MimeTreeParser::Util::MultipartPlain && mp->text().trimmed().isEmpty()) {
for (const auto m : mp->availableModes()) {
const auto availableModes = mp->availableModes();
for (const auto m : availableModes) {
if (m != MimeTreeParser::Util::MultipartPlain) {
mode = m;
break;
......
......@@ -61,7 +61,7 @@ void CidUrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
} else if (urlRequestUrl.url() == QLatin1String("cid:local_src")) {
qDebug() << " from local file";
#ifdef LOAD_FROM_FILE
QImage image(QLatin1String(PICSRC "/audio-volume-medium.png"));
QImage image(QStringLiteral(PICSRC "/audio-volume-medium.png"));
QByteArray ba;
QBuffer buf(&ba);
image.save(&buf, "png");
......
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