Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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

Use QLatin1String

parent 0d63544e
......@@ -88,10 +88,10 @@ void FilterImporterBalsa::parseFilter(const KConfigGroup &grp)
void FilterImporterBalsa::parseCondition(const QString &condition, MailCommon::MailFilter *filter)
{
QStringList conditionList;
if (condition.startsWith(QStringLiteral("OR "))) {
if (condition.startsWith(QLatin1String("OR "))) {
conditionList = condition.split(QStringLiteral("OR"));
filter->pattern()->setOp(SearchPattern::OpOr);
} else if (condition.startsWith(QStringLiteral("AND "))) {
} else if (condition.startsWith(QLatin1String("AND "))) {
conditionList = condition.split(QStringLiteral("AND"));
filter->pattern()->setOp(SearchPattern::OpAnd);
} else {
......@@ -100,7 +100,7 @@ void FilterImporterBalsa::parseCondition(const QString &condition, MailCommon::M
}
for (QString cond : qAsConst(conditionList)) {
cond = cond.trimmed();
if (cond.startsWith(QStringLiteral("NOT"))) {
if (cond.startsWith(QLatin1String("NOT"))) {
cond = cond.right(cond.length() - 3);
cond = cond.trimmed();
}
......@@ -108,15 +108,15 @@ void FilterImporterBalsa::parseCondition(const QString &condition, MailCommon::M
//Date between
QByteArray fieldName;
if (cond.startsWith(QStringLiteral("DATE"))) {
if (cond.startsWith(QLatin1String("DATE"))) {
fieldName = "<date>";
cond = cond.right(cond.length() - 4);
cond = cond.trimmed();
QStringList splitDate = cond.split(QLatin1Char(' '));
qCDebug(MAILCOMMON_LOG) << " splitDate " << splitDate;
} else if (cond.startsWith(QStringLiteral("FLAG"))) {
} else if (cond.startsWith(QLatin1String("FLAG"))) {
qCDebug(MAILCOMMON_LOG) << " FLAG :";
} else if (cond.startsWith(QStringLiteral("STRING"))) {
} else if (cond.startsWith(QLatin1String("STRING"))) {
qCDebug(MAILCOMMON_LOG) << " STRING";
} else {
qCDebug(MAILCOMMON_LOG) << " condition not implemented :" << cond;
......
......@@ -77,13 +77,13 @@ MailFilter *FilterImporterClawsMails::parseLine(const QString &line)
MailFilter *filter = new MailFilter();
QString tmp = line;
//Enabled ?
if (tmp.startsWith(QStringLiteral("enabled"))) {
if (tmp.startsWith(QLatin1String("enabled"))) {
filter->setEnabled(true);
tmp.remove(QStringLiteral("enabled "));
}
//Filter name
if (tmp.startsWith(QStringLiteral("rulename"))) {
if (tmp.startsWith(QLatin1String("rulename"))) {
tmp.remove(QStringLiteral("rulename "));
int pos;
const QString name = extractString(tmp, pos);
......@@ -111,9 +111,9 @@ QString FilterImporterClawsMails::extractConditions(const QString &line, MailFil
{
QByteArray fieldName;
//Action
if (line.startsWith(QStringLiteral("subject"))) {
if (line.startsWith(QLatin1String("subject"))) {
fieldName = "subject";
} else if (line.startsWith(QStringLiteral("age_lower"))) {
} else if (line.startsWith(QLatin1String("age_lower"))) {
}
filter->pattern()->setOp(SearchPattern::OpAnd);
//TODO
......
......@@ -77,25 +77,25 @@ MailCommon::MailFilter *FilterImporterProcmail::parseLine(QTextStream &stream, Q
} else if (line.startsWith(QLatin1Char('#'))) {
//Commented line
return filter;
} else if (line.startsWith(QStringLiteral(":0"))) {
} else if (line.startsWith(QLatin1String(":0"))) {
appendFilter(filter);
filter = new MailFilter();
const QString uniqName = createUniqFilterName();
filter->pattern()->setName(uniqName);
filter->setToolbarName(uniqName);
} else if (line.startsWith(QStringLiteral("* "))) {
} else if (line.startsWith(QLatin1String("* "))) {
line.remove(0, 2);
QByteArray fieldName;
SearchRule::Function functionName = SearchRule::FuncRegExp;
if (line.startsWith(QStringLiteral("^From:"))) {
if (line.startsWith(QLatin1String("^From:"))) {
line.remove(QStringLiteral("^From:"));
fieldName = "from";
} else if (line.startsWith(QStringLiteral("^Subject:"))) {
} else if (line.startsWith(QLatin1String("^Subject:"))) {
line.remove(QStringLiteral("^Subject:"));
fieldName = "subject";
} else if (line.startsWith(QStringLiteral("^Sender:"))) {
} else if (line.startsWith(QLatin1String("^Sender:"))) {
line.remove(QStringLiteral("^Sender:"));
} else if (line.startsWith(QStringLiteral("^(To|Cc):"))) {
} else if (line.startsWith(QLatin1String("^(To|Cc):"))) {
line.remove(QStringLiteral("^(To|Cc):"));
fieldName = "<recipients>";
} else {
......
......@@ -74,19 +74,19 @@ QString FilterImporterThunderbird::defaultThunderbirdFiltersSettingsPath()
MailCommon::MailFilter *FilterImporterThunderbird::parseLine(QTextStream &stream, QString line, MailCommon::MailFilter *filter)
{
if (line.startsWith(QStringLiteral("name="))) {
if (line.startsWith(QLatin1String("name="))) {
appendFilter(filter);
filter = new MailFilter();
line = cleanArgument(line, QStringLiteral("name="));
filter->pattern()->setName(line);
filter->setToolbarName(line);
} else if (line.startsWith(QStringLiteral("action="))) {
} else if (line.startsWith(QLatin1String("action="))) {
line = cleanArgument(line, QStringLiteral("action="));
QString value;
QString actionName = extractActions(line, filter, value);
if (!stream.atEnd()) {
line = stream.readLine();
if (line.startsWith(QStringLiteral("actionValue="))) {
if (line.startsWith(QLatin1String("actionValue="))) {
value = cleanArgument(line, QStringLiteral("actionValue="));
//change priority
if (actionName == QLatin1String("Change priority")) {
......@@ -124,23 +124,23 @@ MailCommon::MailFilter *FilterImporterThunderbird::parseLine(QTextStream &stream
} else {
createFilterAction(filter, actionName, value);
}
} else if (line.startsWith(QStringLiteral("enabled="))) {
} else if (line.startsWith(QLatin1String("enabled="))) {
line = cleanArgument(line, QStringLiteral("enabled="));
if (line == QLatin1String("no")) {
filter->setEnabled(false);
}
} else if (line.startsWith(QStringLiteral("condition="))) {
} else if (line.startsWith(QLatin1String("condition="))) {
line = cleanArgument(line, QStringLiteral("condition="));
extractConditions(line, filter);
} else if (line.startsWith(QStringLiteral("type="))) {
} else if (line.startsWith(QLatin1String("type="))) {
line = cleanArgument(line, QStringLiteral("type="));
extractType(line, filter);
} else if (line.startsWith(QStringLiteral("version="))) {
} else if (line.startsWith(QLatin1String("version="))) {
line = cleanArgument(line, QStringLiteral("version="));
if (line.toInt() != 9) {
qCDebug(MAILCOMMON_LOG) << " thunderbird filter version different of 9 need to look at if it changed";
}
} else if (line.startsWith(QStringLiteral("logging="))) {
} else if (line.startsWith(QLatin1String("logging="))) {
line = cleanArgument(line, QStringLiteral("logging="));
if (line == QLatin1String("no")) {
//TODO
......@@ -157,7 +157,7 @@ MailCommon::MailFilter *FilterImporterThunderbird::parseLine(QTextStream &stream
void FilterImporterThunderbird::extractConditions(const QString &line, MailCommon::MailFilter *filter)
{
if (line.startsWith(QStringLiteral("AND"))) {
if (line.startsWith(QLatin1String("AND"))) {
filter->pattern()->setOp(SearchPattern::OpAnd);
const QStringList conditionsList = line.split(QStringLiteral("AND "));
const int numberOfCond(conditionsList.count());
......@@ -166,7 +166,7 @@ void FilterImporterThunderbird::extractConditions(const QString &line, MailCommo
splitConditions(conditionsList.at(i), filter);
}
}
} else if (line.startsWith(QStringLiteral("OR"))) {
} else if (line.startsWith(QLatin1String("OR"))) {
filter->pattern()->setOp(SearchPattern::OpOr);
const QStringList conditionsList = line.split(QStringLiteral("OR "));
const int numberOfCond(conditionsList.count());
......@@ -175,7 +175,7 @@ void FilterImporterThunderbird::extractConditions(const QString &line, MailCommo
splitConditions(conditionsList.at(i), filter);
}
}
} else if (line.startsWith(QStringLiteral("ALL"))) {
} else if (line.startsWith(QLatin1String("ALL"))) {
filter->pattern()->setOp(SearchPattern::OpAll);
} else {
qCDebug(MAILCOMMON_LOG) << " missing extract condition" << line;
......
......@@ -206,11 +206,11 @@ void AccountConfigOrderDialog::init()
instanceStruct.name = instance.name();
if (PimCommon::Util::isImapResource(identifier)) {
instanceStruct.name += QLatin1String(" (IMAP)");
} else if (identifier.startsWith(QStringLiteral("akonadi_maildir_resource"))) {
} else if (identifier.startsWith(QLatin1String("akonadi_maildir_resource"))) {
instanceStruct.name += QLatin1String(" (Maildir)");
} else if (identifier.startsWith(QStringLiteral("akonadi_mailbox_resource"))) {
} else if (identifier.startsWith(QLatin1String("akonadi_mailbox_resource"))) {
instanceStruct.name += QLatin1String(" (Mailbox)");
} else if (identifier.startsWith(QStringLiteral("akonadi_mixedmaildir_resource"))) {
} else if (identifier.startsWith(QLatin1String("akonadi_mixedmaildir_resource"))) {
instanceStruct.name += QLatin1String(" (Mixedmaildir)");
} else {
qCDebug(MAILCOMMON_LOG) << " Unknown resource type " << identifier;
......
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