Commit 32773a54 authored by David Jarvie's avatar David Jarvie
Browse files

QRegExp -> QRegularExpression

parent 63963320
Pipeline #211617 passed with stage
in 2 minutes and 9 seconds
......@@ -15,7 +15,7 @@
#include <QStringList>
#include <QDateTime>
#include <QLocale>
#include <QRegExp>
#include <QRegularExpression>
namespace
{
......@@ -302,23 +302,29 @@ KAEvent::EmailId AlarmText::emailId() const
*/
QString AlarmText::summary(const KAEvent& event, int maxLines, bool* truncated)
{
static const QRegExp localfile(QStringLiteral("^file:/+"));
static const QRegularExpression re(QStringLiteral("^file:/+"));
QString text;
switch (event.actionSubType())
{
case KAEvent::AUDIO:
{
text = event.audioFile();
if (localfile.indexIn(text) >= 0)
text = text.mid(localfile.matchedLength() - 1);
const QRegularExpressionMatch match = re.match(text);
if (match.hasMatch())
text = text.mid(match.capturedEnd(0) - 1);
break;
}
case KAEvent::EMAIL:
text = event.emailSubject();
break;
case KAEvent::COMMAND:
{
text = event.cleanText();
if (localfile.indexIn(text) >= 0)
text = text.mid(localfile.matchedLength() - 1);
const QRegularExpressionMatch match = re.match(text);
if (match.hasMatch())
text = text.mid(match.capturedEnd(0) - 1);
break;
}
case KAEvent::FILE:
text = event.cleanText();
break;
......
......@@ -133,7 +133,7 @@ bool showFileErrMessage(const QString& filename, FileErr err, FileErr blankError
*/
QString pathOrUrl(const QString& url)
{
const QRegularExpression re(QStringLiteral("^file:/+"));
static const QRegularExpression re(QStringLiteral("^file:/+"));
const QRegularExpressionMatch match = re.match(url);
return match.hasMatch() ? url.mid(match.capturedEnd(0) - 1) : url;
}
......
......@@ -677,7 +677,7 @@ bool ResourceView::viewportEvent(QEvent* e)
int i = toolTip.indexOf(QLatin1Char('@'));
if (i > 0)
{
const int j = toolTip.indexOf(QRegExp(QLatin1String("<(nl|br)"), Qt::CaseInsensitive), i + 1);
const int j = toolTip.indexOf(QRegularExpression(QLatin1String("<(nl|br)"), QRegularExpression::CaseInsensitiveOption), i + 1);
const int k = toolTip.indexOf(QLatin1Char('@'), j);
const QString name = toolTip.mid(i + 1, j - i - 1);
value = model()->data(index, Qt::FontRole);
......
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