Commit 63963320 authored by David Jarvie's avatar David Jarvie
Browse files

QRegExp -> QRegularExpression

parent 5ac7ad15
Pipeline #211604 passed with stage
in 1 minute and 50 seconds
KAlarm Change Log
=== Version 3.5.1 (KDE Gear 22.12) --- 1 August 2022 ===
* Improve Qt6 compatibility.
=== Version 3.5.0 (KDE Gear 22.08) --- 19 July 2022 ===
* Provide options to build and/or run KAlarm without any Akonadi dependency.
* Set volume correctly for repeated audio alarms [KDE Bug 456845]
......
......@@ -26,7 +26,7 @@
#include <QCheckBox>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QRegExp>
#include <QRegularExpression>
using namespace KAlarmCal;
......@@ -215,7 +215,7 @@ void Find::slotFind()
return;
mHistory = mDialog->findHistory(); // save search history so that it can be displayed again
mOptions = mDialog->options() & ~FIND_KALARM_OPTIONS;
if ((mOptions & KFind::RegularExpression) && !QRegExp(mDialog->pattern()).isValid())
if ((mOptions & KFind::RegularExpression) && !QRegularExpression(mDialog->pattern()).isValid())
return;
mOptions |= (mLive->isEnabled() && mLive->isChecked() ? FIND_LIVE : 0)
| (mArchived->isEnabled() && mArchived->isChecked() ? FIND_ARCHIVED : 0)
......
/*
* lib/file.cpp - functions to handle files
* Program: kalarm
* SPDX-FileCopyrightText: 2005-2021 David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2005-2022 David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -18,7 +18,7 @@
#include <KFileItem>
#include <QDir>
#include <QRegExp>
#include <QRegularExpression>
#include <QFileDialog>
namespace File
......@@ -98,10 +98,7 @@ bool showFileErrMessage(const QString& filename, FileErr err, FileErr blankError
if (err != FileErr::None)
{
// If file is a local file, remove "file://" from name
QString file = filename;
const QRegExp f(QStringLiteral("^file:/+"));
if (f.indexIn(file) >= 0)
file = file.mid(f.matchedLength() - 1);
const QString file = pathOrUrl(filename);
QString errmsg;
switch (err)
......@@ -136,8 +133,9 @@ bool showFileErrMessage(const QString& filename, FileErr err, FileErr blankError
*/
QString pathOrUrl(const QString& url)
{
static const QRegExp localfile(QStringLiteral("^file:/+"));
return (localfile.indexIn(url) >= 0) ? url.mid(localfile.matchedLength() - 1) : url;
const QRegularExpression re(QStringLiteral("^file:/+"));
const QRegularExpressionMatch match = re.match(url);
return match.hasMatch() ? url.mid(match.capturedEnd(0) - 1) : url;
}
/******************************************************************************
......@@ -165,7 +163,7 @@ bool browseFile(QString& file, const QString& caption, QString& defaultDir,
bool existing, QWidget* parent)
{
file.clear();
const QString initialDir = !initialFile.isEmpty() ? QString(initialFile).remove(QRegExp(QLatin1String("/[^/]*$")))
const QString initialDir = !initialFile.isEmpty() ? pathOrUrl(initialFile).remove(QRegularExpression(QLatin1String("/[^/]*$")))
: !defaultDir.isEmpty() ? defaultDir
: QDir::homePath();
// Use AutoQPointer to guard against crash on application exit while
......
......@@ -17,7 +17,6 @@
#include <KShell>
#include <QUrl>
#include <QRegExp>
#include <QMimeData>
#include <QDragEnterEvent>
#include <QDropEvent>
......
......@@ -44,7 +44,7 @@
#include <QUrl>
#include <QTextBrowser>
#include <QTemporaryFile>
#include <QRegExp>
#include <QRegularExpression>
using namespace KAlarmCal;
......@@ -210,10 +210,10 @@ void MessageDisplayHelper::initTexts()
// start of the translated string, allowing for possible HTML tags
// enclosing "Reminder".
QString s = i18nc("@info", "Reminder");
QRegExp re(QStringLiteral("^(<[^>]+>)*")); // search for HTML tag "<...>"
(void) re.indexIn(s);
const QRegularExpression re(QStringLiteral("^(<[^>]+>)*")); // search for HTML tag "<...>"
const QRegularExpressionMatch match = re.match(s);
// Prefix the time, plus a newline, to "Reminder", inside any HTML tags.
s.insert(re.matchedLength(), mTexts.time + QLatin1String("<br/>"));
s.insert(match.capturedEnd(0), mTexts.time + QLatin1String("<br/>"));
mTexts.timeFull = s;
}
}
......
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