Commit a4b32428 authored by Laurent Montel's avatar Laurent Montel
Browse files

Use QREgularExpression

parent 209e9c58
Pipeline #212684 passed with stage
in 53 seconds
......@@ -20,6 +20,7 @@
#include <QVBoxLayout>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QRegularExpression>
CheckoutDialog::CheckoutDialog(QWidget* parent):
QDialog(parent, Qt::Dialog),
......@@ -213,7 +214,7 @@ void CheckoutDialog::setOkButtonState()
m_newBranchName->setToolTip(tt);
okButton->setToolTip(tt);
}
if (newBranchName.contains(QRegExp("\\s"))) {
if (newBranchName.contains(QRegularExpression("\\s"))) {
enableButton = false;
newNameError = true;
const QString tt = i18nc("@info:tooltip", "Branch names may not contain any whitespace.");
......
......@@ -21,6 +21,7 @@
#include <QLabel>
#include <QLineEdit>
#include <QDialogButtonBox>
#include <QRegularExpression>
TagDialog::TagDialog (QWidget* parent ):
QDialog (parent, Qt::Dialog),
......@@ -125,7 +126,7 @@ void TagDialog::setOkButtonState()
if (tagName.isEmpty()) {
toolTip = i18nc("@info:tooltip", "You must enter a tag name first.");
}
else if (tagName.contains(QRegExp("\\s"))) {
else if (tagName.contains(QRegularExpression("\\s"))) {
toolTip = i18nc("@info:tooltip", "Tag names may not contain any whitespace.");
}
else if (m_tagNames.contains(tagName)) {
......
......@@ -41,6 +41,7 @@
#include <KLocalizedString>
#include <KPluginFactory>
#include <QRegularExpression>
K_PLUGIN_CLASS_WITH_JSON(FileViewHgPlugin, "fileviewhgplugin.json")
......@@ -780,7 +781,7 @@ void FileViewHgPlugin::rollback()
}
// get what will be rolled back
QString lastTransaction = m_hgWrapper->readAllStandardOutput();
int cutOfFrom = lastTransaction.indexOf(QRegExp("\\d"));
int cutOfFrom = lastTransaction.indexOf(QRegularExpression("\\d"));
lastTransaction = lastTransaction.mid(cutOfFrom);
// ask
......
......@@ -10,6 +10,7 @@
#include <QTextCodec>
#include <QUrl>
#include <QDebug>
#include <QRegularExpression>
//TODO: Replace start() with executeCommand functions wherever possible.
//FIXME: Add/Remove/Revert argument length limit. Divide the list.
......@@ -291,7 +292,7 @@ QStringList HgWrapper::getTags()
while (m_process.waitForReadyRead()) {
char buffer[1048];
while (m_process.readLine(buffer, sizeof(buffer)) > 0) {
result << QString(buffer).split(QRegExp("\\s+"),
result << QString(buffer).split(QRegularExpression("\\s+"),
Qt::SkipEmptyParts).first();
}
}
......@@ -308,7 +309,7 @@ QStringList HgWrapper::getBranches()
// 'hg branches' command lists the branches in following format
// <branchname> <revision:changeset_hash> [(inactive)]
// Extract just the branchname
result << QString(buffer).remove(QRegExp("[\\s]+[\\d:a-zA-Z\\(\\)]*"));
result << QString(buffer).remove(QRegularExpression("[\\s]+[\\d:a-zA-Z\\(\\)]*"));
}
}
return result;
......
......@@ -397,29 +397,29 @@ QSharedPointer< QVector<logEntry> > SvnCommands::getLog(const QString& filePath,
QXmlStreamReader xml(&process);
int itemsAppended = 0;
if (xml.readNextStartElement() && xml.name() == "log") {
if (xml.readNextStartElement() && xml.name() == QLatin1String("log")) {
while (!xml.atEnd() && xml.readNext() != QXmlStreamReader::EndDocument) {
if (!xml.isStartElement() || xml.name() != "logentry") {
if (!xml.isStartElement() || xml.name() != QLatin1String("logentry")) {
continue;
}
logEntry entry;
entry.revision = xml.attributes().value("revision").toULong();
if (xml.readNextStartElement() && xml.name() == "author") {
if (xml.readNextStartElement() && xml.name() == QLatin1String("author")) {
entry.author = xml.readElementText();
}
if (xml.readNextStartElement() && xml.name() == "date") {
if (xml.readNextStartElement() && xml.name() == QLatin1String("date")) {
entry.date = QDateTime::fromString(xml.readElementText(), Qt::ISODateWithMs);
}
if (xml.readNextStartElement() && xml.name() == "paths") {
while (xml.readNextStartElement() && xml.name() == "path") {
if (xml.readNextStartElement() && xml.name() == QLatin1String("paths")) {
while (xml.readNextStartElement() && xml.name() == QLatin1String("path")) {
affectedPath path;
path.action = xml.attributes().value("action").toString();
path.propMods = xml.attributes().value("prop-mods").toString() == "true";
path.textMods = xml.attributes().value("text-mods").toString() == "true";
path.propMods = xml.attributes().value("prop-mods").toString() == QLatin1String("true");
path.textMods = xml.attributes().value("text-mods").toString() == QLatin1String("true");
path.kind = xml.attributes().value("kind").toString();
path.path = xml.readElementText();
......@@ -428,7 +428,7 @@ QSharedPointer< QVector<logEntry> > SvnCommands::getLog(const QString& filePath,
}
}
if (xml.readNextStartElement() && xml.name() == "msg") {
if (xml.readNextStartElement() && xml.name() == QLatin1String("msg")) {
entry.msg = xml.readElementText();
}
......
Supports Markdown
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