Replace QRegExp usages with QRegularExpression
QRegExp is deprecated in favor QRegularExpression. It's potentially an api breaking change as QRegularExpression has a different pattern syntax.
This commit is contained in:
parent
c61085dc2e
commit
da169ee2d9
2 changed files with 11 additions and 10 deletions
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include <kconfig.h>
|
#include <kconfig.h>
|
||||||
#include <KXMessages>
|
#include <KXMessages>
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
@ -335,7 +335,7 @@ bool Rules::matchWMClass(const QByteArray& match_class, const QByteArray& match_
|
||||||
// TODO optimize?
|
// TODO optimize?
|
||||||
QByteArray cwmclass = wmclasscomplete
|
QByteArray cwmclass = wmclasscomplete
|
||||||
? match_name + ' ' + match_class : match_class;
|
? match_name + ' ' + match_class : match_class;
|
||||||
if (wmclassmatch == RegExpMatch && QRegExp(QString::fromUtf8(wmclass)).indexIn(QString::fromUtf8(cwmclass)) == -1)
|
if (wmclassmatch == RegExpMatch && !QRegularExpression(QString::fromUtf8(wmclass)).match(QString::fromUtf8(cwmclass)).hasMatch())
|
||||||
return false;
|
return false;
|
||||||
if (wmclassmatch == ExactMatch && wmclass != cwmclass)
|
if (wmclassmatch == ExactMatch && wmclass != cwmclass)
|
||||||
return false;
|
return false;
|
||||||
|
@ -348,7 +348,7 @@ bool Rules::matchWMClass(const QByteArray& match_class, const QByteArray& match_
|
||||||
bool Rules::matchRole(const QByteArray& match_role) const
|
bool Rules::matchRole(const QByteArray& match_role) const
|
||||||
{
|
{
|
||||||
if (windowrolematch != UnimportantMatch) {
|
if (windowrolematch != UnimportantMatch) {
|
||||||
if (windowrolematch == RegExpMatch && QRegExp(QString::fromUtf8(windowrole)).indexIn(QString::fromUtf8(match_role)) == -1)
|
if (windowrolematch == RegExpMatch && !QRegularExpression(QString::fromUtf8(windowrole)).match(QString::fromUtf8(match_role)).hasMatch())
|
||||||
return false;
|
return false;
|
||||||
if (windowrolematch == ExactMatch && windowrole != match_role)
|
if (windowrolematch == ExactMatch && windowrole != match_role)
|
||||||
return false;
|
return false;
|
||||||
|
@ -361,7 +361,7 @@ bool Rules::matchRole(const QByteArray& match_role) const
|
||||||
bool Rules::matchTitle(const QString& match_title) const
|
bool Rules::matchTitle(const QString& match_title) const
|
||||||
{
|
{
|
||||||
if (titlematch != UnimportantMatch) {
|
if (titlematch != UnimportantMatch) {
|
||||||
if (titlematch == RegExpMatch && QRegExp(title).indexIn(match_title) == -1)
|
if (titlematch == RegExpMatch && !QRegularExpression(title).match(match_title).hasMatch())
|
||||||
return false;
|
return false;
|
||||||
if (titlematch == ExactMatch && title != match_title)
|
if (titlematch == ExactMatch && title != match_title)
|
||||||
return false;
|
return false;
|
||||||
|
@ -379,7 +379,7 @@ bool Rules::matchClientMachine(const QByteArray& match_machine, bool local) cons
|
||||||
&& matchClientMachine("localhost", true))
|
&& matchClientMachine("localhost", true))
|
||||||
return true;
|
return true;
|
||||||
if (clientmachinematch == RegExpMatch
|
if (clientmachinematch == RegExpMatch
|
||||||
&& QRegExp(QString::fromUtf8(clientmachine)).indexIn(QString::fromUtf8(match_machine)) == -1)
|
&& !QRegularExpression(QString::fromUtf8(clientmachine)).match(QString::fromUtf8(match_machine)).hasMatch())
|
||||||
return false;
|
return false;
|
||||||
if (clientmachinematch == ExactMatch
|
if (clientmachinematch == ExactMatch
|
||||||
&& clientmachine != match_machine)
|
&& clientmachine != match_machine)
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
#include <KGlobalAccel>
|
#include <KGlobalAccel>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <kconfig.h>
|
#include <kconfig.h>
|
||||||
#include <QRegExp>
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QWidgetAction>
|
#include <QWidgetAction>
|
||||||
#include <kauthorized.h>
|
#include <kauthorized.h>
|
||||||
|
|
||||||
|
@ -1740,15 +1740,16 @@ void AbstractClient::setShortcut(const QString& _cut)
|
||||||
updateShortcut();
|
updateShortcut();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const QRegularExpression reg(QStringLiteral("(.*\\+)\\((.*)\\)"));
|
||||||
QList< QKeySequence > keys;
|
QList< QKeySequence > keys;
|
||||||
QStringList groups = cut.split(QStringLiteral(" - "));
|
QStringList groups = cut.split(QStringLiteral(" - "));
|
||||||
for (QStringList::ConstIterator it = groups.constBegin();
|
for (QStringList::ConstIterator it = groups.constBegin();
|
||||||
it != groups.constEnd();
|
it != groups.constEnd();
|
||||||
++it) {
|
++it) {
|
||||||
QRegExp reg(QStringLiteral("(.*\\+)\\((.*)\\)"));
|
const QRegularExpressionMatch match = reg.match(*it);
|
||||||
if (reg.indexIn(*it) > -1) {
|
if (match.hasMatch()) {
|
||||||
QString base = reg.cap(1);
|
const QString base = match.captured(1);
|
||||||
QString list = reg.cap(2);
|
const QString list = match.captured(2);
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
i < list.length();
|
i < list.length();
|
||||||
++i) {
|
++i) {
|
||||||
|
|
Loading…
Reference in a new issue