summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-05-07 11:20:03 +0200
committerMontel Laurent <[email protected]>2017-05-07 11:20:03 +0200
commit1568daa72d3ff872bb6ed4eecbe1a51728993de9 (patch)
treed11aac2a5630face433ac482266f188b615f93b2
parent976b92da3d42ee65839d11003ea33ce9580da337 (diff)
Use some QStringLiteral
-rw-r--r--src/filter/autotests/filteractionaddheadertest.cpp8
-rw-r--r--src/filter/autotests/filteractionpipethroughtest.cpp2
-rw-r--r--src/filter/autotests/filteractionremoveheadertest.cpp2
-rw-r--r--src/filter/autotests/filteractionrewriteheadertest.cpp8
-rw-r--r--src/filter/autotests/filteractionwithurltest.cpp2
-rw-r--r--src/search/searchrule/searchrule.cpp6
-rw-r--r--src/search/searchrule/searchruledate.cpp6
-rw-r--r--src/search/searchrule/searchrulenumerical.cpp2
-rw-r--r--src/search/searchrule/searchrulestatus.cpp6
-rw-r--r--src/search/searchrule/searchrulestring.cpp8
10 files changed, 25 insertions, 25 deletions
diff --git a/src/filter/autotests/filteractionaddheadertest.cpp b/src/filter/autotests/filteractionaddheadertest.cpp
index 302f8d5..f7d429a 100644
--- a/src/filter/autotests/filteractionaddheadertest.cpp
+++ b/src/filter/autotests/filteractionaddheadertest.cpp
@@ -99,7 +99,7 @@ void FilterActionAddHeaderTest::shouldNotExecuteActionWhenParameterIsEmpty()
item.setPayload<KMime::Message::Ptr>(msgPtr);
MailCommon::ItemContext context(item, true);
- filter.argsFromString("");
+ filter.argsFromString(QStringLiteral(""));
QCOMPARE(filter.process(context, false), MailCommon::FilterAction::ErrorButGoOn);
QCOMPARE(context.needsPayloadStore(), false);
QCOMPARE(context.deleteItem(), false);
@@ -114,7 +114,7 @@ void FilterActionAddHeaderTest::shouldNotExecuteActionWhenValueIsEmpty()
item.setPayload<KMime::Message::Ptr>(msgPtr);
MailCommon::ItemContext context(item, true);
- filter.argsFromString("foo");
+ filter.argsFromString(QStringLiteral("foo"));
QCOMPARE(filter.process(context, false), MailCommon::FilterAction::ErrorButGoOn);
QCOMPARE(context.needsPayloadStore(), false);
QCOMPARE(context.deleteItem(), false);
@@ -147,7 +147,7 @@ void FilterActionAddHeaderTest::shouldAddNewHeaderWhenNotExistingHeader()
item.setPayload<KMime::Message::Ptr>(msgPtr);
MailCommon::ItemContext context(item, true);
- filter.argsFromString("testheader\tfoo");
+ filter.argsFromString(QStringLiteral("testheader\tfoo"));
QCOMPARE(filter.process(context, false), MailCommon::FilterAction::GoOn);
QCOMPARE(context.needsPayloadStore(), true);
QCOMPARE(msgPtr->encodedContent(), output);
@@ -182,7 +182,7 @@ void FilterActionAddHeaderTest::shouldReplaceHeaderWhenExistingHeader()
item.setPayload<KMime::Message::Ptr>(msgPtr);
MailCommon::ItemContext context(item, true);
- filter.argsFromString("testheader\tfoo");
+ filter.argsFromString(QStringLiteral("testheader\tfoo"));
QCOMPARE(filter.process(context, false), MailCommon::FilterAction::GoOn);
QCOMPARE(context.needsPayloadStore(), true);
QCOMPARE(msgPtr->encodedContent(), output);
diff --git a/src/filter/autotests/filteractionpipethroughtest.cpp b/src/filter/autotests/filteractionpipethroughtest.cpp
index 14876c1..1db0fe0 100644
--- a/src/filter/autotests/filteractionpipethroughtest.cpp
+++ b/src/filter/autotests/filteractionpipethroughtest.cpp
@@ -45,7 +45,7 @@ void FilterActionPipeThroughTest::testWithNoCommand()
item.setPayload<KMime::Message::Ptr>(msgPtr);
ItemContext context(item, true);
- filter.argsFromString("");
+ filter.argsFromString(QStringLiteral(""));
QCOMPARE(filter.process(context, false), FilterAction::ErrorButGoOn);
QCOMPARE(context.needsPayloadStore(), false);
}
diff --git a/src/filter/autotests/filteractionremoveheadertest.cpp b/src/filter/autotests/filteractionremoveheadertest.cpp
index 221b4da..d0ef3ac 100644
--- a/src/filter/autotests/filteractionremoveheadertest.cpp
+++ b/src/filter/autotests/filteractionremoveheadertest.cpp
@@ -153,7 +153,7 @@ void FilterActionRemoveHeaderTest::shouldRemoveMultiHeader()
item.setPayload<KMime::Message::Ptr>(msgPtr);
MailCommon::ItemContext context(item, true);
- filter.argsFromString("testheader");
+ filter.argsFromString(QStringLiteral("testheader"));
QCOMPARE(filter.process(context, false), MailCommon::FilterAction::GoOn);
QCOMPARE(context.needsPayloadStore(), true);
QCOMPARE(msgPtr->encodedContent(), output);
diff --git a/src/filter/autotests/filteractionrewriteheadertest.cpp b/src/filter/autotests/filteractionrewriteheadertest.cpp
index 1e666a5..abfae77 100644
--- a/src/filter/autotests/filteractionrewriteheadertest.cpp
+++ b/src/filter/autotests/filteractionrewriteheadertest.cpp
@@ -74,7 +74,7 @@ void FilterActionRewriteHeaderTest::shouldNotExecuteActionWhenParameterIsEmpty()
item.setPayload<KMime::Message::Ptr>(msgPtr);
MailCommon::ItemContext context(item, true);
- filter.argsFromString("");
+ filter.argsFromString(QStringLiteral(""));
QCOMPARE(filter.process(context, false), MailCommon::FilterAction::ErrorButGoOn);
QCOMPARE(context.needsPayloadStore(), false);
}
@@ -87,11 +87,11 @@ void FilterActionRewriteHeaderTest::shouldNotExecuteActionWhenValueIsEmpty()
item.setPayload<KMime::Message::Ptr>(msgPtr);
MailCommon::ItemContext context(item, true);
- filter.argsFromString("foo");
+ filter.argsFromString(QStringLiteral("foo"));
QCOMPARE(filter.process(context, false), MailCommon::FilterAction::ErrorButGoOn);
QCOMPARE(context.needsPayloadStore(), false);
- filter.argsFromString("foo\tbla");
+ filter.argsFromString(QStringLiteral("foo\tbla"));
QCOMPARE(filter.process(context, false), MailCommon::FilterAction::ErrorButGoOn);
QCOMPARE(context.needsPayloadStore(), false);
}
@@ -172,7 +172,7 @@ void FilterActionRewriteHeaderTest::shouldNotRewriteHeaderWhenRegexpNotFound()
item.setPayload<KMime::Message::Ptr>(msgPtr);
MailCommon::ItemContext context(item, true);
- filter.argsFromString("testheader\tfoo\tbla");
+ filter.argsFromString(QStringLiteral("testheader\tfoo\tbla"));
QCOMPARE(filter.process(context, false), MailCommon::FilterAction::GoOn);
QCOMPARE(context.needsPayloadStore(), false);
QCOMPARE(msgPtr->encodedContent(), data);
diff --git a/src/filter/autotests/filteractionwithurltest.cpp b/src/filter/autotests/filteractionwithurltest.cpp
index 40b8a16..c072ae5 100644
--- a/src/filter/autotests/filteractionwithurltest.cpp
+++ b/src/filter/autotests/filteractionwithurltest.cpp
@@ -66,7 +66,7 @@ void FilterActionWithUrlTest::shouldClearWidget()
TestFilterActionWithUrl filter;
QWidget *w = filter.createParamWidget(nullptr);
KUrlRequester *requester = w->findChild<KUrlRequester *>(QStringLiteral("requester"));
- requester->setUrl(QUrl::fromLocalFile("/foo/bla"));
+ requester->setUrl(QUrl::fromLocalFile(QStringLiteral("/foo/bla")));
QVERIFY(!requester->url().isEmpty());
filter.clearParamWidget(w);
QVERIFY(requester->url().isEmpty());
diff --git a/src/search/searchrule/searchrule.cpp b/src/search/searchrule/searchrule.cpp
index b5d84f9..ed548df 100644
--- a/src/search/searchrule/searchrule.cpp
+++ b/src/search/searchrule/searchrule.cpp
@@ -165,7 +165,7 @@ QString SearchRule::functionToString(Function function)
if (function != FuncNone) {
return funcConfigNames[int(function)];
} else {
- return "invalid";
+ return QStringLiteral("invalid");
}
}
@@ -176,7 +176,7 @@ void SearchRule::writeConfig(KConfigGroup &config, int aIdx) const
static const QString func = QStringLiteral("func");
static const QString contents = QStringLiteral("contents");
- config.writeEntry(field + cIdx, QString(mField));
+ config.writeEntry(field + cIdx, /*QString*/(mField));
config.writeEntry(func + cIdx, functionToString(mFunction));
config.writeEntry(contents + cIdx, mContents);
}
@@ -522,7 +522,7 @@ const QString SearchRule::asString() const
{
QString result = QLatin1String("\"") + mField + QLatin1String("\" <");
result += functionToString(mFunction);
- result += "> \"" + mContents + "\"";
+ result += QStringLiteral("> \"") + mContents + QStringLiteral("\"");
return result;
}
diff --git a/src/search/searchrule/searchruledate.cpp b/src/search/searchrule/searchruledate.cpp
index 6e4be58..b0ce58f 100644
--- a/src/search/searchrule/searchruledate.cpp
+++ b/src/search/searchrule/searchruledate.cpp
@@ -54,10 +54,10 @@ bool SearchRuleDate::matches(const Akonadi::Item &item) const
const QDate dateValue = QDate::fromString(contents(), Qt::ISODate);
bool rc = matchesInternal(dateValue, msgDate);
if (FilterLog::instance()->isLogging()) {
- QString msg = (rc ? "<font color=#00FF00>1 = </font>"
- : "<font color=#FF0000>0 = </font>");
+ QString msg = (rc ? QStringLiteral("<font color=#00FF00>1 = </font>")
+ : QStringLiteral("<font color=#FF0000>0 = </font>"));
msg += FilterLog::recode(asString());
- msg += " ( <i>" + contents() + "</i> )"; //TODO change with locale?
+ msg += QStringLiteral(" ( <i>") + contents() + QStringLiteral("</i> )"); //TODO change with locale?
FilterLog::instance()->add(msg, FilterLog::RuleResult);
}
return rc;
diff --git a/src/search/searchrule/searchrulenumerical.cpp b/src/search/searchrule/searchrulenumerical.cpp
index e1b82c4..98dceaf 100644
--- a/src/search/searchrule/searchrulenumerical.cpp
+++ b/src/search/searchrule/searchrulenumerical.cpp
@@ -75,7 +75,7 @@ bool SearchRuleNumerical::matches(const Akonadi::Item &item) const
QString msg = (rc ? QStringLiteral("<font color=#00FF00>1 = </font>")
: QStringLiteral("<font color=#FF0000>0 = </font>"));
msg += FilterLog::recode(asString());
- msg += " ( <i>" + QString::number(numericalMsgContents) + "</i> )";
+ msg += QStringLiteral(" ( <i>") + QString::number(numericalMsgContents) + QStringLiteral("</i> )");
FilterLog::instance()->add(msg, FilterLog::RuleResult);
}
return rc;
diff --git a/src/search/searchrule/searchrulestatus.cpp b/src/search/searchrule/searchrulestatus.cpp
index 680dd31..37d4c98 100644
--- a/src/search/searchrule/searchrulestatus.cpp
+++ b/src/search/searchrule/searchrulestatus.cpp
@@ -52,7 +52,7 @@ QString englishNameForStatus(const Akonadi::MessageStatus &status)
{
for (int i = 0; i < numStatusNames; ++i) {
if (statusNames[i].status == status) {
- return statusNames[i].name;
+ return QString::fromLatin1(statusNames[i].name);
}
}
return QString();
@@ -76,7 +76,7 @@ SearchRuleStatus::SearchRuleStatus(Akonadi::MessageStatus status, Function func)
Akonadi::MessageStatus SearchRuleStatus::statusFromEnglishName(const QString &aStatusString)
{
for (int i = 0; i < numStatusNames; ++i) {
- if (!aStatusString.compare(statusNames[i].name)) {
+ if (!aStatusString.compare(QString::fromLatin1(statusNames[i].name))) {
return statusNames[i].status;
}
}
@@ -119,7 +119,7 @@ bool SearchRuleStatus::matches(const Akonadi::Item &item) const
break;
}
if (FilterLog::instance()->isLogging()) {
- QString msg = (rc ? "<font color=#00FF00>1 = </font>" : "<font color=#FF0000>0 = </font>");
+ QString msg = (rc ? QStringLiteral("<font color=#00FF00>1 = </font>") : QStringLiteral("<font color=#FF0000>0 = </font>"));
msg += FilterLog::recode(asString());
FilterLog::instance()->add(msg, FilterLog::RuleResult);
}
diff --git a/src/search/searchrule/searchrulestring.cpp b/src/search/searchrule/searchrulestring.cpp
index bf46a62..d2fad29 100644
--- a/src/search/searchrule/searchrulestring.cpp
+++ b/src/search/searchrule/searchrulestring.cpp
@@ -151,7 +151,7 @@ bool SearchRuleString::matches(const Akonadi::Item &item) const
} else {
// make sure to treat messages with multiple header lines for
// the same header correctly
- msgContents = "";
+ msgContents = QStringLiteral("");
if (auto hrd = msg->headerByType(field().constData())) {
msgContents = hrd->asUnicodeString();
}
@@ -160,7 +160,7 @@ bool SearchRuleString::matches(const Akonadi::Item &item) const
if (function() == FuncIsInAddressbook ||
function() == FuncIsNotInAddressbook) {
// I think only the "from"-field makes sense.
- msgContents = "";
+ msgContents = QStringLiteral("");
if (auto hrd = msg->headerByType(field().constData())) {
msgContents = hrd->asUnicodeString();
}
@@ -179,11 +179,11 @@ bool SearchRuleString::matches(const Akonadi::Item &item) const
bool rc = matchesInternal(msgContents);
if (FilterLog::instance()->isLogging()) {
- QString msg = (rc ? "<font color=#00FF00>1 = </font>" : "<font color=#FF0000>0 = </font>");
+ QString msg = (rc ? QStringLiteral("<font color=#00FF00>1 = </font>") : QStringLiteral("<font color=#FF0000>0 = </font>"));
msg += FilterLog::recode(asString());
// only log headers bcause messages and bodies can be pretty large
if (logContents) {
- msg += " (<i>" + FilterLog::recode(msgContents) + "</i>)";
+ msg += QStringLiteral(" (<i>") + FilterLog::recode(msgContents) + QStringLiteral("</i>)");
}
FilterLog::instance()->add(msg, FilterLog::RuleResult);
}