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
KAlarm
Commits
044dc762
Commit
044dc762
authored
Aug 24, 2013
by
Laurent Montel
😁
Browse files
Use QLatin1*
parent
17e819a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
alarmtext.cpp
View file @
044dc762
...
...
@@ -186,16 +186,16 @@ QString AlarmText::Private::displayText() const
case
Email
:
// Format the email into a text alarm
setUpTranslations
();
text
=
mFromPrefix
+
'\t'
+
mFrom
+
'\n'
;
text
+=
mToPrefix
+
'\t'
+
mTo
+
'\n'
;
text
=
mFromPrefix
+
QLatin1Char
(
'\t'
)
+
mFrom
+
QLatin1Char
(
'\n'
)
;
text
+=
mToPrefix
+
QLatin1Char
(
'\t'
)
+
mTo
+
QLatin1Char
(
'\n'
)
;
if
(
!
mCc
.
isEmpty
())
text
+=
mCcPrefix
+
'\t'
+
mCc
+
'\n'
;
text
+=
mCcPrefix
+
QLatin1Char
(
'\t'
)
+
mCc
+
QLatin1Char
(
'\n'
)
;
if
(
!
mTime
.
isEmpty
())
text
+=
mDatePrefix
+
'\t'
+
mTime
+
'\n'
;
text
+=
mSubjectPrefix
+
'\t'
+
mSubject
;
text
+=
mDatePrefix
+
QLatin1Char
(
'\t'
)
+
mTime
+
QLatin1Char
(
'\n'
)
;
text
+=
mSubjectPrefix
+
QLatin1Char
(
'\t'
)
+
mSubject
;
if
(
!
mBody
.
isEmpty
())
{
text
+=
"
\n\n
"
;
text
+=
QLatin1String
(
"
\n\n
"
)
;
text
+=
mBody
;
}
break
;
...
...
@@ -203,15 +203,15 @@ QString AlarmText::Private::displayText() const
// Format the todo into a text alarm
setUpTranslations
();
if
(
!
mSubject
.
isEmpty
())
text
=
mTitlePrefix
+
'\t'
+
mSubject
+
'\n'
;
text
=
mTitlePrefix
+
QLatin1Char
(
'\t'
)
+
mSubject
+
QLatin1Char
(
'\n'
)
;
if
(
!
mTo
.
isEmpty
())
text
+=
mLocnPrefix
+
'\t'
+
mTo
+
'\n'
;
text
+=
mLocnPrefix
+
QLatin1Char
(
'\t'
)
+
mTo
+
QLatin1Char
(
'\n'
)
;
if
(
!
mTime
.
isEmpty
())
text
+=
mDuePrefix
+
'\t'
+
mTime
+
'\n'
;
text
+=
mDuePrefix
+
QLatin1Char
(
'\t'
)
+
mTime
+
QLatin1Char
(
'\n'
)
;
if
(
!
mBody
.
isEmpty
())
{
if
(
!
text
.
isEmpty
())
text
+=
'\n'
;
text
+=
QLatin1Char
(
'\n'
)
;
text
+=
mBody
;
}
break
;
...
...
@@ -311,7 +311,7 @@ unsigned long AlarmText::kmailSerialNumber() const
*/
QString
AlarmText
::
summary
(
const
KAEvent
&
event
,
int
maxLines
,
bool
*
truncated
)
{
static
const
QRegExp
localfile
(
"^file:/+"
);
static
const
QRegExp
localfile
(
QLatin1String
(
"^file:/+"
)
)
;
QString
text
;
switch
(
event
.
actionSubType
())
{
...
...
@@ -359,12 +359,12 @@ QString AlarmText::summary(const KAEvent& event, int maxLines, bool* truncated)
}
if
(
truncated
)
*
truncated
=
false
;
if
(
text
.
count
(
'\n'
)
<
maxLines
)
if
(
text
.
count
(
QLatin1Char
(
'\n'
)
)
<
maxLines
)
return
text
;
int
newline
=
-
1
;
for
(
int
i
=
0
;
i
<
maxLines
;
++
i
)
{
newline
=
text
.
indexOf
(
'\n'
,
newline
+
1
);
newline
=
text
.
indexOf
(
QLatin1Char
(
'\n'
)
,
newline
+
1
);
if
(
newline
<
0
)
return
text
;
// not truncated after all !?!
}
...
...
@@ -380,7 +380,7 @@ QString AlarmText::summary(const KAEvent& event, int maxLines, bool* truncated)
*/
bool
AlarmText
::
checkIfEmail
(
const
QString
&
text
)
{
QStringList
lines
=
text
.
split
(
'\n'
,
QString
::
SkipEmptyParts
);
QStringList
lines
=
text
.
split
(
QLatin1Char
(
'\n'
)
,
QString
::
SkipEmptyParts
);
return
Private
::
emailHeaderCount
(
lines
);
}
...
...
@@ -391,7 +391,7 @@ bool AlarmText::checkIfEmail(const QString& text)
*/
QString
AlarmText
::
emailHeaders
(
const
QString
&
text
,
bool
subjectOnly
)
{
QStringList
lines
=
text
.
split
(
'\n'
,
QString
::
SkipEmptyParts
);
QStringList
lines
=
text
.
split
(
QLatin1Char
(
'\n'
)
,
QString
::
SkipEmptyParts
);
int
n
=
Private
::
emailHeaderCount
(
lines
);
if
(
!
n
)
return
QString
();
...
...
@@ -400,7 +400,7 @@ QString AlarmText::emailHeaders(const QString& text, bool subjectOnly)
QString
h
=
lines
[
0
];
for
(
int
i
=
1
;
i
<
n
;
++
i
)
{
h
+=
'\n'
;
h
+=
QLatin1Char
(
'\n'
)
;
h
+=
lines
[
i
];
}
return
h
;
...
...
@@ -415,7 +415,7 @@ QString AlarmText::emailHeaders(const QString& text, bool subjectOnly)
QString
AlarmText
::
fromCalendarText
(
const
QString
&
text
,
bool
&
email
)
{
Private
::
initialise
();
QStringList
lines
=
text
.
split
(
'\n'
,
QString
::
SkipEmptyParts
);
QStringList
lines
=
text
.
split
(
QLatin1Char
(
'\n'
)
,
QString
::
SkipEmptyParts
);
int
maxn
=
lines
.
count
();
if
(
maxn
>=
4
&&
lines
[
0
].
startsWith
(
Private
::
mFromPrefixEn
)
...
...
@@ -430,14 +430,14 @@ QString AlarmText::fromCalendarText(const QString& text, bool& email)
{
Private
::
setUpTranslations
();
QString
dispText
;
dispText
=
Private
::
mFromPrefix
+
lines
[
0
].
mid
(
Private
::
mFromPrefixEn
.
length
())
+
'\n'
;
dispText
+=
Private
::
mToPrefix
+
lines
[
1
].
mid
(
Private
::
mToPrefixEn
.
length
())
+
'\n'
;
dispText
=
Private
::
mFromPrefix
+
lines
[
0
].
mid
(
Private
::
mFromPrefixEn
.
length
())
+
QLatin1Char
(
'\n'
)
;
dispText
+=
Private
::
mToPrefix
+
lines
[
1
].
mid
(
Private
::
mToPrefixEn
.
length
())
+
QLatin1Char
(
'\n'
)
;
if
(
n
==
3
)
dispText
+=
Private
::
mCcPrefix
+
lines
[
2
].
mid
(
Private
::
mCcPrefixEn
.
length
())
+
'\n'
;
dispText
+=
Private
::
mDatePrefix
+
lines
[
n
].
mid
(
Private
::
mDatePrefixEn
.
length
())
+
'\n'
;
dispText
+=
Private
::
mCcPrefix
+
lines
[
2
].
mid
(
Private
::
mCcPrefixEn
.
length
())
+
QLatin1Char
(
'\n'
)
;
dispText
+=
Private
::
mDatePrefix
+
lines
[
n
].
mid
(
Private
::
mDatePrefixEn
.
length
())
+
QLatin1Char
(
'\n'
)
;
dispText
+=
Private
::
mSubjectPrefix
+
lines
[
n
+
1
].
mid
(
Private
::
mSubjectPrefixEn
.
length
());
int
i
=
text
.
indexOf
(
Private
::
mSubjectPrefixEn
);
i
=
text
.
indexOf
(
'\n'
,
i
);
i
=
text
.
indexOf
(
QLatin1Char
(
'\n'
)
,
i
);
if
(
i
>
0
)
dispText
+=
text
.
mid
(
i
);
email
=
true
;
...
...
@@ -455,7 +455,7 @@ QString AlarmText::fromCalendarText(const QString& text, bool& email)
QString
AlarmText
::
toCalendarText
(
const
QString
&
text
)
{
Private
::
setUpTranslations
();
QStringList
lines
=
text
.
split
(
'\n'
,
QString
::
SkipEmptyParts
);
QStringList
lines
=
text
.
split
(
QLatin1Char
(
'\n'
)
,
QString
::
SkipEmptyParts
);
int
maxn
=
lines
.
count
();
if
(
maxn
>=
4
&&
lines
[
0
].
startsWith
(
Private
::
mFromPrefix
)
...
...
@@ -470,14 +470,14 @@ QString AlarmText::toCalendarText(const QString& text)
{
// Format the email into a text alarm
QString
calText
;
calText
=
Private
::
mFromPrefixEn
+
lines
[
0
].
mid
(
Private
::
mFromPrefix
.
length
())
+
'\n'
;
calText
+=
Private
::
mToPrefixEn
+
lines
[
1
].
mid
(
Private
::
mToPrefix
.
length
())
+
'\n'
;
calText
=
Private
::
mFromPrefixEn
+
lines
[
0
].
mid
(
Private
::
mFromPrefix
.
length
())
+
QLatin1Char
(
'\n'
)
;
calText
+=
Private
::
mToPrefixEn
+
lines
[
1
].
mid
(
Private
::
mToPrefix
.
length
())
+
QLatin1Char
(
'\n'
)
;
if
(
n
==
3
)
calText
+=
Private
::
mCcPrefixEn
+
lines
[
2
].
mid
(
Private
::
mCcPrefix
.
length
())
+
'\n'
;
calText
+=
Private
::
mDatePrefixEn
+
lines
[
n
].
mid
(
Private
::
mDatePrefix
.
length
())
+
'\n'
;
calText
+=
Private
::
mCcPrefixEn
+
lines
[
2
].
mid
(
Private
::
mCcPrefix
.
length
())
+
QLatin1Char
(
'\n'
)
;
calText
+=
Private
::
mDatePrefixEn
+
lines
[
n
].
mid
(
Private
::
mDatePrefix
.
length
())
+
QLatin1Char
(
'\n'
)
;
calText
+=
Private
::
mSubjectPrefixEn
+
lines
[
n
+
1
].
mid
(
Private
::
mSubjectPrefix
.
length
());
int
i
=
text
.
indexOf
(
Private
::
mSubjectPrefix
);
i
=
text
.
indexOf
(
'\n'
,
i
);
i
=
text
.
indexOf
(
QLatin1Char
(
'\n'
)
,
i
);
if
(
i
>
0
)
calText
+=
text
.
mid
(
i
);
return
calText
;
...
...
@@ -547,21 +547,21 @@ int AlarmText::Private::emailHeaderCount(const QStringList& lines)
QString
AlarmText
::
Private
::
todoTitle
(
const
QString
&
text
)
{
setUpTranslations
();
QStringList
lines
=
text
.
split
(
'\n'
,
QString
::
SkipEmptyParts
);
QStringList
lines
=
text
.
split
(
QLatin1Char
(
'\n'
)
,
QString
::
SkipEmptyParts
);
int
n
;
for
(
n
=
0
;
n
<
lines
.
count
()
&&
lines
[
n
].
contains
(
'\t'
);
++
n
)
;
for
(
n
=
0
;
n
<
lines
.
count
()
&&
lines
[
n
].
contains
(
QLatin1Char
(
'\t'
)
)
;
++
n
)
;
if
(
!
n
||
n
>
3
)
return
QString
();
QString
title
;
int
i
=
0
;
if
(
lines
[
i
].
startsWith
(
mTitlePrefix
+
'\t'
))
if
(
lines
[
i
].
startsWith
(
mTitlePrefix
+
QLatin1Char
(
'\t'
))
)
{
title
=
lines
[
i
].
mid
(
mTitlePrefix
.
length
()).
trimmed
();
++
i
;
}
if
(
i
<
n
&&
lines
[
i
].
startsWith
(
mLocnPrefix
+
'\t'
))
if
(
i
<
n
&&
lines
[
i
].
startsWith
(
mLocnPrefix
+
QLatin1Char
(
'\t'
))
)
++
i
;
if
(
i
<
n
&&
lines
[
i
].
startsWith
(
mDuePrefix
+
'\t'
))
if
(
i
<
n
&&
lines
[
i
].
startsWith
(
mDuePrefix
+
QLatin1Char
(
'\t'
))
)
++
i
;
if
(
i
==
n
)
{
...
...
kacalendar.cpp
View file @
044dc762
...
...
@@ -55,7 +55,7 @@ using Akonadi::Collection;
using
namespace
KCal
;
#endif
static
const
KCatalogLoader
loader
(
"libkalarmcal"
);
static
const
KCatalogLoader
loader
(
QLatin1String
(
"libkalarmcal"
)
)
;
namespace
KAlarmCal
{
...
...
@@ -220,7 +220,7 @@ int Private::readKAlarmVersion(CalendarLocal& calendar, const QString& localFile
{
// Older versions used KAlarm's translated name in the product ID, which
// could have created problems using a calendar in different locales.
progname
=
QString
(
" "
)
+
i18n
(
"KAlarm"
)
+
' '
;
progname
=
Q
Latin1
String
(
" "
)
+
i18n
(
"KAlarm"
)
+
QLatin1Char
(
' '
)
;
i
=
prodid
.
indexOf
(
progname
,
0
,
Qt
::
CaseInsensitive
);
if
(
i
<
0
)
return
KACalendar
::
IncompatibleFormat
;
// calendar wasn't created by KAlarm
...
...
@@ -228,15 +228,15 @@ int Private::readKAlarmVersion(CalendarLocal& calendar, const QString& localFile
// Extract the KAlarm version string
versionString
=
prodid
.
mid
(
i
+
progname
.
length
()).
trimmed
();
i
=
versionString
.
indexOf
(
'/'
);
int
j
=
versionString
.
indexOf
(
' '
);
i
=
versionString
.
indexOf
(
QLatin1Char
(
'/'
)
)
;
int
j
=
versionString
.
indexOf
(
QLatin1Char
(
' '
)
)
;
if
(
j
>=
0
&&
j
<
i
)
i
=
j
;
if
(
i
<=
0
)
return
KACalendar
::
IncompatibleFormat
;
// missing version string
versionString
=
versionString
.
left
(
i
);
// 'versionString' now contains the KAlarm version string
}
if
(
versionString
==
KAEvent
::
currentCalendarVersionString
())
if
(
versionString
==
QLatin1String
(
KAEvent
::
currentCalendarVersionString
())
)
return
KACalendar
::
CurrentFormat
;
// the calendar is in the current KAlarm format
int
ver
=
KAlarmCal
::
getVersionNumber
(
versionString
,
&
subVersion
);
if
(
ver
==
KAEvent
::
currentCalendarVersion
())
...
...
@@ -344,7 +344,7 @@ QString uid(const QString& id, Type status)
else
{
oldType
=
ACTIVE
;
i
=
result
.
lastIndexOf
(
'-'
);
i
=
result
.
lastIndexOf
(
QLatin1Char
(
'-'
)
)
;
len
=
1
;
if
(
i
<
0
)
{
...
...
@@ -413,7 +413,7 @@ Type status(const Event* event, QString* param)
PropertyMap
::
ConstIterator
it
=
properties
.
constFind
(
property
);
if
(
it
!=
properties
.
constEnd
())
return
it
.
value
();
int
i
=
property
.
indexOf
(
';'
);
int
i
=
property
.
indexOf
(
QLatin1Char
(
';'
)
)
;
if
(
i
<
0
)
return
EMPTY
;
it
=
properties
.
constFind
(
property
.
left
(
i
));
...
...
@@ -461,7 +461,7 @@ void setStatus(Event* event, Type status, const QString& param)
return
;
}
if
(
!
param
.
isEmpty
())
text
+=
';'
+
param
;
text
+=
QLatin1Char
(
';'
)
+
param
;
event
->
setCustomProperty
(
KACalendar
::
APPNAME
,
staticStrings
->
STATUS_PROPERTY
,
text
);
}
...
...
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