Commit 796f5db0 authored by Ahmad Samir's avatar Ahmad Samir Committed by Volker Krause
Browse files

Port QRegExp to QRegularExpression, second pass

With QRegularExpression, to match a literal '-' inside a character class
'[]', it must be either the first/last character inside the brackets or
escaped.
parent 62adba9b
Pipeline #30787 failed with stage
in 43 minutes and 2 seconds
......@@ -154,7 +154,7 @@ SetupServer::SetupServer(ImapResourceBase *parentResource, WId parent)
m_ui->checkInterval->setSingleStep(1);
// regex for evaluating a valid server name/ip
mValidator.setRegExp(QRegExp(QLatin1String("[A-Za-z0-9-_:.]*")));
mValidator.setRegularExpression(QRegularExpression(QStringLiteral("[A-Za-z0-9_:.-]*")));
m_ui->imapServer->setValidator(&mValidator);
m_ui->folderRequester->setMimeTypeFilter(
......
......@@ -14,7 +14,7 @@
#include <collection.h>
#include <KJob>
#include <QRegExpValidator>
#include <QRegularExpressionValidator>
class QPushButton;
class QComboBox;
namespace Ui {
......@@ -76,7 +76,7 @@ private:
QString m_vacationFileName;
KIdentityManagement::IdentityCombo *m_identityCombobox = nullptr;
QString m_oldResourceName;
QRegExpValidator mValidator;
QRegularExpressionValidator mValidator;
Akonadi::Collection mOldTrash;
FolderArchiveSettingPage *m_folderArchiveSettingPage = nullptr;
QPushButton *mOkButton = nullptr;
......
......@@ -5,7 +5,7 @@
*/
#include "timezoneconverter.h"
#include <QRegExp>
#include <QRegularExpression>
#include <QTimeZone>
#include "pimkolab_debug.h"
......@@ -46,14 +46,11 @@ QString TimezoneConverter::fromCityName(const QString &tz)
countryMap.insert(cityName, QString::fromUtf8(zone));
}
QRegExp locationFinder(QLatin1String("\\b([a-zA-Z])+\\b"), Qt::CaseSensitive, QRegExp::RegExp2);
int pos = 0;
while (pos >= 0) {
pos = locationFinder.indexIn(tz, pos);
if (pos >= 0) {
++pos;
}
const QString location = locationFinder.capturedTexts().first();
const QRegularExpression locationFinder(QStringLiteral("\\b([a-zA-Z])+\\b"));
QRegularExpressionMatchIterator iter = locationFinder.globalMatch(tz);
while (iter.hasNext()) {
QRegularExpressionMatch match = iter.next();
const QString location = match.captured(0);
qCDebug(PIMKOLAB_LOG) << "location " << location;
if (countryMap.contains(location)) {
qCDebug(PIMKOLAB_LOG) << "found match " << countryMap.value(location);
......
......@@ -64,7 +64,7 @@ AccountWidget::AccountWidget(Settings &settings, const QString &identifier, QWid
, mIdentifier(identifier)
, mSettings(settings)
{
mValidator.setRegExp(QRegExp(QLatin1String("[A-Za-z0-9-_:.]*")));
mValidator.setRegularExpression(QRegularExpression(QStringLiteral("[A-Za-z0-9_:.-]*")));
setupWidgets();
}
......
......@@ -67,7 +67,7 @@ private:
private:
QButtonGroup *encryptionButtonGroup = nullptr;
MailTransport::ServerTest *mServerTest = nullptr;
QRegExpValidator mValidator;
QRegularExpressionValidator mValidator;
bool mServerTestFailed = false;
KWallet::Wallet *mWallet = nullptr;
QString mInitalPassword;
......
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