Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Akonadi
Commits
59931b91
Commit
59931b91
authored
Jul 31, 2020
by
Ahmad Samir
Committed by
Daniel Vrátil
Aug 07, 2020
Browse files
Port QRegExp to QRegularExpression
Port QRegExp::exactMatch by using QRegularExpression::anchoredPattern.
parent
d1f66f33
Pipeline
#29972
passed with stage
in 39 minutes and 29 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/core/models/agentfilterproxymodel.cpp
View file @
59931b91
...
...
@@ -32,7 +32,7 @@ public:
QStringList
mimeTypes
;
QStringList
capabilities
;
QStringList
excludeCapabilities
;
bool
filterAcceptRegExp
(
const
QModelIndex
&
index
,
const
QReg
Exp
&
filterRegExpStr
);
bool
filterAcceptRegExp
(
const
QModelIndex
&
index
,
const
QReg
ularExpression
&
filterRegExpStr
);
};
AgentFilterProxyModel
::
AgentFilterProxyModel
(
QObject
*
parent
)
...
...
@@ -73,10 +73,10 @@ void AgentFilterProxyModel::clearFilters()
invalidateFilter
();
}
bool
AgentFilterProxyModel
::
Private
::
filterAcceptRegExp
(
const
QModelIndex
&
index
,
const
QReg
Exp
&
filterRegExpStr
)
bool
AgentFilterProxyModel
::
Private
::
filterAcceptRegExp
(
const
QModelIndex
&
index
,
const
QReg
ularExpression
&
filterRegExpStr
)
{
// First see if the name matches a set regexp filter.
if
(
!
filterRegExpStr
.
isEmpty
())
{
if
(
!
filterRegExpStr
.
pattern
().
isEmpty
())
{
return
index
.
data
(
AgentTypeModel
::
IdentifierRole
).
toString
().
contains
(
filterRegExpStr
)
||
index
.
data
().
toString
().
contains
(
filterRegExpStr
);
}
...
...
@@ -145,5 +145,5 @@ bool AgentFilterProxyModel::filterAcceptsRow(int row, const QModelIndex & /*sour
}
}
return
d
->
filterAcceptRegExp
(
index
,
filterReg
Exp
());
return
d
->
filterAcceptRegExp
(
index
,
filterReg
ularExpression
());
}
src/core/typepluginloader.cpp
View file @
59931b91
...
...
@@ -20,6 +20,7 @@
#include
<QStringList>
#include
<QMimeDatabase>
#include
<QMimeType>
#include
<QRegularExpression>
#include
<boost/graph/adjacency_list.hpp>
#include
<boost/graph/topological_sort.hpp>
...
...
@@ -217,14 +218,15 @@ public:
qCDebug
(
AKONADICORE_LOG
)
<<
"ItemSerializerPluginLoader: "
<<
"found"
<<
names
.
size
()
<<
"plugins."
;
QMap
<
QString
,
MimeTypeEntry
>
map
;
QReg
Exp
rx
(
QStringLiteral
(
"(.+)@(.+)"
));
QReg
ularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
QStringLiteral
(
"(.+)@(.+)"
))
)
;
QMimeDatabase
mimeDb
;
for
(
const
QString
&
name
:
names
)
{
if
(
rx
.
exactMatch
(
name
))
{
const
QMimeType
mime
=
mimeDb
.
mimeTypeForName
(
rx
.
cap
(
1
));
QRegularExpressionMatch
match
=
rx
.
match
(
name
);
if
(
match
.
hasMatch
())
{
const
QMimeType
mime
=
mimeDb
.
mimeTypeForName
(
match
.
captured
(
1
));
if
(
mime
.
isValid
())
{
const
QString
mimeType
=
mime
.
name
();
const
QByteArray
classType
=
rx
.
cap
(
2
).
toLatin1
();
const
QByteArray
classType
=
match
.
captured
(
2
).
toLatin1
();
QMap
<
QString
,
MimeTypeEntry
>::
iterator
it
=
map
.
find
(
mimeType
);
if
(
it
==
map
.
end
())
{
it
=
map
.
insert
(
mimeType
,
MimeTypeEntry
(
mimeType
));
...
...
src/rds/bridgeconnection.cpp
View file @
59931b91
...
...
@@ -10,7 +10,7 @@
#include
<QDebug>
#include
<QMetaObject>
#include
<QReg
Exp
>
#include
<QReg
ularExpression
>
#include
<QSettings>
#include
<QLocalSocket>
#include
<QTcpSocket>
...
...
@@ -75,9 +75,10 @@ void DBusBridgeConnection::connectLocal()
// TODO: support for !Linux
#ifdef Q_OS_UNIX
const
QByteArray
sessionBusAddress
=
qgetenv
(
"DBUS_SESSION_BUS_ADDRESS"
);
QRegExp
rx
(
QStringLiteral
(
"=(.*)[,$]"
));
if
(
rx
.
indexIn
(
QString
::
fromLatin1
(
sessionBusAddress
))
>=
0
)
{
const
QString
dbusPath
=
rx
.
cap
(
1
);
const
QRegularExpression
rx
(
QStringLiteral
(
"=(.*)[,$]"
));
QRegularExpressionMatch
match
=
rx
.
match
(
QString
::
fromLatin1
(
sessionBusAddress
));
if
(
match
.
hasMatch
())
{
const
QString
dbusPath
=
match
.
captured
(
1
);
qDebug
()
<<
dbusPath
;
if
(
sessionBusAddress
.
contains
(
"abstract"
))
{
const
int
fd
=
socket
(
PF_UNIX
,
SOCK_STREAM
,
0
);
...
...
src/widgets/standardactionmanager.cpp
View file @
59931b91
...
...
@@ -45,6 +45,7 @@
#include
<QItemSelectionModel>
#include
<QPointer>
#include
<QInputDialog>
#include
<QRegularExpression>
using
namespace
Akonadi
;
...
...
@@ -1536,7 +1537,7 @@ public:
}
const
QString
str
=
text
.
subs
(
count
).
toString
();
const
int
argCount
=
str
.
count
(
QReg
Exp
(
QStringLiteral
(
"%[0-9]"
)));
const
int
argCount
=
str
.
count
(
QReg
ularExpression
(
QStringLiteral
(
"%[0-9]"
)));
if
(
argCount
>
0
)
{
return
text
.
subs
(
count
).
subs
(
value
).
toString
();
}
else
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment