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

Port some deprecated methods

parent 7da517c6
......@@ -154,7 +154,11 @@ static BtInfo parseBtLine(const QString &line)
QList<BtInfo> KateBtParser::parseBacktrace(const QString &bt)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList l = bt.split(eolDelimiter(bt), QString::SkipEmptyParts);
#else
QStringList l = bt.split(eolDelimiter(bt), Qt::SkipEmptyParts);
#endif
l = normalizeBt(l);
......
......@@ -313,7 +313,11 @@ void KateBtConfigWidget::apply()
QString filter = edtExtensions->text();
filter.replace(QLatin1Char(','), QLatin1Char(' ')).replace(QLatin1Char(';'), QLatin1Char(' '));
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
cg.writeEntry("file-extensions", filter.split(QLatin1Char(' '), QString::SkipEmptyParts));
#else
cg.writeEntry("file-extensions", filter.split(QLatin1Char(' '), Qt::SkipEmptyParts));
#endif
KateBtBrowserPlugin::self().startIndexer();
m_changed = false;
......
......@@ -199,7 +199,11 @@ void KateExternalToolServiceEditor::slotOKClicked()
void KateExternalToolServiceEditor::showMTDlg()
{
QString text = i18n("Select the MimeTypes for which to enable this tool.");
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList list = ui->edtMimeType->text().split(QRegularExpression(QStringLiteral("\\s*;\\s*")), QString::SkipEmptyParts);
#else
QStringList list = ui->edtMimeType->text().split(QRegularExpression(QStringLiteral("\\s*;\\s*")), Qt::SkipEmptyParts);
#endif
KMimeTypeChooserDialog d(i18n("Select Mime Types"), text, list, QStringLiteral("text"), this);
if (d.exec() == QDialog::Accepted) {
ui->edtMimeType->setText(d.chooser()->mimeTypes().join(QStringLiteral(";")));
......@@ -373,7 +377,11 @@ bool KateExternalToolsConfigWidget::editTool(KateExternalTool *tool)
tool->arguments = editor.ui->edtArgs->text();
tool->input = editor.ui->edtInput->toPlainText();
tool->workingDir = editor.ui->edtWorkingDir->text();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
tool->mimetypes = editor.ui->edtMimeType->text().split(QRegularExpression(QStringLiteral("\\s*;\\s*")), QString::SkipEmptyParts);
#else
tool->mimetypes = editor.ui->edtMimeType->text().split(QRegularExpression(QStringLiteral("\\s*;\\s*")), Qt::SkipEmptyParts);
#endif
tool->saveMode = static_cast<KateExternalTool::SaveMode>(editor.ui->cmbSave->currentIndex());
tool->reload = editor.ui->chkReload->isChecked();
tool->outputMode = static_cast<KateExternalTool::OutputMode>(editor.ui->cmbOutput->currentIndex());
......
......@@ -1069,7 +1069,11 @@ void KateFileTreeModel::insertItemInto(ProxyItemDir *root, ProxyItem *item)
QString tail = item->path();
tail.remove(0, root->path().length());
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList parts = tail.split(QLatin1Char('/'), QString::SkipEmptyParts);
#else
QStringList parts = tail.split(QLatin1Char('/'), Qt::SkipEmptyParts);
#endif
ProxyItemDir *ptr = root;
QStringList current_parts;
current_parts.append(root->path());
......
......@@ -259,7 +259,11 @@ const GDBTargetConf ConfigView::currentTarget() const
} else if (cfg.customInit[i].startsWith(QLatin1String("set directories "))) {
QString paths = cfg.customInit[i];
paths.remove(QStringLiteral("set directories "));
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
cfg.srcPaths = paths.split(pathSeparator, QString::SkipEmptyParts);
#else
cfg.srcPaths = paths.split(pathSeparator, Qt::SkipEmptyParts);
#endif
}
i--;
}
......
......@@ -346,7 +346,11 @@ void DebugView::processLine(QString line)
} else if (breakPointDel.match(line).hasMatch()) {
line.remove(QStringLiteral("Deleted breakpoint"));
line.remove(QLatin1Char('s')); // in case of multiple breakpoints
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList numbers = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
#else
QStringList numbers = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#endif
for (int i = 0; i < numbers.size(); i++) {
for (int j = 0; j < m_breakPointList.size(); j++) {
if (numbers[i].toInt() == m_breakPointList[j].number) {
......
......@@ -301,7 +301,11 @@ QStringList KateProjectWorker::filesFromMercurial(const QDir &dir, bool recursiv
return files;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList relFiles = QString::fromLocal8Bit(hg.readAllStandardOutput()).split(QRegularExpression(QStringLiteral("[\n\r]")), QString::SkipEmptyParts);
#else
const QStringList relFiles = QString::fromLocal8Bit(hg.readAllStandardOutput()).split(QRegularExpression(QStringLiteral("[\n\r]")), Qt::SkipEmptyParts);
#endif
for (const QString &relFile : relFiles) {
if (!recursive && (relFile.indexOf(QLatin1Char('/')) != -1)) {
......@@ -335,7 +339,11 @@ QStringList KateProjectWorker::filesFromSubversion(const QDir &dir, bool recursi
/**
* get output and split up into lines
*/
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList lines = QString::fromLocal8Bit(svn.readAllStandardOutput()).split(QRegularExpression(QStringLiteral("[\n\r]")), QString::SkipEmptyParts);
#else
const QStringList lines = QString::fromLocal8Bit(svn.readAllStandardOutput()).split(QRegularExpression(QStringLiteral("[\n\r]")), Qt::SkipEmptyParts);
#endif
/**
* remove start of line that is no filename, sort out unknown and ignore
......@@ -415,7 +423,11 @@ QStringList KateProjectWorker::filesFromDarcs(const QDir &dir, bool recursive)
if (!darcs.waitForStarted() || !darcs.waitForFinished(-1))
return files;
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
relFiles = QString::fromLocal8Bit(darcs.readAllStandardOutput()).split(QRegularExpression(QStringLiteral("[\n\r]")), QString::SkipEmptyParts);
#else
relFiles = QString::fromLocal8Bit(darcs.readAllStandardOutput()).split(QRegularExpression(QStringLiteral("[\n\r]")), Qt::SkipEmptyParts);
#endif
}
for (const QString &relFile : relFiles) {
......
......@@ -76,7 +76,11 @@ QString KateProjectCodeAnalysisToolCppcheck::notInstalledMessage() const
QStringList KateProjectCodeAnalysisToolCppcheck::parseLine(const QString &line) const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
return line.split(QRegularExpression(QStringLiteral("////")), QString::SkipEmptyParts);
#else
return line.split(QRegularExpression(QStringLiteral("////")), Qt::SkipEmptyParts);
#endif
}
QString KateProjectCodeAnalysisToolCppcheck::stdinMessages()
......
......@@ -90,7 +90,11 @@ QString KateProjectCodeAnalysisToolFlake8::notInstalledMessage() const
QStringList KateProjectCodeAnalysisToolFlake8::parseLine(const QString &line) const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
return line.split(QRegularExpression(QStringLiteral("////")), QString::SkipEmptyParts);
#else
return line.split(QRegularExpression(QStringLiteral("////")), Qt::SkipEmptyParts);
#endif
}
QString KateProjectCodeAnalysisToolFlake8::stdinMessages()
......
......@@ -66,7 +66,11 @@ void FolderFilesList::generateList(const QString &folder, bool recursive, bool h
m_binary = binary;
m_types.clear();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const auto typesList = types.split(QLatin1Char(','), QString::SkipEmptyParts);
#else
const auto typesList = types.split(QLatin1Char(','), Qt::SkipEmptyParts);
#endif
for (const QString &type : typesList) {
m_types << type.trimmed();
}
......
......@@ -30,7 +30,11 @@ KateSearchCommand::KateSearchCommand(QObject *parent)
bool KateSearchCommand::exec(KTextEditor::View * /*view*/, const QString &cmd, QString & /*msg*/, const KTextEditor::Range &)
{
// create a list of args
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList args(cmd.split(QLatin1Char(' '), QString::KeepEmptyParts));
#else
QStringList args(cmd.split(QLatin1Char(' '), Qt::KeepEmptyParts));
#endif
QString command = args.takeFirst();
QString searchText = args.join(QLatin1Char(' '));
......
......@@ -305,7 +305,11 @@ void SnippetRepository::slotParseFile()
}
setLicense(docElement.attribute(QStringLiteral("license")));
setAuthors(docElement.attribute(QStringLiteral("authors")));
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
setFileTypes(docElement.attribute(QStringLiteral("filetypes")).split(QLatin1Char(';'), QString::SkipEmptyParts));
#else
setFileTypes(docElement.attribute(QStringLiteral("filetypes")).split(QLatin1Char(';'), Qt::SkipEmptyParts));
#endif
setText(docElement.attribute(QStringLiteral("name")));
setCompletionNamespace(docElement.attribute(QStringLiteral("namespace")));
......
......@@ -196,7 +196,11 @@ void PluginKateXMLCheckView::slotProcExited(int exitCode, QProcess::ExitStatus e
list_count++;
}
if (!proc_stderr.isEmpty()) {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList lines = proc_stderr.split('\n', QString::SkipEmptyParts);
#else
QStringList lines = proc_stderr.split('\n', Qt::SkipEmptyParts);
#endif
QString linenumber, msg;
int line_count = 0;
for (QStringList::Iterator it = lines.begin(); it != lines.end(); ++it) {
......
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