diff --git a/src/buffer/katetextbuffer.cpp b/src/buffer/katetextbuffer.cpp --- a/src/buffer/katetextbuffer.cpp +++ b/src/buffer/katetextbuffer.cpp @@ -966,21 +966,21 @@ // prepare data for KAuth action QVariantMap kAuthActionArgs; - kAuthActionArgs.insert(QLatin1String("sourceFile"), tempFile.fileName()); - kAuthActionArgs.insert(QLatin1String("targetFile"), filename); - kAuthActionArgs.insert(QLatin1String("checksum"), cryptographicHash.result()); - kAuthActionArgs.insert(QLatin1String("ownerId"), ownerId); - kAuthActionArgs.insert(QLatin1String("groupId"), groupId); + kAuthActionArgs.insert(QStringLiteral("sourceFile"), tempFile.fileName()); + kAuthActionArgs.insert(QStringLiteral("targetFile"), filename); + kAuthActionArgs.insert(QStringLiteral("checksum"), cryptographicHash.result()); + kAuthActionArgs.insert(QStringLiteral("ownerId"), ownerId); + kAuthActionArgs.insert(QStringLiteral("groupId"), groupId); // call save with elevated privileges if (KTextEditor::EditorPrivate::unitTestMode()) { // unit testing purposes only if (!SecureTextBuffer::savefile(kAuthActionArgs).succeeded()) { return false; } } else { - KAuth::Action kAuthSaveAction(QLatin1String("org.kde.ktexteditor.katetextbuffer.savefile")); - kAuthSaveAction.setHelperId(QLatin1String("org.kde.ktexteditor.katetextbuffer")); + KAuth::Action kAuthSaveAction(QStringLiteral("org.kde.ktexteditor.katetextbuffer.savefile")); + kAuthSaveAction.setHelperId(QStringLiteral("org.kde.ktexteditor.katetextbuffer")); kAuthSaveAction.setArguments(kAuthActionArgs); KAuth::ExecuteJob *job = kAuthSaveAction.execute(); if (!job->exec()) { diff --git a/src/buffer/katetextfolding.cpp b/src/buffer/katetextfolding.cpp --- a/src/buffer/katetextfolding.cpp +++ b/src/buffer/katetextfolding.cpp @@ -615,7 +615,7 @@ const QString persistent = (range->flags & Persistent) ? QStringLiteral("p") : QString(); const QString folded = (range->flags & Folded) ? QStringLiteral("f") : QString(); - dump += QString::fromLatin1("[%1:%2 %3%4 ").arg(range->start->line()).arg(range->start->column()).arg(persistent, folded); + dump += QStringLiteral("[%1:%2 %3%4 ").arg(range->start->line()).arg(range->start->column()).arg(persistent, folded); /** * recurse @@ -627,7 +627,7 @@ } } - dump += QString::fromLatin1("%1:%2]").arg(range->end->line()).arg(range->end->column()); + dump += QStringLiteral("%1:%2]").arg(range->end->line()).arg(range->end->column()); } return dump; } diff --git a/src/completion/katecompletionconfig.cpp b/src/completion/katecompletionconfig.cpp --- a/src/completion/katecompletionconfig.cpp +++ b/src/completion/katecompletionconfig.cpp @@ -109,7 +109,7 @@ bool first = true; foreach (int column, list) { QTreeWidgetItem *item = new QTreeWidgetItem(ui->columnMergeTree, column); - item->setText(0, KateCompletionModel::columnName(column) + QString::fromLatin1(" %1").arg(column)); + item->setText(0, KateCompletionModel::columnName(column) + QStringLiteral(" %1").arg(column)); item->setCheckState(1, first ? Qt::Unchecked : Qt::Checked); if (column == KTextEditor::CodeCompletionModel::Name) { @@ -126,7 +126,7 @@ for (int column = 0; column < KTextEditor::CodeCompletionModel::ColumnCount; ++column) { if (!mergedColumns.contains(column)) { QTreeWidgetItem *item = new QTreeWidgetItem(ui->columnMergeTree, column); - item->setText(0, KateCompletionModel::columnName(column) + QString::fromLatin1(" %1").arg(column)); + item->setText(0, KateCompletionModel::columnName(column) + QStringLiteral(" %1").arg(column)); item->setCheckState(1, Qt::Unchecked); Q_ASSERT(column != KTextEditor::CodeCompletionModel::Name); @@ -138,7 +138,7 @@ } else { for (int column = 0; column < KTextEditor::CodeCompletionModel::ColumnCount; ++column) { QTreeWidgetItem *item = new QTreeWidgetItem(ui->columnMergeTree, column); - item->setText(0, KateCompletionModel::columnName(column) + QString::fromLatin1(" %1").arg(column)); + item->setText(0, KateCompletionModel::columnName(column) + QStringLiteral(" %1").arg(column)); item->setCheckState(1, Qt::Unchecked); if (column == KTextEditor::CodeCompletionModel::Name) { diff --git a/src/dialogs/katedialogs.cpp b/src/dialogs/katedialogs.cpp --- a/src/dialogs/katedialogs.cpp +++ b/src/dialogs/katedialogs.cpp @@ -1367,7 +1367,7 @@ // Start a KProcess that creates a diff m_proc = new KProcess(this); m_proc->setOutputChannelMode(KProcess::MergedChannels); - *m_proc << QStringLiteral("diff") << QLatin1String("-u") + *m_proc << QStringLiteral("diff") << QStringLiteral("-u") << QStringLiteral("-") << m_doc->url().toLocalFile(); connect(m_proc, SIGNAL(readyRead()), this, SLOT(slotDataAvailable())); connect(m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotPDone())); diff --git a/src/document/katedocument.cpp b/src/document/katedocument.cpp --- a/src/document/katedocument.cpp +++ b/src/document/katedocument.cpp @@ -1205,7 +1205,7 @@ endLine++; } else { if (nextl && (nextl->length() > 0) && !nextl->at(0).isSpace() && ((l->length() < 1) || !l->at(l->length() - 1).isSpace())) { - editInsertText(line + 1, 0, QLatin1String(" ")); + editInsertText(line + 1, 0, QStringLiteral(" ")); } bool newLineAdded = false; @@ -1904,15 +1904,15 @@ //BEGIN KTextEditor::SessionConfigInterface and KTextEditor::ParameterizedSessionConfigInterface stuff void KTextEditor::DocumentPrivate::readSessionConfig(const KConfigGroup &kconfig, const QSet &flags) { - if (!flags.contains(QLatin1String("SkipEncoding"))) { + if (!flags.contains(QStringLiteral("SkipEncoding"))) { // get the encoding QString tmpenc = kconfig.readEntry("Encoding"); if (!tmpenc.isEmpty() && (tmpenc != encoding())) { setEncoding(tmpenc); } } - if (!flags.contains(QLatin1String("SkipUrl"))) { + if (!flags.contains(QStringLiteral("SkipUrl"))) { // restore the url QUrl url(kconfig.readEntry("URL")); @@ -1926,7 +1926,7 @@ completed(); //perhaps this should be emitted at the end of this function } - if (!flags.contains(QLatin1String("SkipMode"))) { + if (!flags.contains(QStringLiteral("SkipMode"))) { // restore the filetype if (kconfig.hasKey("Mode")) { updateFileType(kconfig.readEntry("Mode", fileType())); @@ -1936,7 +1936,7 @@ } } - if (!flags.contains(QLatin1String("SkipHighlighting"))) { + if (!flags.contains(QStringLiteral("SkipHighlighting"))) { // restore the hl stuff if (kconfig.hasKey("Highlighting")) { const int mode = KateHlManager::self()->nameFind(kconfig.readEntry("Highlighting")); @@ -1968,24 +1968,24 @@ } } - if (!flags.contains(QLatin1String("SkipUrl"))) { + if (!flags.contains(QStringLiteral("SkipUrl"))) { // save url kconfig.writeEntry("URL", this->url().toString()); } - if (!flags.contains(QLatin1String("SkipEncoding"))) { + if (!flags.contains(QStringLiteral("SkipEncoding"))) { // save encoding kconfig.writeEntry("Encoding", encoding()); } - if (!flags.contains(QLatin1String("SkipMode"))) { + if (!flags.contains(QStringLiteral("SkipMode"))) { // save file type kconfig.writeEntry("Mode", m_fileType); // save if set by user, too! kconfig.writeEntry("Mode Set By User", m_fileTypeSetByUser); } - if (!flags.contains(QLatin1String("SkipHighlighting"))) { + if (!flags.contains(QStringLiteral("SkipHighlighting"))) { // save hl kconfig.writeEntry("Highlighting", highlight()->name()); @@ -3350,7 +3350,7 @@ const Kate::TextLine textLine = m_buffer->plainLine(line - 1); if (line > 0 && textLine) { - if (config()->wordWrap() && textLine->endsWith(QLatin1String(" "))) { + if (config()->wordWrap() && textLine->endsWith(QStringLiteral(" "))) { // gg: in hard wordwrap mode, backspace must also eat the trailing space removeText(KTextEditor::Range(line - 1, textLine->length() - 1, line, 0)); } else { @@ -4103,7 +4103,7 @@ editRemoveText(line + 1, 0, pos); } if (!(l->length() == 0 || l->at(l->length() - 1).isSpace())) { - editInsertText(line + 1, 0, QLatin1String(" ")); + editInsertText(line + 1, 0, QStringLiteral(" ")); } } else { // Just remove the whitespace and let Kate handle the rest diff --git a/src/script/katescriptmanager.cpp b/src/script/katescriptmanager.cpp --- a/src/script/katescriptmanager.cpp +++ b/src/script/katescriptmanager.cpp @@ -311,7 +311,7 @@ { Q_UNUSED(view) - QVector args = _cmd.splitRef(QRegularExpression(QLatin1String("\\s+")), QString::SkipEmptyParts); + QVector args = _cmd.splitRef(QRegularExpression(QStringLiteral("\\s+")), QString::SkipEmptyParts); const QString cmd = args.first().toString(); if (cmd == QLatin1String("reload-scripts")) { diff --git a/src/syntax/katehighlight.cpp b/src/syntax/katehighlight.cpp --- a/src/syntax/katehighlight.cpp +++ b/src/syntax/katehighlight.cpp @@ -461,7 +461,7 @@ QString KateHighlighting::nameForAttrib(int attrib) const { const auto &format = m_formats.at(sanitizeFormatIndex(attrib)); - return m_propertiesForFormat.at(sanitizeFormatIndex(attrib))->definition.name() + QLatin1Char(':') + QString(format.isValid() ? format.name() : QLatin1String("Normal")); + return m_propertiesForFormat.at(sanitizeFormatIndex(attrib))->definition.name() + QLatin1Char(':') + QString(format.isValid() ? format.name() : QStringLiteral("Normal")); } bool KateHighlighting::isInWord(QChar c, int attrib) const diff --git a/src/utils/codecompletionmodelcontrollerinterface.cpp b/src/utils/codecompletionmodelcontrollerinterface.cpp --- a/src/utils/codecompletionmodelcontrollerinterface.cpp +++ b/src/utils/codecompletionmodelcontrollerinterface.cpp @@ -101,7 +101,7 @@ } //Do not abort completions when the text has been empty already before and a newline has been entered - static const QRegularExpression allowedText(QLatin1String("^\\w*$")); + static const QRegularExpression allowedText(QStringLiteral("^\\w*$")); return !allowedText.match(currentCompletion).hasMatch(); } diff --git a/src/utils/katecmds.cpp b/src/utils/katecmds.cpp --- a/src/utils/katecmds.cpp +++ b/src/utils/katecmds.cpp @@ -204,7 +204,7 @@ } //create a list of args - QStringList args(_cmd.split(QRegularExpression(QLatin1String("\\s+")), QString::SkipEmptyParts)); + QStringList args(_cmd.split(QRegularExpression(QStringLiteral("\\s+")), QString::SkipEmptyParts)); QString cmd(args.takeFirst()); // ALL commands that takes no arguments. @@ -499,7 +499,7 @@ QString cmd = _cmd; // hex, octal, base 9+1 - QRegularExpression num(QLatin1String("^char *(0?x[0-9A-Fa-f]{1,4}|0[0-7]{1,6}|[0-9]{1,5})$")); + QRegularExpression num(QStringLiteral("^char *(0?x[0-9A-Fa-f]{1,4}|0[0-7]{1,6}|[0-9]{1,5})$")); QRegularExpressionMatch match = num.match(cmd); if (!match.hasMatch()) { return false; diff --git a/src/utils/katesedcmd.cpp b/src/utils/katesedcmd.cpp --- a/src/utils/katesedcmd.cpp +++ b/src/utils/katesedcmd.cpp @@ -155,7 +155,7 @@ bool KateCommands::SedReplace::parse(const QString &sedReplaceString, QString &destDelim, int &destFindBeginPos, int &destFindEndPos, int &destReplaceBeginPos, int &destReplaceEndPos) { // valid delimiters are all non-word, non-space characters plus '_' - QRegularExpression delim(QLatin1String("^s\\s*([^\\w\\s]|_)")); + QRegularExpression delim(QStringLiteral("^s\\s*([^\\w\\s]|_)")); auto match = delim.match(sedReplaceString); if (!match.hasMatch()) { return false; diff --git a/src/view/kateview.cpp b/src/view/kateview.cpp --- a/src/view/kateview.cpp +++ b/src/view/kateview.cpp @@ -1198,7 +1198,7 @@ ac->setDefaultShortcut(a, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Minus)); connect(a, SIGNAL(triggered(bool)), SLOT(slotFoldToplevelNodes())); - a = ac->addAction(QLatin1String("folding_expandtoplevel")); + a = ac->addAction(QStringLiteral("folding_expandtoplevel")); a->setText(i18n("Unfold Toplevel Nodes")); ac->setDefaultShortcut(a, QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Plus)); connect(a, SIGNAL(triggered(bool)), SLOT(slotExpandToplevelNodes())); diff --git a/src/view/kateviewhelpers.cpp b/src/view/kateviewhelpers.cpp --- a/src/view/kateviewhelpers.cpp +++ b/src/view/kateviewhelpers.cpp @@ -1118,7 +1118,7 @@ const QString end = QStringLiteral(""); const QString t = text(); - static const QRegularExpression re(QLatin1String("\\s*help\\s+(.*)")); + static const QRegularExpression re(QStringLiteral("\\s*help\\s+(.*)")); auto match = re.match(t); if (match.hasMatch()) { QString s; @@ -1225,7 +1225,7 @@ m_msgMode = true; // the following commands changes the focus themselves, so bar should be hidden before execution. - if (QRegularExpression(QLatin1String("^(buffer|b|new|vnew|bp|bprev|bn|bnext|bf|bfirst|bl|blast|edit|e)$")).match(cmd.split(QLatin1Char(' ')).at(0)).hasMatch()) { + if (QRegularExpression(QStringLiteral("^(buffer|b|new|vnew|bp|bprev|bn|bnext|bf|bfirst|bl|blast|edit|e)$")).match(cmd.split(QLatin1Char(' ')).at(0)).hasMatch()) { emit hideRequested(); } @@ -1274,7 +1274,7 @@ m_cmdend = 0; // the following commands change the focus themselves - if (!QRegularExpression(QLatin1String("^(buffer|b|new|vnew|bp|bprev|bn|bnext|bf|bfirst|bl|blast|edit|e)$")).match(cmd.split(QLatin1Char(' ')).at(0)).hasMatch()) { + if (!QRegularExpression(QStringLiteral("^(buffer|b|new|vnew|bp|bprev|bn|bnext|bf|bfirst|bl|blast|edit|e)$")).match(cmd.split(QLatin1Char(' ')).at(0)).hasMatch()) { m_view->setFocus(); } @@ -1414,7 +1414,7 @@ if (! s.isEmpty()) { // Select the argument part of the command, so that it is easy to overwrite setText(s); - static const QRegularExpression reCmd(QLatin1String("^[\\w\\-]+(?:[^a-zA-Z0-9_-]|:\\w+)(.*)")); + static const QRegularExpression reCmd(QStringLiteral("^[\\w\\-]+(?:[^a-zA-Z0-9_-]|:\\w+)(.*)")); const auto match = reCmd.match(text()); if (match.hasMatch()) { setSelection(text().length() - match.capturedLength(1), match.capturedLength(1)); diff --git a/src/vimode/appcommands.cpp b/src/vimode/appcommands.cpp --- a/src/vimode/appcommands.cpp +++ b/src/vimode/appcommands.cpp @@ -63,7 +63,7 @@ bool AppCommands::exec(KTextEditor::View *view, const QString &cmd, QString &msg, const KTextEditor::Range &) { - QStringList args(cmd.split(QRegularExpression(QLatin1String("\\s+")), QString::SkipEmptyParts)) ; + QStringList args(cmd.split(QRegularExpression(QStringLiteral("\\s+")), QString::SkipEmptyParts)) ; QString command(args.takeFirst()); KTextEditor::MainWindow *mainWin = view->mainWindow(); diff --git a/src/vimode/cmds.cpp b/src/vimode/cmds.cpp --- a/src/vimode/cmds.cpp +++ b/src/vimode/cmds.cpp @@ -58,7 +58,7 @@ } //create a list of args - QStringList args(_cmd.split(QRegularExpression(QLatin1String("\\s+")), QString::SkipEmptyParts)); + QStringList args(_cmd.split(QRegularExpression(QStringLiteral("\\s+")), QString::SkipEmptyParts)); QString cmd(args.takeFirst()); // ALL commands that takes no arguments. @@ -106,7 +106,7 @@ range.end().line()), 0)); } - static const QRegularExpression number(QLatin1String("^(\\d+)$")); + static const QRegularExpression number(QStringLiteral("^(\\d+)$")); for (int i = 0; i < args.count(); i++) { auto match = number.match(args.at(i)); if (match.hasMatch()) { diff --git a/src/vimode/completionreplayer.cpp b/src/vimode/completionreplayer.cpp --- a/src/vimode/completionreplayer.cpp +++ b/src/vimode/completionreplayer.cpp @@ -145,7 +145,7 @@ { KTextEditor::DocumentPrivate *doc = m_viInputModeManager->view()->doc(); const QString lineAfterCursor = doc->text(KTextEditor::Range(startPos, KTextEditor::Cursor(startPos.line(), doc->lineLength(startPos.line())))); - static const QRegularExpression whitespaceThenOpeningBracket(QLatin1String("^\\s*(\\()")); + static const QRegularExpression whitespaceThenOpeningBracket(QStringLiteral("^\\s*(\\()")); QRegularExpressionMatch match = whitespaceThenOpeningBracket.match(lineAfterCursor); int nextMergableBracketAfterCursorPos = -1; if (match.hasMatch()) { diff --git a/src/vimode/emulatedcommandbar/commandmode.cpp b/src/vimode/emulatedcommandbar/commandmode.cpp --- a/src/vimode/emulatedcommandbar/commandmode.cpp +++ b/src/vimode/emulatedcommandbar/commandmode.cpp @@ -224,7 +224,7 @@ } // the following commands change the focus themselves - static const QRegularExpression reCmds(QLatin1String("^(buffer|b|new|vnew|bp|bprev|tabp|tabprev|bn|bnext|tabn|tabnext|bf|bfirst|tabf|tabfirst|bl|blast|tabl|tablast|e|edit|tabe|tabedit|tabnew)$")); + static const QRegularExpression reCmds(QStringLiteral("^(buffer|b|new|vnew|bp|bprev|tabp|tabprev|bn|bnext|tabn|tabnext|bf|bfirst|tabf|tabfirst|bl|blast|tabl|tablast|e|edit|tabe|tabedit|tabnew)$")); if (!reCmds.match(cmd.split(QLatin1Char(' ')).at(0)).hasMatch()) { view()->setFocus(); } diff --git a/src/vimode/emulatedcommandbar/completer.cpp b/src/vimode/emulatedcommandbar/completer.cpp --- a/src/vimode/emulatedcommandbar/completer.cpp +++ b/src/vimode/emulatedcommandbar/completer.cpp @@ -208,7 +208,7 @@ CompletionStartParams Completer::activateWordFromDocumentCompletion() { - static const QRegularExpression wordRegEx(QLatin1String("\\w{1,}")); + static const QRegularExpression wordRegEx(QStringLiteral("\\w{1,}")); QRegularExpressionMatch match; QStringList foundWords; diff --git a/src/vimode/modes/normalvimode.cpp b/src/vimode/modes/normalvimode.cpp --- a/src/vimode/modes/normalvimode.cpp +++ b/src/vimode/modes/normalvimode.cpp @@ -1091,7 +1091,7 @@ if (nonEmptyLineFound && leftTrimmedLastLine.isEmpty()) { // joinLines won't have added a trailing " ", whereas Vim does - follow suit. - doc()->insertText(KTextEditor::Cursor(from, doc()->lineLength(from)), QLatin1String(" ")); + doc()->insertText(KTextEditor::Cursor(from, doc()->lineLength(from)), QStringLiteral(" ")); } // Position cursor just before first non-whitesspace character of what was the last line joined. @@ -3212,7 +3212,7 @@ if (QStringLiteral(".!?").indexOf(line.at(j)) != -1) { prev = j++; // Skip possible closing characters. - for (; j < line.size() && QString::fromLatin1("\"')]").indexOf(line.at(j)) != -1; j++); + for (; j < line.size() && QStringLiteral("\"')]").indexOf(line.at(j)) != -1; j++); if (j >= line.size()) { return KTextEditor::Cursor(i, j - 1);