Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
KDE PIM Runtime
Commits
62adba9b
Commit
62adba9b
authored
Jul 31, 2020
by
Ahmad Samir
Committed by
Volker Krause
Aug 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port QRegExp to QRegularExpression, first pass
parent
85f969cf
Pipeline
#30707
failed with stage
in 38 minutes and 26 seconds
Changes
6
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
30 deletions
+44
-30
kioslave/pop3/pop3.cpp
kioslave/pop3/pop3.cpp
+3
-2
resources/dav/resource/settings.cpp
resources/dav/resource/settings.cpp
+2
-2
resources/dav/resource/setupwizard.cpp
resources/dav/resource/setupwizard.cpp
+4
-4
resources/kolab/pimkolab/autotests/testutils.h
resources/kolab/pimkolab/autotests/testutils.h
+31
-20
resources/openxchange/oxa/contactutils.cpp
resources/openxchange/oxa/contactutils.cpp
+2
-1
resources/openxchange/oxa/incidenceutils.cpp
resources/openxchange/oxa/incidenceutils.cpp
+2
-1
No files found.
kioslave/pop3/pop3.cpp
View file @
62adba9b
...
...
@@ -15,7 +15,7 @@ extern "C" {
#include <QCoreApplication>
#include <QByteArray>
#include <QReg
Exp
>
#include <QReg
ularExpression
>
#include "pop3_debug.h"
#include <KLocalizedString>
...
...
@@ -654,7 +654,8 @@ bool POP3Protocol::pop3_open()
// Does the server support APOP?
//QString apop_cmd;
QRegExp
re
(
QStringLiteral
(
"<[A-Za-z0-9
\\
.
\\
-_]+@[A-Za-z0-9
\\
.
\\
-_]+>$"
),
Qt
::
CaseInsensitive
);
const
QRegularExpression
re
(
QStringLiteral
(
"<[A-Za-z0-9
\\
.
\\
-_]+@[A-Za-z0-9
\\
.
\\
-_]+>$"
),
QRegularExpression
::
CaseInsensitiveOption
);
qCDebug
(
POP3_LOG
)
<<
"greeting: "
<<
greeting
;
int
apop_pos
=
greeting
.
indexOf
(
re
);
...
...
resources/dav/resource/settings.cpp
View file @
62adba9b
...
...
@@ -26,7 +26,7 @@
#include <QFile>
#include <QFileInfo>
#include <QPointer>
#include <QReg
Exp
>
#include <QReg
ularExpression
>
#include <QUrl>
#include <QDBusConnection>
#include <QHBoxLayout>
...
...
@@ -517,7 +517,7 @@ void Settings::updateToV2()
QString
urlConfigStr
=
urls
.
at
(
0
);
UrlConfiguration
urlConfig
(
urlConfigStr
);
QRegExp
regexp
(
QLatin1Char
(
'^'
)
+
urlConfig
.
mUser
);
const
QRegularExpression
regexp
(
QStringLiteral
(
"^"
)
+
urlConfig
.
mUser
);
QMutableStringListIterator
it
(
urls
);
while
(
it
.
hasNext
())
{
...
...
resources/dav/resource/setupwizard.cpp
View file @
62adba9b
...
...
@@ -24,7 +24,7 @@
#include <QLabel>
#include <QPushButton>
#include <QRadioButton>
#include <QReg
Exp
Validator>
#include <QReg
ularExpression
Validator>
enum
GroupwareServers
{
Citadel
,
...
...
@@ -65,7 +65,7 @@ static QString settingsToUrl(const QWizard *wizard, const QString &protocol)
QString
username
=
wizard
->
field
(
QStringLiteral
(
"credentialsUserName"
)).
toString
();
QString
localPart
(
username
);
localPart
.
remove
(
QReg
Exp
(
QLatin1String
(
"@.*$"
)));
localPart
.
remove
(
QReg
ularExpression
(
QStringLiteral
(
"@.*$"
)));
pathPattern
.
replace
(
QLatin1String
(
"$user$"
),
username
);
pathPattern
.
replace
(
QLatin1String
(
"$localpart$"
),
localPart
);
QString
providerName
;
...
...
@@ -377,10 +377,10 @@ ConnectionPage::ConnectionPage(QWidget *parent)
setSubTitle
(
i18n
(
"Enter the connection information for the groupware server"
));
mLayout
=
new
QFormLayout
(
this
);
QRegExp
hostnameRegexp
(
QStringLiteral
(
"^[a-z0-9][.a-z0-9-]*[a-z0-9](?::[0-9]+)?$"
));
const
QRegularExpression
hostnameRegexp
(
QStringLiteral
(
"^[a-z0-9][.a-z0-9-]*[a-z0-9](?::[0-9]+)?$"
));
mHost
=
new
QLineEdit
;
registerField
(
QStringLiteral
(
"connectionHost*"
),
mHost
);
mHost
->
setValidator
(
new
QReg
Exp
Validator
(
hostnameRegexp
,
this
));
mHost
->
setValidator
(
new
QReg
ularExpression
Validator
(
hostnameRegexp
,
this
));
mLayout
->
addRow
(
i18n
(
"Host"
),
mHost
);
mPath
=
new
QLineEdit
;
...
...
resources/kolab/pimkolab/autotests/testutils.h
View file @
62adba9b
...
...
@@ -9,6 +9,7 @@
#include <QUuid>
#include <QFile>
#include <QRegularExpression>
#include <kolabevent.h>
#include <kmime/kmime_message.h>
...
...
@@ -84,36 +85,46 @@ KMime::Message::Ptr readMimeFile(const QString &fileName, bool &ok)
void
normalizeMimemessage
(
QString
&
content
)
{
content
.
replace
(
QRegExp
(
QStringLiteral
(
"
\\
bLibkolab-
\\
d.
\\
d.
\\
d
\\
b"
),
Qt
::
CaseSensitive
),
QStringLiteral
(
"Libkolab-x.x.x"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"
\\
bLibkolabxml-
\\
d.
\\
d.
\\
d
\\
b"
),
Qt
::
CaseSensitive
),
QStringLiteral
(
"Libkolabxml-x.x.x"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"
\\
bLibkolab-
\\
d.
\\
d
\\
b"
),
Qt
::
CaseSensitive
),
QStringLiteral
(
"Libkolab-x.x.x"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"
\\
bkdepim-runtime-
\\
d.
\\
d
\\
b"
),
Qt
::
CaseSensitive
),
QStringLiteral
(
"Libkolab-x.x.x"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"
\\
bLibkolabxml-
\\
d.
\\
d
\\
b"
),
Qt
::
CaseSensitive
),
QStringLiteral
(
"Libkolabxml-x.x.x"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"<uri>cid:*@kolab.resource.akonadi</uri>"
),
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
QStringLiteral
(
"<uri>cid:id@kolab.resource.akonadi</uri>"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"Content-ID: <*@kolab.resource.akonadi>"
),
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
QStringLiteral
(
"Content-ID: <id@kolab.resource.akonadi>"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"<uri>mailto:*</uri>"
),
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
QStringLiteral
(
"<uri>mailto:</uri>"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"<cal-address>mailto:*</cal-address>"
),
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
QStringLiteral
(
"<cal-address>mailto:</cal-address>"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"<uri>data:*</uri>"
),
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
QStringLiteral
(
"<uri>data:</uri>"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"<last-modification-date>*</last-modification-date>"
),
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"
\\
bLibkolab-
\\
d.
\\
d.
\\
d
\\
b"
)),
QStringLiteral
(
"Libkolab-x.x.x"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"
\\
bLibkolabxml-
\\
d.
\\
d.
\\
d
\\
b"
)),
QStringLiteral
(
"Libkolabxml-x.x.x"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"
\\
bLibkolab-
\\
d.
\\
d
\\
b"
)),
QStringLiteral
(
"Libkolab-x.x.x"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"
\\
bkdepim-runtime-
\\
d.
\\
d
\\
b"
)),
QStringLiteral
(
"Libkolab-x.x.x"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"
\\
bLibkolabxml-
\\
d.
\\
d
\\
b"
)),
QStringLiteral
(
"Libkolabxml-x.x.x"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"<uri>cid:.*@kolab.resource.akonadi</uri>"
)),
QStringLiteral
(
"<uri>cid:id@kolab.resource.akonadi</uri>"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"Content-ID: <.*@kolab.resource.akonadi>"
)),
QStringLiteral
(
"Content-ID: <id@kolab.resource.akonadi>"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"<uri>mailto:.*</uri>"
)),
QStringLiteral
(
"<uri>mailto:</uri>"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"<cal-address>mailto:.*</cal-address>"
)),
QStringLiteral
(
"<cal-address>mailto:</cal-address>"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"<uri>data:.*</uri>"
)),
QStringLiteral
(
"<uri>data:</uri>"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"<last-modification-date>.*</last-modification-date>"
)),
QStringLiteral
(
"<last-modification-date></last-modification-date>"
));
//We no longer support pobox, so remove pobox lines
content
.
replace
(
QRegExp
(
QStringLiteral
(
"<pobox>*</pobox>"
),
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
QLatin1String
(
""
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"<timestamp>*</timestamp>"
),
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
QStringLiteral
(
"<timestamp></timestamp>"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"<x-kolab-version>*</x-kolab-version>"
),
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
QStringLiteral
(
"<x-kolab-version></x-kolab-version>"
));
content
.
remove
(
QRegularExpression
(
QStringLiteral
(
"<pobox>.*</pobox>"
)));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"<timestamp>.*</timestamp>"
)),
QStringLiteral
(
"<timestamp></timestamp>"
));
// DotMatchesEverythingOption because <x-koblab-version> spans multiple lines
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"<x-kolab-version>.*</x-kolab-version>"
),
QRegularExpression
::
DotMatchesEverythingOption
),
QStringLiteral
(
"<x-kolab-version></x-kolab-version>"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"--nextPart
\\
S*"
)),
QStringLiteral
(
"--part"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"
\\
bboundary=
\"
nextPart[^
\\
n]*"
)),
QStringLiteral
(
"boundary"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"--nextPart
\\
S*"
),
Qt
::
CaseSensitive
),
QStringLiteral
(
"--part"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"
\\
bboundary=
\"
nextPart[^
\\
n]*"
),
Qt
::
CaseSensitive
),
QStringLiteral
(
"boundary"
));
content
.
replace
(
QRegExp
(
QStringLiteral
(
"Date[^
\\
n]*"
),
Qt
::
CaseSensitive
),
QStringLiteral
(
"Date"
));
content
.
replace
(
QRegularExpression
(
QStringLiteral
(
"Date[^
\\
n]*"
)),
QStringLiteral
(
"Date"
));
//The sort order of the attributes in kolabV2 is unpredictable
content
.
replace
(
QReg
Exp
(
QStringLiteral
(
"<x-custom*/>"
)
,
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
QStringLiteral
(
"<x-custom/>"
));
content
.
replace
(
QReg
ularExpression
(
QStringLiteral
(
"<x-custom
.
*/>"
)),
QStringLiteral
(
"<x-custom/>"
));
//quoted-printable encoding changes where the linebreaks are every now and then (an all are valid), so we remove the linebreaks
content
.
re
place
(
QRegExp
(
QStringLiteral
(
"=
\\
n"
),
Qt
::
CaseSensitive
),
QLatin1String
(
""
));
content
.
re
move
(
QLatin1String
(
"
=
\n
"
));
}
QString
normalizeVCardMessage
(
QString
content
)
{
//The encoding changes every now and then
content
.
replace
(
QReg
Exp
(
QStringLiteral
(
"ENCODING=b;TYPE=png:*"
)
,
Qt
::
CaseSensitive
,
QRegExp
::
Wildcard
),
QStringLiteral
(
"ENCODING=b;TYPE=png:picturedata"
));
content
.
replace
(
QReg
ularExpression
(
QStringLiteral
(
"ENCODING=b;TYPE=png:
.
*"
)),
QStringLiteral
(
"ENCODING=b;TYPE=png:picturedata"
));
return
content
;
}
...
...
resources/openxchange/oxa/contactutils.cpp
View file @
62adba9b
...
...
@@ -17,6 +17,7 @@
#include <QBuffer>
#include <QImage>
#include <QDomElement>
#include <QRegularExpression>
using
namespace
OXA
;
...
...
@@ -232,7 +233,7 @@ void OXA::ContactUtils::parseContact(const QDomElement &propElement, Object &obj
}
else
if
(
tagName
==
QLatin1String
(
"pager"
))
{
contact
.
insertPhoneNumber
(
KContacts
::
PhoneNumber
(
text
,
KContacts
::
PhoneNumber
::
Pager
));
}
else
if
(
tagName
==
QLatin1String
(
"categories"
))
{
contact
.
setCategories
(
text
.
split
(
QReg
Exp
(
QLatin1String
(
",
\\
s*"
))));
contact
.
setCategories
(
text
.
split
(
QReg
ularExpression
(
QStringLiteral
(
",
\\
s*"
))));
}
element
=
element
.
nextSiblingElement
();
...
...
resources/openxchange/oxa/incidenceutils.cpp
View file @
62adba9b
...
...
@@ -20,6 +20,7 @@
#include <QBitArray>
#include <QDebug>
#include <QRegularExpression>
using
namespace
OXA
;
...
...
@@ -114,7 +115,7 @@ static void parseIncidenceAttribute(const QDomElement &element, const KCalendarC
incidence
->
setSecrecy
(
KCalendarCore
::
Incidence
::
SecrecyPublic
);
}
}
else
if
(
tagName
==
QLatin1String
(
"categories"
))
{
incidence
->
setCategories
(
text
.
split
(
QReg
Exp
(
QLatin1String
(
",
\\
s*"
))));
incidence
->
setCategories
(
text
.
split
(
QReg
ularExpression
(
QStringLiteral
(
",
\\
s*"
))));
}
}
...
...
Write
Preview
Markdown
is supported
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