Commit 1971905b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use QStringView here

parent 851713c3
Pipeline #60198 passed with stage
in 39 minutes and 26 seconds
......@@ -79,7 +79,7 @@ bool DMARCInfo::parseDMARC(const QString &key)
// else
// selected = false
// TODO verify if it's a percentage
mPercentage = elem.rightRef(elem.length() - 4).toInt();
mPercentage = QStringView(elem).right(elem.length() - 4).toInt();
} else if (elem.startsWith(QLatin1String("sp="))) {
// sp: Requested Mail Receiver policy for all subdomains (plain-text;
// OPTIONAL). Indicates the policy to be enacted by the Receiver at
......
......@@ -671,7 +671,7 @@ QString Util::parseBodyStyle(const QString &style)
// qDebug() << " style " << style;
const int indexEnd = style.indexOf(QLatin1Char('"'), indexStyle + 7);
if (indexEnd != -1) {
const QStringRef styleStr = style.midRef(indexStyle + 7, indexEnd - (indexStyle + 7));
const QStringView styleStr = QStringView(style).mid(indexStyle + 7, indexEnd - (indexStyle + 7));
const auto lstStyle = styleStr.split(QLatin1Char(';'), Qt::SkipEmptyParts);
QStringList lst;
for (const auto &style : lstStyle) {
......
......@@ -87,7 +87,7 @@ MessagePart::Ptr MailmanBodyPartFormatter::process(Interface::BodyPart &part) co
// at least one message found: build a mime tree
digestHeaderStr = QStringLiteral("Content-Type: text/plain\nContent-Description: digest header\n\n");
digestHeaderStr += str.midRef(0, thisDelim);
digestHeaderStr += QStringView(str).mid(0, thisDelim);
MessagePartList::Ptr mpl(new MessagePartList(part.objectTreeParser()));
mpl->appendSubPart(createAndParseTempNode(part, part.topLevelContent(), digestHeaderStr.toLatin1().constData(), "Digest Header"));
......@@ -115,7 +115,7 @@ MessagePart::Ptr MailmanBodyPartFormatter::process(Interface::BodyPart &part) co
// ++thisDelim;
partStr = QStringLiteral("Content-Type: message/rfc822\nContent-Description: embedded message\n\n");
partStr += str.midRef(thisDelim, nextDelim - thisDelim);
partStr += QStringView(str).mid(thisDelim, nextDelim - thisDelim);
QString subject = QStringLiteral("embedded message");
QString subSearch = QStringLiteral("\nSubject:");
int subPos = partStr.indexOf(subSearch, 0, Qt::CaseInsensitive);
......@@ -154,7 +154,7 @@ MessagePart::Ptr MailmanBodyPartFormatter::process(Interface::BodyPart &part) co
thisDelim = thisDelim + 1;
}
partStr = QStringLiteral("Content-Type: text/plain\nContent-Description: digest footer\n\n");
partStr += str.midRef(thisDelim);
partStr += QStringView(str).mid(thisDelim);
mpl->appendSubPart(createAndParseTempNode(part, part.topLevelContent(), partStr.toLatin1().constData(), "Digest Footer"));
return mpl;
}
......@@ -753,7 +753,7 @@ KMime::Content *NodeHelper::contentFromIndex(KMime::Content *node, const QString
const QString &path = pathParts[i];
if (path.startsWith(QLatin1Char('e'))) {
const QVector<KMime::Content *> &extraParts = mExtraContents.value(c);
const int idx = path.midRef(1, -1).toInt();
const int idx = QStringView(path).mid(1, -1).toInt();
c = (idx < extraParts.size()) ? extraParts[idx] : nullptr;
} else {
c = c->content(KMime::ContentIndex(path));
......
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