Commit 5eb742e1 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to QStringView::split

parent be0aec6d
Pipeline #77146 passed with stage
in 17 minutes and 8 seconds
......@@ -260,9 +260,13 @@ QString AutoCreateScriptUtil::generateConditionComment(const QString &comment)
{
QString strComment;
if (!comment.trimmed().isEmpty()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QVector<QStringView> commentList = QStringView(comment).split(QLatin1Char('\n'));
for (const QStringView str : commentList) {
#else
const QVector<QStringRef> commentList = comment.splitRef(QLatin1Char('\n'));
for (const QStringRef &str : commentList) {
#endif
if (str.isEmpty()) {
strComment += QLatin1Char('\n');
} else {
......
......@@ -85,8 +85,13 @@ void SieveActionWidget::generatedScript(QString &script, QStringList &required,
indent += AutoCreateScriptUtil::indentation();
}
if (!comment.trimmed().isEmpty()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QVector<QStringView> commentList = QStringView(comment).split(QLatin1Char('\n'));
for (const QStringView str : commentList) {
#else
const QVector<QStringRef> commentList = comment.splitRef(QLatin1Char('\n'));
for (const QStringRef &str : commentList) {
#endif
if (str.isEmpty()) {
script += QLatin1Char('\n');
} else {
......
......@@ -68,8 +68,13 @@ QString SieveScriptListItem::generatedScript(QStringList &required) const
{
QString script;
if (!mDescription.trimmed().isEmpty()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QVector<QStringView> commentList = QStringView(mDescription).split(QLatin1Char('\n'));
for (const QStringView str : commentList) {
#else
const QVector<QStringRef> commentList = mDescription.splitRef(QLatin1Char('\n'));
for (const QStringRef &str : commentList) {
#endif
if (str.isEmpty()) {
script += QLatin1Char('\n');
} else {
......
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