Commit 79fb01b0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

QString::split(..., Qt::SplitBehavior, ...) is already in Qt 5.14

parent 7d4d92bf
Pipeline #47733 passed with stage
in 10 minutes
......@@ -380,11 +380,7 @@ QString AlarmText::summary(const KAEvent &event, int maxLines, bool *truncated)
*/
bool AlarmText::checkIfEmail(const QString &text)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList lines = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
#else
const QStringList lines = text.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
#endif
return Private::emailHeaderCount(lines);
}
......@@ -395,11 +391,7 @@ bool AlarmText::checkIfEmail(const QString &text)
*/
QString AlarmText::emailHeaders(const QString &text, bool subjectOnly)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList lines = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
#else
const QStringList lines = text.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
#endif
const int n = Private::emailHeaderCount(lines);
if (!n) {
return QString();
......@@ -424,11 +416,7 @@ QString AlarmText::emailHeaders(const QString &text, bool subjectOnly)
QString AlarmText::fromCalendarText(const QString &text, bool &email)
{
Private::initialise();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList lines = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
#else
const QStringList lines = text.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
#endif
const int maxn = lines.count();
if (maxn >= MAIL_MIN_LINES
&& lines[MAIL_FROM_LINE].startsWith(Private::mFromPrefixEn)
......@@ -469,11 +457,7 @@ QString AlarmText::fromCalendarText(const QString &text, bool &email)
QString AlarmText::toCalendarText(const QString &text)
{
Private::setUpTranslations();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList lines = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
#else
const QStringList lines = text.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
#endif
const int maxn = lines.count();
if (maxn >= MAIL_MIN_LINES
&& lines[MAIL_FROM_LINE].startsWith(Private::mFromPrefix)
......@@ -566,11 +550,7 @@ int AlarmText::Private::emailHeaderCount(const QStringList &lines)
QString AlarmText::Private::todoTitle(const QString &text)
{
setUpTranslations();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList lines = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
#else
const QStringList lines = text.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
#endif
int n;
for (n = 0; n < lines.count() && lines[n].contains(QLatin1Char('\t')); ++n) ;
if (!n || n > 3) {
......
......@@ -621,11 +621,7 @@ KAEventPrivate::KAEventPrivate(const KCalendarCore::Event::Ptr &event)
bool dateOnly = false;
bool localZone = false;
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList flags = event->customProperty(KACalendar::APPNAME, FLAGS_PROPERTY).split(SC, QString::SkipEmptyParts);
#else
QStringList flags = event->customProperty(KACalendar::APPNAME, FLAGS_PROPERTY).split(SC, Qt::SkipEmptyParts);
#endif
flags << QString() << QString(); // to avoid having to check for end of list
for (int i = 0, end = flags.count() - 1; i < end; ++i) {
QString flag = flags.at(i);
......@@ -4093,11 +4089,7 @@ void KAEventPrivate::readAlarm(const Alarm::Ptr &alarm, AlarmData &data, bool au
}
}
QString property = alarm->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList flags = property.split(KAEventPrivate::SC, QString::SkipEmptyParts);
#else
const QStringList flags = property.split(KAEventPrivate::SC, Qt::SkipEmptyParts);
#endif
switch (alarm->type()) {
case Alarm::Procedure:
data.action = KAAlarm::COMMAND;
......@@ -4217,11 +4209,7 @@ void KAEventPrivate::readAlarm(const Alarm::Ptr &alarm, AlarmData &data, bool au
bool repeatSound = false;
data.type = MAIN_ALARM;
property = alarm->customProperty(KACalendar::APPNAME, KAEventPrivate::TYPE_PROPERTY);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList types = property.split(QLatin1Char(','), QString::SkipEmptyParts);
#else
const QStringList types = property.split(QLatin1Char(','), Qt::SkipEmptyParts);
#endif
for (int i = 0, end = types.count(); i < end; ++i) {
const QString type = types[i];
if (type == KAEventPrivate::AT_LOGIN_TYPE) {
......@@ -5414,11 +5402,7 @@ bool KAEvent::convertKCalEvents(const Calendar::Ptr &calendar, int calendarVersi
* offsets to zero, and convert deferral alarm offsets to be relative to
* the next recurrence.
*/
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList flags = event->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY).split(KAEventPrivate::SC, QString::SkipEmptyParts);
#else
const QStringList flags = event->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY).split(KAEventPrivate::SC, Qt::SkipEmptyParts);
#endif
const bool dateOnly = flags.contains(KAEventPrivate::DATE_ONLY_FLAG);
KADateTime startDateTime(event->dtStart());
if (dateOnly) {
......@@ -5440,11 +5424,7 @@ bool KAEvent::convertKCalEvents(const Calendar::Ptr &calendar, int calendarVersi
// - DISPLAYING_TYPE
bool mainAlarm = true;
QString property = alarm->customProperty(KACalendar::APPNAME, KAEventPrivate::TYPE_PROPERTY);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList types = property.split(QLatin1Char(','), QString::SkipEmptyParts);
#else
const QStringList types = property.split(QLatin1Char(','), Qt::SkipEmptyParts);
#endif
for (const QString &type : types) {
if (type == KAEventPrivate::AT_LOGIN_TYPE
|| type == KAEventPrivate::TIME_DEFERRAL_TYPE
......@@ -5491,11 +5471,7 @@ bool KAEvent::convertKCalEvents(const Calendar::Ptr &calendar, int calendarVersi
continue;
}
const QString property = alarm->customProperty(KACalendar::APPNAME, KAEventPrivate::TYPE_PROPERTY);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList types = property.split(QLatin1Char(','), QString::SkipEmptyParts);
#else
const QStringList types = property.split(QLatin1Char(','), Qt::SkipEmptyParts);
#endif
for (const QString &type : types) {
if (type == KAEventPrivate::TIME_DEFERRAL_TYPE
|| type == KAEventPrivate::DATE_DEFERRAL_TYPE) {
......@@ -5563,21 +5539,13 @@ bool KAEvent::convertKCalEvents(const Calendar::Ptr &calendar, int calendarVersi
const QString prop = event->customProperty(KACalendar::APPNAME, ARCHIVE_PROPERTY);
if (!prop.isEmpty()) {
// Convert the event's ARCHIVE property to parameters in the FLAGS property
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
flags = event->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY).split(KAEventPrivate::SC, QString::SkipEmptyParts);
#else
flags = event->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY).split(KAEventPrivate::SC, Qt::SkipEmptyParts);
#endif
flags << KAEventPrivate::ARCHIVE_FLAG;
flagsValid = true;
if (prop != QLatin1String("0")) { // "0" was a dummy parameter if no others were present
// It's the archive property containing a reminder time and/or repeat-at-login flag.
// This was present when no reminder/at-login alarm was pending.
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList list = prop.split(KAEventPrivate::SC, QString::SkipEmptyParts);
#else
const QStringList list = prop.split(KAEventPrivate::SC, Qt::SkipEmptyParts);
#endif
for (const QString &pr : list) {
if (pr == KAEventPrivate::AT_LOGIN_TYPE) {
flags << KAEventPrivate::AT_LOGIN_TYPE;
......@@ -5621,11 +5589,7 @@ bool KAEvent::convertKCalEvents(const Calendar::Ptr &calendar, int calendarVersi
continue;
}
property = alarm->customProperty(KACalendar::APPNAME, KAEventPrivate::TYPE_PROPERTY);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList types = property.split(QChar::fromLatin1(','), QString::SkipEmptyParts);
#else
QStringList types = property.split(QChar::fromLatin1(','), Qt::SkipEmptyParts);
#endif
const int r = types.indexOf(REMINDER_ONCE_TYPE);
if (r >= 0) {
// Move reminder-once indicator from the alarm to the event's FLAGS property
......@@ -5647,11 +5611,7 @@ bool KAEvent::convertKCalEvents(const Calendar::Ptr &calendar, int calendarVersi
if (!reminder.isEmpty()) {
// Write reminder parameters into the event's FLAGS property
if (!flagsValid) {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
flags = event->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY).split(KAEventPrivate::SC, QString::SkipEmptyParts);
#else
flags = event->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY).split(KAEventPrivate::SC, Qt::SkipEmptyParts);
#endif
}
if (!flags.contains(KAEventPrivate::REMINDER_TYPE)) {
flags += KAEventPrivate::REMINDER_TYPE;
......@@ -5679,11 +5639,7 @@ bool KAEventPrivate::convertStartOfDay(const Event::Ptr &event)
{
bool changed = false;
const QTime midnight(0, 0);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList flags = event->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY).split(KAEventPrivate::SC, QString::SkipEmptyParts);
#else
const QStringList flags = event->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY).split(KAEventPrivate::SC, Qt::SkipEmptyParts);
#endif
if (flags.contains(KAEventPrivate::DATE_ONLY_FLAG)) {
// It's an untimed event, so fix it
const QDateTime oldDt = event->dtStart();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment