Commit e756936d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent ca197857
......@@ -92,7 +92,7 @@ MessageFactoryNG::~MessageFactoryNG()
// Return the addresses to use when replying to the author of msg.
// See <https://cr.yp.to/proto/replyto.html>.
static KMime::Types::Mailbox::List authorMailboxes(
const KMime::Message::Ptr &msg, KMime::Types::Mailbox::List mailingLists)
const KMime::Message::Ptr &msg, const KMime::Types::Mailbox::List &mailingLists)
{
if (auto mrt = msg->headerByType("Mail-Reply-To")) {
return KMime::Types::Mailbox::listFrom7BitString(mrt->as7BitString(false));
......@@ -231,7 +231,7 @@ void MessageFactoryNG::createReplyAsync()
if (!m_mailingListAddresses.isEmpty()) {
toList = stripMyAddressesFromAddressList(m_origMsg->to()->mailboxes(), m_identityManager);
bool addMailingList = true;
for (const KMime::Types::Mailbox &m : m_mailingListAddresses) {
for (const KMime::Types::Mailbox &m : qAsConst(m_mailingListAddresses)) {
if (toList.contains(m)) {
addMailingList = false;
break;
......@@ -261,7 +261,7 @@ void MessageFactoryNG::createReplyAsync()
}
}
for (const KMime::Types::Mailbox &mailbox : ccList) {
for (const KMime::Types::Mailbox &mailbox : qAsConst(ccList)) {
msg->cc()->addAddress(mailbox);
}
}
......
......@@ -241,7 +241,7 @@ QString ConvertSnippetVariablesJob::convertVariables(MessageComposer::ComposerVi
return result;
}
QString ConvertSnippetVariablesJob::getNameFromEmail(QString address)
QString ConvertSnippetVariablesJob::getNameFromEmail(const QString &address)
{
const QStringList lst = address.split(QStringLiteral(", "));
QStringList resultName;
......@@ -258,7 +258,7 @@ QString ConvertSnippetVariablesJob::getNameFromEmail(QString address)
return str;
}
QString ConvertSnippetVariablesJob::getFirstNameFromEmail(QString address)
QString ConvertSnippetVariablesJob::getFirstNameFromEmail(const QString &address)
{
const QStringList lst = address.split(QStringLiteral(", "));
QStringList resultName;
......@@ -275,7 +275,7 @@ QString ConvertSnippetVariablesJob::getFirstNameFromEmail(QString address)
return str;
}
QString ConvertSnippetVariablesJob::getLastNameFromEmail(QString address)
QString ConvertSnippetVariablesJob::getLastNameFromEmail(const QString &address)
{
const QStringList lst = address.split(QStringLiteral(", "));
QStringList resultName;
......
......@@ -49,9 +49,9 @@ Q_SIGNALS:
private:
static Q_REQUIRED_RESULT QString convertVariables(const QString &cmd, int &i, QChar c);
static QString getFirstNameFromEmail(QString address);
static QString getLastNameFromEmail(QString address);
static QString getNameFromEmail(QString address);
static Q_REQUIRED_RESULT QString getFirstNameFromEmail(const QString &address);
static Q_REQUIRED_RESULT QString getLastNameFromEmail(const QString &address);
static Q_REQUIRED_RESULT QString getNameFromEmail(const QString &address);
QString mText;
MessageComposer::ComposerViewInterface *mComposerViewInterface = nullptr;
};
......
......@@ -2446,7 +2446,7 @@ void ModelPrivate::attachMessageToParent(Item *pParent, MessageItem *mi, AttachO
//
// When messages are added, mark it as dirty only (?)
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass5(ViewItemJob *job, const QElapsedTimer &elapsedTimer)
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass5(ViewItemJob *job, QElapsedTimer elapsedTimer)
{
// In this pass we scan the group headers that are in mGroupHeadersThatNeedUpdate.
// Empty groups get deleted while the other ones are re-sorted.
......@@ -2545,7 +2545,7 @@ ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass5
return ViewItemJobCompleted;
}
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass4(ViewItemJob *job, const QElapsedTimer &elapsedTimer)
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass4(ViewItemJob *job, QElapsedTimer elapsedTimer)
{
// In this pass we scan mUnassignedMessageListForPass4 which now
// contains both items with parents and items without parents.
......@@ -2586,7 +2586,7 @@ ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass4
return ViewItemJobCompleted;
}
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass3(ViewItemJob *job, const QElapsedTimer &elapsedTimer)
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass3(ViewItemJob *job, QElapsedTimer elapsedTimer)
{
// In this pass we scan the mUnassignedMessageListForPass3 and try to do construct the threads
// by using subject based threading. If subject based threading is not in effect then
......@@ -2667,7 +2667,7 @@ ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass3
return ViewItemJobCompleted;
}
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass2(ViewItemJob *job, const QElapsedTimer &elapsedTimer)
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass2(ViewItemJob *job, QElapsedTimer elapsedTimer)
{
// In this pass we scan the mUnassignedMessageList and try to do construct the threads.
// If some thread leader message got attached to the viewable tree in Pass1Fill then
......@@ -2782,7 +2782,7 @@ ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass2
return ViewItemJobCompleted;
}
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1Fill(ViewItemJob *job, const QElapsedTimer &elapsedTimer)
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1Fill(ViewItemJob *job, QElapsedTimer elapsedTimer)
{
// In this pass we scan the a contiguous region of the underlying storage (that is
// assumed to be FLAT) and create the corresponding MessageItem objects.
......@@ -3061,7 +3061,7 @@ ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1
return ViewItemJobCompleted;
}
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1Cleanup(ViewItemJob *job, const QElapsedTimer &elapsedTimer)
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1Cleanup(ViewItemJob *job, QElapsedTimer elapsedTimer)
{
Q_ASSERT(mModelForItemFunctions); // UI must be not disconnected here
// In this pass we remove the MessageItem objects that are present in the job
......@@ -3300,7 +3300,7 @@ ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1
return ViewItemJobCompleted;
}
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1Update(ViewItemJob *job, const QElapsedTimer &elapsedTimer)
ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1Update(ViewItemJob *job, QElapsedTimer elapsedTimer)
{
Q_ASSERT(mModelForItemFunctions); // UI must be not disconnected here
......
......@@ -82,13 +82,13 @@ public:
ViewItemJobResult viewItemJobStepInternalForJob(ViewItemJob *job, const QElapsedTimer &elapsedTimer);
// FIXME: Those look like they should be made virtual in some job class! -> Refactor
ViewItemJobResult viewItemJobStepInternalForJobPass1Fill(ViewItemJob *job, const QElapsedTimer &elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass1Cleanup(ViewItemJob *job, const QElapsedTimer &elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass1Update(ViewItemJob *job, const QElapsedTimer &elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass2(ViewItemJob *job, const QElapsedTimer &elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass3(ViewItemJob *job, const QElapsedTimer &elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass4(ViewItemJob *job, const QElapsedTimer &elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass5(ViewItemJob *job, const QElapsedTimer &elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass1Fill(ViewItemJob *job, QElapsedTimer elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass1Cleanup(ViewItemJob *job, QElapsedTimer elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass1Update(ViewItemJob *job, QElapsedTimer elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass2(ViewItemJob *job, QElapsedTimer elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass3(ViewItemJob *job, QElapsedTimer elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass4(ViewItemJob *job, QElapsedTimer elapsedTimer);
ViewItemJobResult viewItemJobStepInternalForJobPass5(ViewItemJob *job, QElapsedTimer elapsedTimer);
void clearJobList();
void clearUnassignedMessageLists();
void clearOrphanChildrenHash();
......
......@@ -73,20 +73,20 @@ void DKIMAuthenticationStatusInfoTest::shouldParseKey_data()
property.methodVersion = 1;
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("d");
prop.value = QLatin1String("kde.org");
prop.type = QStringLiteral("d");
prop.value = QStringLiteral("kde.org");
property.header.append(prop);
}
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("i");
prop.value = QLatin1String("@kde.org");
prop.type = QStringLiteral("i");
prop.value = QStringLiteral("@kde.org");
property.header.append(prop);
}
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("b");
prop.value = QLatin1String("\"GMG2ucPx\"");
prop.type = QStringLiteral("b");
prop.value = QStringLiteral("\"GMG2ucPx\"");
property.header.append(prop);
}
lst.append(property);
......@@ -98,20 +98,20 @@ void DKIMAuthenticationStatusInfoTest::shouldParseKey_data()
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("d");
prop.value = QLatin1String("kde.org");
prop.type = QStringLiteral("d");
prop.value = QStringLiteral("kde.org");
property2.header.append(prop);
}
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("i");
prop.value = QLatin1String("@kde.org");
prop.type = QStringLiteral("i");
prop.value = QStringLiteral("@kde.org");
property2.header.append(prop);
}
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("b");
prop.value = QLatin1String("\"I3t3p7Up\"");
prop.type = QStringLiteral("b");
prop.value = QStringLiteral("\"I3t3p7Up\"");
property2.header.append(prop);
}
lst.append(property2);
......@@ -162,8 +162,8 @@ void DKIMAuthenticationStatusInfoTest::shouldParseKey_data()
property.methodVersion = 1;
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("i");
prop.value = QLatin1String("@mail-router.example.net");
prop.type = QStringLiteral("i");
prop.value = QStringLiteral("@mail-router.example.net");
property.header.append(prop);
}
lst.append(property);
......@@ -177,8 +177,8 @@ void DKIMAuthenticationStatusInfoTest::shouldParseKey_data()
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("i");
prop.value = QLatin1String("@newyork.example.com");
prop.type = QStringLiteral("i");
prop.value = QStringLiteral("@newyork.example.com");
property2.header.append(prop);
}
lst.append(property2);
......@@ -206,8 +206,8 @@ void DKIMAuthenticationStatusInfoTest::shouldParseKey_data()
property.methodVersion = 1;
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("i");
prop.value = QLatin1String("@mail-router.example.net");
prop.type = QStringLiteral("i");
prop.value = QStringLiteral("@mail-router.example.net");
property.header.append(prop);
}
lst.append(property);
......@@ -221,8 +221,8 @@ void DKIMAuthenticationStatusInfoTest::shouldParseKey_data()
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("i");
prop.value = QLatin1String("@newyork.example.com");
prop.type = QStringLiteral("i");
prop.value = QStringLiteral("@newyork.example.com");
property2.header.append(prop);
}
lst.append(property2);
......@@ -246,8 +246,8 @@ void DKIMAuthenticationStatusInfoTest::shouldParseKey_data()
property.methodVersion = 1;
{
MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo::Property prop;
prop.type = QLatin1String("from");
prop.value = QLatin1String("gmail.com");
prop.type = QStringLiteral("from");
prop.value = QStringLiteral("gmail.com");
property.header.append(prop);
}
lst.append(property);
......
......@@ -59,7 +59,7 @@ QString MessageViewer::DKIMAuthenticationStatusInfoUtil::keyword_p()
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::subDomain_p()
{
// sub-domain as specified in Section 4.1.2 of RFC 5321 [SMTP].
return QStringLiteral("(?:%1%2?)").arg(DKIMAuthenticationStatusInfoUtil::letDig_p()).arg(DKIMAuthenticationStatusInfoUtil::ldhStr_p());
return QStringLiteral("(?:%1%2?)").arg(DKIMAuthenticationStatusInfoUtil::letDig_p(), DKIMAuthenticationStatusInfoUtil::ldhStr_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::obsFws_p()
......@@ -72,13 +72,13 @@ QString MessageViewer::DKIMAuthenticationStatusInfoUtil::quotedPair_p()
{
// quoted-pair as specified in Section 3.2.1 of RFC 5322
// Note: obs-qp is not included, so this pattern matches less then specified!
return QStringLiteral("(?:\\\\(?:%1|%2))").arg(vchar_p()).arg(wsp_p());
return QStringLiteral("(?:\\\\(?:%1|%2))").arg(vchar_p(), wsp_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::fws_p()
{
// FWS as specified in Section 3.2.2 of RFC 5322
return QStringLiteral("(?:(?:(?:%1*\r\n)?%1+)|%2)").arg(wsp_p()).arg(obsFws_p());
return QStringLiteral("(?:(?:(?:%1*\r\n)?%1+)|%2)").arg(wsp_p(), obsFws_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::fws_op()
......@@ -96,19 +96,19 @@ QString MessageViewer::DKIMAuthenticationStatusInfoUtil::ccontent_p()
{
// ccontent as specified in Section 3.2.2 of RFC 5322
// Note: comment is not included, so this pattern matches less then specified!
return QStringLiteral("(?:%1|%2)").arg(ctext_p()).arg(quotedPair_p());
return QStringLiteral("(?:%1|%2)").arg(ctext_p(), quotedPair_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::comment_p()
{
// comment as specified in Section 3.2.2 of RFC 5322
return QStringLiteral("\\((?:%1%2)*%1\\)").arg(fws_op()).arg(ccontent_p());
return QStringLiteral("\\((?:%1%2)*%1\\)").arg(fws_op(), ccontent_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::cfws_p()
{
// CFWS as specified in Section 3.2.2 of RFC 5322 [MAIL]
return QStringLiteral("(?:(?:(?:%1%2)+%1)|%3)").arg(fws_op()).arg(comment_p()).arg(fws_p());
return QStringLiteral("(?:(?:(?:%1%2)+%1)|%3)").arg(fws_op(), comment_p(), fws_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::cfws_op()
......@@ -132,7 +132,7 @@ QString MessageViewer::DKIMAuthenticationStatusInfoUtil::dotAtom_p()
{
// dot-atom as specified in Section 3.2.3 of RFC 5322
// dot-atom = [CFWS] dot-atom-text [CFWS]
return QStringLiteral("(?:%1%2%1)").arg(cfws_op()).arg(dotAtomText_p());
return QStringLiteral("(?:%1%2%1)").arg(cfws_op(), dotAtomText_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::qtext_p()
......@@ -151,19 +151,19 @@ QString MessageViewer::DKIMAuthenticationStatusInfoUtil::qcontent_p()
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::quotedString_p()
{
// quoted-string as specified in Section 3.2.4 of RFC 5322
return QStringLiteral("(?:%1\"(?:%2%3)*%2\"%1)").arg(cfws_op()).arg(fws_op()).arg(qcontent_p());
return QStringLiteral("(?:%1\"(?:%2%3)*%2\"%1)").arg(cfws_op(), fws_op(), qcontent_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::quotedString_cp()
{
return QStringLiteral("(?:%1\"((?:%2%3)*)%2\"%1)").arg(cfws_op()).arg(fws_op()).arg(qcontent_p());
return QStringLiteral("(?:%1\"((?:%2%3)*)%2\"%1)").arg(cfws_op(), fws_op(), qcontent_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::localPart_p()
{
// local-part as specified in Section 3.4.1 of RFC 5322
// Note: obs-local-part is not included, so this pattern matches less then specified!
return QStringLiteral("(?:%1|%2))").arg(dotAtom_p()).arg(quotedString_p());
return QStringLiteral("(?:%1|%2))").arg(dotAtom_p(), quotedString_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::token_p()
......@@ -175,12 +175,12 @@ QString MessageViewer::DKIMAuthenticationStatusInfoUtil::token_p()
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::value_p()
{
// "value" as specified in Section 5.1 of RFC 2045.
return QStringLiteral("(?:%1|%2)").arg(token_p()).arg(quotedString_p());
return QStringLiteral("(?:%1|%2)").arg(token_p(), quotedString_p());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::value_cp()
{
return QStringLiteral("(?:(%1)|%2)").arg(token_p()).arg(quotedString_cp());
return QStringLiteral("(?:(%1)|%2)").arg(token_p(), quotedString_cp());
}
QString MessageViewer::DKIMAuthenticationStatusInfoUtil::domainName_p()
......
......@@ -241,10 +241,10 @@ void DKIMCheckSignatureJob::computeHeaderCanonization(bool removeQuoteOnContentT
case MessageViewer::DKIMInfo::CanonicalizationType::Unknown:
return;
case MessageViewer::DKIMInfo::CanonicalizationType::Simple:
mHeaderCanonizationResult += QLatin1String("\r\n") + MessageViewer::DKIMUtil::headerCanonizationSimple(QLatin1String("dkim-signature"), dkimValue);
mHeaderCanonizationResult += QLatin1String("\r\n") + MessageViewer::DKIMUtil::headerCanonizationSimple(QStringLiteral("dkim-signature"), dkimValue);
break;
case MessageViewer::DKIMInfo::CanonicalizationType::Relaxed:
mHeaderCanonizationResult += QLatin1String("\r\n") + MessageViewer::DKIMUtil::headerCanonizationRelaxed(QLatin1String("dkim-signature"), dkimValue, removeQuoteOnContentType);
mHeaderCanonizationResult += QLatin1String("\r\n") + MessageViewer::DKIMUtil::headerCanonizationRelaxed(QStringLiteral("dkim-signature"), dkimValue, removeQuoteOnContentType);
break;
}
#ifdef DEBUG_SIGNATURE_DKIM
......
......@@ -85,9 +85,9 @@ void DKIMManagerKey::loadKeys()
mKeys.clear();
for (const QString &groupName : keyGroups) {
KConfigGroup group = config->group(groupName);
const QString selector = group.readEntry(QLatin1String("Selector"), QString());
const QString domain = group.readEntry(QLatin1String("Domain"), QString());
const QString key = group.readEntry(QLatin1String("Key"), QString());
const QString selector = group.readEntry(QStringLiteral("Selector"), QString());
const QString domain = group.readEntry(QStringLiteral("Domain"), QString());
const QString key = group.readEntry(QStringLiteral("Key"), QString());
mKeys.append(KeyInfo{key, selector, domain});
}
}
......
......@@ -86,7 +86,7 @@ DKIMManageRulesWidget::DKIMManageRulesWidget(QWidget *parent)
mainLayout->addWidget(searchLineEdit);
mainLayout->addWidget(mTreeWidget);
connect(mTreeWidget, &QTreeWidget::customContextMenuRequested, this, &DKIMManageRulesWidget::customContextMenuRequested);
connect(mTreeWidget, &QTreeWidget::customContextMenuRequested, this, &DKIMManageRulesWidget::slotCustomContextMenuRequested);
connect(mTreeWidget, &QTreeWidget::itemDoubleClicked, this, [this](QTreeWidgetItem *item) {
if (item) {
DKIMManageRulesWidgetItem *rulesItem = dynamic_cast<DKIMManageRulesWidgetItem *>(item);
......@@ -172,7 +172,7 @@ void DKIMManageRulesWidget::modifyRule(DKIMManageRulesWidgetItem *rulesItem)
delete dlg;
}
void DKIMManageRulesWidget::customContextMenuRequested(const QPoint &pos)
void DKIMManageRulesWidget::slotCustomContextMenuRequested(const QPoint &pos)
{
Q_UNUSED(pos);
QTreeWidgetItem *item = mTreeWidget->currentItem();
......
......@@ -73,7 +73,7 @@ public:
void addRule();
private:
void modifyRule(DKIMManageRulesWidgetItem *rulesItem);
void customContextMenuRequested(const QPoint &);
void slotCustomContextMenuRequested(const QPoint &);
void duplicateRule(DKIMManageRulesWidgetItem *rulesItem);
QTreeWidget *mTreeWidget = nullptr;
};
......
......@@ -44,10 +44,10 @@ QString MessageViewer::DKIMUtil::bodyCanonizationRelaxed(QString body)
mechanisms.)
*/
body.replace(QLatin1String("\n"), QLatin1String("\r\n"));
body.replace(QRegularExpression(QLatin1String("[ \t]+\r\n")), QLatin1String("\r\n"));
body.replace(QRegularExpression(QLatin1String("[ \t]+")), QStringLiteral(" "));
body.replace(QRegularExpression(QLatin1String("((\r\n)+?)$")), QLatin1String("\r\n"));
body.replace(QStringLiteral("\n"), QStringLiteral("\r\n"));
body.replace(QRegularExpression(QStringLiteral("[ \t]+\r\n")), QStringLiteral("\r\n"));
body.replace(QRegularExpression(QStringLiteral("[ \t]+")), QStringLiteral(" "));
body.replace(QRegularExpression(QStringLiteral("((\r\n)+?)$")), QStringLiteral("\r\n"));
if (body == QLatin1String("\r\n")) {
body.clear();
}
......@@ -66,13 +66,13 @@ QString MessageViewer::DKIMUtil::bodyCanonizationSimple(QString body)
// Note that a completely empty or missing body is canonicalized as a
// single "CRLF"; that is, the canonicalized length will be 2 octets.
body.replace(QLatin1String("\n"), QLatin1String("\r\n"));
body.replace(QRegularExpression(QLatin1String("((\r\n)+)?$")), QLatin1String("\r\n"));
body.replace(QStringLiteral("\n"), QStringLiteral("\r\n"));
body.replace(QRegularExpression(QStringLiteral("((\r\n)+)?$")), QStringLiteral("\r\n"));
if (body.endsWith(QLatin1String("\r\n"))) { //Remove it from start
body.chop(2);
}
if (body.isEmpty()) {
body = QLatin1String("\r\n");
body = QStringLiteral("\r\n");
}
return body;
}
......
......@@ -150,8 +150,8 @@ QString KXFace::fromImage(const QImage &image)
tmp[i - 1] = t;
}
}
tmp.replace(QRegularExpression(QLatin1String("(\\w{12})")), QStringLiteral("\\1\n"));
tmp.replace(QRegularExpression(QLatin1String("(\\w{4})")), QStringLiteral("0x\\1,"));
tmp.replace(QRegularExpression(QStringLiteral("(\\w{12})")), QStringLiteral("\\1\n"));
tmp.replace(QRegularExpression(QStringLiteral("(\\w{4})")), QStringLiteral("0x\\1,"));
len = tmp.length();
char *fbuf = (char *)malloc(len + 1);
strncpy(fbuf, tmp.toLatin1().constData(), len);
......
......@@ -73,7 +73,7 @@ void BodyPartFormatterFactoryPrivate::insert(const QString &mimeType, const Inte
auto &v = registry[mt.isValid() ? mt.name() : mimeType];
v.push_back(info);
std::stable_sort(v.begin(), v.end(), [](const FormatterInfo &lhs, const FormatterInfo &rhs) {
std::stable_sort(v.begin(), v.end(), [](FormatterInfo lhs, FormatterInfo rhs) {
return lhs.priority > rhs.priority;
});
}
......
......@@ -116,7 +116,7 @@ void AttachmentTemporaryFilesDirsTest::shouldCreateDeleteTemporaryFiles()
attachmentDir.addTempDir(tmpDir.path());
attachmentDir.addTempFile(file.fileName());
QVERIFY(!attachmentDir.temporaryFiles().isEmpty());
QCOMPARE(attachmentDir.temporaryFiles().first(), file.fileName());
QCOMPARE(attachmentDir.temporaryFiles().constFirst(), file.fileName());
const QString path = tmpDir.path();
attachmentDir.forceCleanTempFiles();
QCOMPARE(attachmentDir.temporaryFiles().count(), 0);
......@@ -140,7 +140,7 @@ void AttachmentTemporaryFilesDirsTest::shouldRemoveTemporaryFilesAfterTime()
attachmentDir.addTempDir(tmpDir.path());
attachmentDir.addTempFile(file.fileName());
QVERIFY(!attachmentDir.temporaryFiles().isEmpty());
QCOMPARE(attachmentDir.temporaryFiles().first(), file.fileName());
QCOMPARE(attachmentDir.temporaryFiles().constFirst(), file.fileName());
attachmentDir.setDelayRemoveAllInMs(500);
QTest::qSleep(1000);
attachmentDir.removeTempFiles();
......
......@@ -689,7 +689,7 @@ void TemplateParserJob::slotExtractInfoDone(const TemplateParserExtractHtmlInfoR
// insert specified content of header from current message
qCDebug(TEMPLATEPARSER_LOG) << "Command: HEADER(";
QRegularExpressionMatch match;
const int res = cmd.indexOf(QRegularExpression(QLatin1String("^HEADER\\((.+)\\)")), 0, &match);
const int res = cmd.indexOf(QRegularExpression(QStringLiteral("^HEADER\\((.+)\\)")), 0, &match);
if (res != 0) {
// something wrong
i += strlen("HEADER( ");
......
......@@ -210,7 +210,7 @@ QString TemplateParser::Util::removeSpaceAtBegin(const QString &selection)
{
QString content = selection;
// Remove blank lines at the beginning:
const int firstNonWS = content.indexOf(QRegularExpression(QLatin1String("\\S")));
const int firstNonWS = content.indexOf(QRegularExpression(QStringLiteral("\\S")));
const int lineStart = content.lastIndexOf(QLatin1Char('\n'), firstNonWS);
if (lineStart >= 0) {
content.remove(0, lineStart);
......
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