Commit 4579ea34 authored by Laurent Montel's avatar Laurent Montel 😁

Use QLatin1String

parent 47554af6
......@@ -597,9 +597,9 @@ void AttachmentControllerBase::showContextMenu()
if ((mimetype == QLatin1String("text/plain"))
|| (mimetype == QLatin1String("image/png"))
|| (mimetype == QLatin1String("image/jpeg"))
|| parentMimeType.contains(QStringLiteral("text/plain"))
|| parentMimeType.contains(QStringLiteral("image/png"))
|| parentMimeType.contains(QStringLiteral("image/jpeg"))
|| parentMimeType.contains(QLatin1String("text/plain"))
|| parentMimeType.contains(QLatin1String("image/png"))
|| parentMimeType.contains(QLatin1String("image/jpeg"))
) {
menu.addAction(d->viewContextAction);
}
......
......@@ -132,7 +132,7 @@ void MessageFactoryNG::createReplyAsync()
if (auto hdr = m_origMsg->headerByType("List-Post")) {
const QString hdrListPost = hdr->asUnicodeString();
if (hdrListPost.contains(QStringLiteral("mailto:"), Qt::CaseInsensitive)) {
if (hdrListPost.contains(QLatin1String("mailto:"), Qt::CaseInsensitive)) {
QRegExp rx(QStringLiteral("<mailto:([^@>]+)@([^>]+)>"), Qt::CaseInsensitive);
if (rx.indexIn(hdrListPost, 0) != -1) { // matched
KMime::Types::Mailbox mailbox;
......@@ -938,7 +938,7 @@ bool MessageFactoryNG::MDNMDNUnknownOption(const KMime::Message::Ptr &msg)
if (auto hrd = msg->headerByType("Disposition-Notification-Options")) {
notificationOptions = hrd->asUnicodeString();
}
if (notificationOptions.contains(QStringLiteral("required"), Qt::CaseSensitive)) {
if (notificationOptions.contains(QLatin1String("required"), Qt::CaseSensitive)) {
// ### hacky; should parse...
// There is a required option that we don't understand. We need to
// ask the user what we should do:
......
......@@ -77,7 +77,7 @@ private:
bool PluginEditorManagerPrivate::initializePlugins()
{
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("kmail"), [](const KPluginMetaData &md) {
return md.serviceTypes().contains(QStringLiteral("KMailEditor/Plugin"));
return md.serviceTypes().contains(QLatin1String("KMailEditor/Plugin"));
});
const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(configGroupName(), configPrefixSettingKey());
......
......@@ -89,7 +89,7 @@ QVector<PimCommon::PluginUtilData> PluginEditorCheckBeforeSendManagerPrivate::pl
bool PluginEditorCheckBeforeSendManagerPrivate::initializePlugins()
{
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("kmail"), [](const KPluginMetaData &md) {
return md.serviceTypes().contains(QStringLiteral("KMailEditor/PluginCheckBeforeSend"));
return md.serviceTypes().contains(QLatin1String("KMailEditor/PluginCheckBeforeSend"));
});
const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(configGroupName(), configPrefixSettingKey());
......
......@@ -89,7 +89,7 @@ QVector<PimCommon::PluginUtilData> PluginEditorInitManagerPrivate::pluginsDataLi
bool PluginEditorInitManagerPrivate::initializePlugins()
{
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("kmail"), [](const KPluginMetaData &md) {
return md.serviceTypes().contains(QStringLiteral("KMailEditor/PluginEditorInit"));
return md.serviceTypes().contains(QLatin1String("KMailEditor/PluginEditorInit"));
});
const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(configGroupName(), configPrefixSettingKey());
......
......@@ -176,7 +176,7 @@ void ContactDisplayMessageMemento::processAddress(const KContacts::Addressee &ad
{
const QStringList customs = addressee.customs();
for (const QString &custom : customs) {
if (custom.contains(QStringLiteral("MailPreferedFormatting"))) {
if (custom.contains(QLatin1String("MailPreferedFormatting"))) {
const QString value
= addressee.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral(
"MailPreferedFormatting"));
......@@ -187,7 +187,7 @@ void ContactDisplayMessageMemento::processAddress(const KContacts::Addressee &ad
} else {
mForceDisplayTo = Viewer::UseGlobalSetting;
}
} else if (custom.contains(QStringLiteral("MailAllowToRemoteContent"))) {
} else if (custom.contains(QLatin1String("MailAllowToRemoteContent"))) {
const QString value
= addressee.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral(
"MailAllowToRemoteContent"));
......
......@@ -92,7 +92,7 @@ void HeaderStylePluginManagerPrivate::initializePluginList()
const QVector<KPluginMetaData> plugins
= KPluginLoader::findPlugins(QStringLiteral("messageviewer"), [](
const KPluginMetaData &md) {
return md.serviceTypes().contains(QStringLiteral("MessageViewerHeaderStyle/Plugin"));
return md.serviceTypes().contains(QLatin1String("MessageViewerHeaderStyle/Plugin"));
});
QVectorIterator<KPluginMetaData> i(plugins);
......
......@@ -205,7 +205,7 @@ void ObjectTreeParserTester::test_HTML()
otp.parseObjectTree(msg.data());
QCOMPARE(otp.plainTextContent().toLatin1().data(), "Some HTML text");
QVERIFY(otp.htmlContent().contains(QStringLiteral(
QVERIFY(otp.htmlContent().contains(QLatin1String(
"Some <span style=\" font-weight:600;\">HTML</span> text")));
QCOMPARE(otp.htmlContentCharset().data(), "windows-1252");
}
......@@ -245,7 +245,7 @@ void ObjectTreeParserTester::test_HTMLOnly()
otp.parseObjectTree(msg.data());
QVERIFY(otp.plainTextContent().isEmpty());
QVERIFY(otp.htmlContent().contains(QStringLiteral("<b>SOME</b> HTML text.")));
QVERIFY(otp.htmlContent().contains(QLatin1String("<b>SOME</b> HTML text.")));
}
void ObjectTreeParserTester::test_HTMLOnlyText()
......@@ -266,7 +266,7 @@ void ObjectTreeParserTester::test_HTMLOnlyText()
testWriter.end();
QVERIFY(otp.plainTextContent().isEmpty());
QVERIFY(otp.htmlContent().contains(QStringLiteral("<b>SOME</b> HTML text.")));
QVERIFY(otp.htmlContent().contains(QLatin1String("<b>SOME</b> HTML text.")));
QVERIFY(testWriter.data().contains("This is an HTML message. For security reasons, only the raw HTML code is shown."));
QVERIFY(testWriter.data().contains("SOME* HTML text. <br>"));
}
......@@ -289,7 +289,7 @@ void ObjectTreeParserTester::test_HTMLExternal()
testWriter.end();
QVERIFY(otp.plainTextContent().isEmpty());
QVERIFY(otp.htmlContent().contains(QStringLiteral("<b>SOME</b> HTML text.")));
QVERIFY(otp.htmlContent().contains(QLatin1String("<b>SOME</b> HTML text.")));
QVERIFY(testWriter.data().contains("<b>SOME</b> HTML text."));
QVERIFY(testWriter.data().contains("This HTML message may contain external references to images etc. For security/privacy reasons external references are not loaded."));
}
......@@ -304,7 +304,7 @@ void ObjectTreeParserTester::test_HTMLExternal()
otp.parseObjectTree(msg.data());
testWriter.end();
QVERIFY(otp.htmlContent().contains(QStringLiteral("<b>SOME</b> HTML text.")));
QVERIFY(otp.htmlContent().contains(QLatin1String("<b>SOME</b> HTML text.")));
QVERIFY(testWriter.data().contains("<b>SOME</b> HTML text."));
QVERIFY(!testWriter.data().contains("This HTML message may contain external references to images etc. For security/privacy reasons external references are not loaded."));
}
......@@ -326,7 +326,7 @@ void ObjectTreeParserTester::test_Alternative()
testWriter.end();
QVERIFY(otp.htmlContent().isEmpty());
QVERIFY(otp.plainTextContent().contains(QStringLiteral(
QVERIFY(otp.plainTextContent().contains(QLatin1String(
"If you can see this text it means that your email client couldn't display our newsletter properly.")));
QVERIFY(testWriter.data().contains("If you can see this text it means that your email client couldn't display our newsletter properly."));
}
......@@ -342,9 +342,9 @@ void ObjectTreeParserTester::test_Alternative()
otp.parseObjectTree(msg.data());
testWriter.end();
QVERIFY(otp.plainTextContent().contains(QStringLiteral(
QVERIFY(otp.plainTextContent().contains(QLatin1String(
"If you can see this text it means that your email client couldn't display our newsletter properly.")));
QVERIFY(otp.htmlContent().contains(QStringLiteral(
QVERIFY(otp.htmlContent().contains(QLatin1String(
"Some <span style=\" font-weight:600;\">HTML</span> text</p>")));
QVERIFY(testWriter.data().contains("Some <span style=\" font-weight:600;\">HTML</span> text</p>"));
}
......@@ -379,7 +379,7 @@ void ObjectTreeParserTester::test_Alternative()
testWriter.end();
QVERIFY(otp.plainTextContent().isEmpty());
QVERIFY(otp.htmlContent().contains(QStringLiteral(
QVERIFY(otp.htmlContent().contains(QLatin1String(
"Some <span style=\" font-weight:600;\">HTML</span> text</p>")));
QVERIFY(testWriter.data().contains("Some <span style=\" font-weight:600;\">HTML</span> text</p>"));
}
......
......@@ -240,10 +240,10 @@ QString sigStatusToString(const QGpgME::Protocol *cryptProto, int status_code, G
bool containsExternalReferences(const QString &str, const QString &extraHead)
{
const bool hasBaseInHeader = extraHead.contains(QStringLiteral(
const bool hasBaseInHeader = extraHead.contains(QLatin1String(
"<base href=\""), Qt::CaseInsensitive);
if (hasBaseInHeader && (str.contains(QStringLiteral("href=\"/"), Qt::CaseInsensitive)
|| str.contains(QStringLiteral("<img src=\"/"), Qt::CaseInsensitive))) {
if (hasBaseInHeader && (str.contains(QLatin1String("href=\"/"), Qt::CaseInsensitive)
|| str.contains(QLatin1String("<img src=\"/"), Qt::CaseInsensitive))) {
return true;
}
int httpPos = str.indexOf(QLatin1String("\"http:"), Qt::CaseInsensitive);
......
......@@ -141,7 +141,7 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
if (!foundScam) {
//2) detect if url href has ip and not server name.
const QString hostname = url.host();
if (hostname.contains(ip4regExp) && !hostname.contains(QStringLiteral("127.0.0.1"))) { //hostname
if (hostname.contains(ip4regExp) && !hostname.contains(QLatin1String("127.0.0.1"))) { //hostname
d->mDetails += QLatin1String("<li>") + i18n(
"This email contains a link which points to a numerical IP address (%1) instead of a typical textual website address. This is often the case in scam emails.",
addWarningColor(hostname)) + QLatin1String("</li>");
......@@ -151,14 +151,14 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
"This email contains a link which points to a hexadecimal IP address (%1) instead of a typical textual website address. This is often the case in scam emails.",
addWarningColor(hostname)) + QLatin1String("</li>");
foundScam = true;
} else if (url.toString().contains(QStringLiteral("url?q="))) { //4) redirect url.
} else if (url.toString().contains(QLatin1String("url?q="))) { //4) redirect url.
d->mDetails += QLatin1String("<li>") + i18n(
"This email contains a link (%1) which has a redirection",
addWarningColor(url.toString())) + QLatin1String("</li>");
foundScam = true;
} else if ((url.toString().count(QStringLiteral("http://")) > 1)
|| (url.toString().count(QStringLiteral("https://")) > 1)) { //5) more that 1 http in url.
if (!url.toString().contains(QStringLiteral("kmail:showAuditLog"))) {
if (!url.toString().contains(QLatin1String("kmail:showAuditLog"))) {
d->mDetails += QLatin1String("<li>") + i18n(
"This email contains a link (%1) which contains multiple http://. This is often the case in scam emails.",
addWarningColor(url.toString())) + QLatin1String("</li>");
......
......@@ -619,9 +619,9 @@ void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &nam
if ((contentTypeStr == QLatin1String("text/plain"))
|| (contentTypeStr == QLatin1String("image/png"))
|| (contentTypeStr == QLatin1String("image/jpeg"))
|| parentMimeType.contains(QStringLiteral("text/plain"))
|| parentMimeType.contains(QStringLiteral("image/png"))
|| parentMimeType.contains(QStringLiteral("image/jpeg"))
|| parentMimeType.contains(QLatin1String("text/plain"))
|| parentMimeType.contains(QLatin1String("image/png"))
|| parentMimeType.contains(QLatin1String("image/jpeg"))
) {
action = menu.addAction(i18nc("to view something", "View"));
action->setEnabled(!deletedAttachment);
......
......@@ -104,7 +104,7 @@ bool ViewerPluginManagerPrivate::initializePluginList()
plugins
+= KPluginLoader::findPlugins(QStringLiteral("messageviewer"), [](
const KPluginMetaData &md) {
return md.serviceTypes().contains(QStringLiteral("MessageViewer/ViewerCommonPlugin"));
return md.serviceTypes().contains(QLatin1String("MessageViewer/ViewerCommonPlugin"));
});
const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(
......
......@@ -49,7 +49,7 @@ bool MailmanBodyPartFormatter::isMailmanMessage(KMime::Content *curNode) const
return true;
}
if (KMime::Headers::Base *header = curNode->headerByType("X-Mailer")) {
if (header->asUnicodeString().contains(QStringLiteral("MAILMAN"), Qt::CaseInsensitive)) {
if (header->asUnicodeString().contains(QLatin1String("MAILMAN"), Qt::CaseInsensitive)) {
return true;
}
}
......
......@@ -756,7 +756,7 @@ QString NodeHelper::fixEncoding(const QString &encoding)
// According to http://www.iana.org/assignments/character-sets, uppercase is
// preferred in MIME headers
const QString returnEncodingToUpper = returnEncoding.toUpper();
if (returnEncodingToUpper.contains(QStringLiteral("ISO "))) {
if (returnEncodingToUpper.contains(QLatin1String("ISO "))) {
returnEncoding = returnEncodingToUpper;
returnEncoding.replace(QLatin1String("ISO "), QStringLiteral("ISO-"));
}
......
......@@ -382,8 +382,8 @@ void TemplatesConfiguration::slotInsertCommand(const QString &cmd, int adjustCur
// qCDebug(TEMPLATEPARSER_LOG) << "Insert command:" << cmd;
const QString editText(edit->toPlainText());
if ((editText.contains(QStringLiteral("%FORCEDPLAIN")) && (cmd == QLatin1String("%FORCEDHTML")))
|| (editText.contains(QStringLiteral("%FORCEDHTML")) && (cmd == QLatin1String("%FORCEDPLAIN")))) {
if ((editText.contains(QLatin1String("%FORCEDPLAIN")) && (cmd == QLatin1String("%FORCEDHTML")))
|| (editText.contains(QLatin1String("%FORCEDHTML")) && (cmd == QLatin1String("%FORCEDPLAIN")))) {
KMessageBox::error(
this,
i18n("Use of \"Reply using plain text\" and \"Reply using HTML text\" in pairs"
......
......@@ -91,7 +91,7 @@ QVector<PimCommon::PluginUtilData> NetworkUrlInterceptorPluginManagerPrivate::pl
void NetworkUrlInterceptorPluginManagerPrivate::initializePluginList()
{
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("webengineviewer"), [](const KPluginMetaData &md) {
return md.serviceTypes().contains(QStringLiteral("WebEngineViewer/UrlInterceptor"));
return md.serviceTypes().contains(QLatin1String("WebEngineViewer/UrlInterceptor"));
});
QVectorIterator<KPluginMetaData> i(plugins);
......
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