Changeset View
Changeset View
Standalone View
Standalone View
src/person.cpp
Show All 29 Lines | 24 | /** | |||
---|---|---|---|---|---|
30 | Represents a person, by name and email address. | 30 | Represents a person, by name and email address. | ||
31 | 31 | | |||
32 | @author Cornelius Schumacher \<schumacher@kde.org\> | 32 | @author Cornelius Schumacher \<schumacher@kde.org\> | ||
33 | @author Reinhold Kainhofer \<reinhold@kainhofer.com\> | 33 | @author Reinhold Kainhofer \<reinhold@kainhofer.com\> | ||
34 | */ | 34 | */ | ||
35 | 35 | | |||
36 | #include "person.h" | 36 | #include "person.h" | ||
37 | #include "person_p.h" | 37 | #include "person_p.h" | ||
38 | #include <QRegExp> | 38 | | ||
39 | #include <QDataStream> | 39 | #include <QDataStream> | ||
40 | #include <QRegularExpression> | ||||
40 | 41 | | |||
41 | using namespace KCalendarCore; | 42 | using namespace KCalendarCore; | ||
42 | 43 | | |||
43 | /** | 44 | /** | ||
44 | Private class that helps to provide binary compatibility between releases. | 45 | Private class that helps to provide binary compatibility between releases. | ||
45 | @internal | 46 | @internal | ||
46 | */ | 47 | */ | ||
47 | //@cond PRIVATE | 48 | //@cond PRIVATE | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 99 | { | |||
99 | if (name.isEmpty()) { | 100 | if (name.isEmpty()) { | ||
100 | return email; | 101 | return email; | ||
101 | } | 102 | } | ||
102 | if (email.isEmpty()) { | 103 | if (email.isEmpty()) { | ||
103 | return name; | 104 | return name; | ||
104 | } | 105 | } | ||
105 | // Taken from KContacts::Addressee::fullEmail | 106 | // Taken from KContacts::Addressee::fullEmail | ||
106 | QString fullName = name; | 107 | QString fullName = name; | ||
107 | QRegExp needQuotes(QStringLiteral("[^ 0-9A-Za-z\\x0080-\\xFFFF]")); | 108 | const QRegularExpression needQuotes(QStringLiteral("[^ 0-9A-Za-z\\x{0080}-\\x{FFFF}]")); | ||
108 | bool weNeedToQuote = name.indexOf(needQuotes) != -1; | 109 | bool weNeedToQuote = name.indexOf(needQuotes) != -1; | ||
109 | if (weNeedToQuote) { | 110 | if (weNeedToQuote) { | ||
110 | if (fullName[0] != QLatin1Char('"')) { | 111 | if (fullName[0] != QLatin1Char('"')) { | ||
111 | fullName.prepend(QLatin1Char('"')); | 112 | fullName.prepend(QLatin1Char('"')); | ||
112 | } | 113 | } | ||
113 | if (fullName[ fullName.length() - 1 ] != QLatin1Char('"')) { | 114 | if (fullName[ fullName.length() - 1 ] != QLatin1Char('"')) { | ||
114 | fullName.append(QLatin1Char('"')); | 115 | fullName.append(QLatin1Char('"')); | ||
115 | } | 116 | } | ||
▲ Show 20 Lines • Show All 265 Lines • Show Last 20 Lines |