Commit 75156b27 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use QStringView here

parent cbe54879
Pipeline #60290 passed with stage
in 3 minutes and 52 seconds
......@@ -541,20 +541,21 @@ ObjectPtr Private::JSONToEvent(const QVariantMap& data, const QString &timezone)
const QStringList recrs = data.value(eventRecurrenceParam).toStringList();
for (const QString & rec : recrs) {
KCalendarCore::ICalFormat format;
if (rec.leftRef(5) == QLatin1String("RRULE")) {
const QStringView recView(rec);
if (recView.left(5) == QLatin1String("RRULE")) {
auto recurrenceRule = std::make_unique<KCalendarCore::RecurrenceRule>();
const auto ok = format.fromString(recurrenceRule.get(), rec.mid(6)); Q_UNUSED(ok)
recurrenceRule->setRRule(rec);
event->recurrence()->addRRule(recurrenceRule.release());
} else if (rec.leftRef(6) == QLatin1String("EXRULE")) {
} else if (recView.left(6) == QLatin1String("EXRULE")) {
auto recurrenceRule = std::make_unique<KCalendarCore::RecurrenceRule>();
const auto ok = format.fromString(recurrenceRule.get(), rec.mid(7)); Q_UNUSED(ok)
recurrenceRule->setRRule(rec);
event->recurrence()->addExRule(recurrenceRule.release());
} else if (rec.leftRef(6) == QLatin1String("EXDATE")) {
} else if (recView.left(6) == QLatin1String("EXDATE")) {
KCalendarCore::DateList exdates = Private::parseRDate(rec);
event->recurrence()->setExDates(exdates);
} else if (rec.leftRef(5) == QLatin1String("RDATE")) {
} else if (recView.left(5) == QLatin1String("RDATE")) {
KCalendarCore::DateList rdates = Private::parseRDate(rec);
event->recurrence()->setRDates(rdates);
}
......
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