Commit c14d51d3 authored by Volker Krause's avatar Volker Krause
Browse files

Implement deduplication without three copies

Summary:
This also avoids the use of QSet::fromList which is deprecated in latest
Qt 5.14 and thus breaks the build.

Reviewers: dvratil

Reviewed By: dvratil

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D27744
parent 7fa39ce0
......@@ -132,15 +132,9 @@ KCalendarCore::Period::List FreePeriodModel::splitPeriodsByDay(
}
// Perform some jiggery pokery to remove duplicates
QList<KCalendarCore::Period> tmpList = splitList.toList();
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
const QSet<KCalendarCore::Period> set = tmpList.toSet();
#else
const QSet<KCalendarCore::Period> set = QSet<KCalendarCore::Period>(tmpList.begin(), tmpList.end());
#endif
tmpList = QList<KCalendarCore::Period>::fromSet(set);
return KCalendarCore::Period::List::fromList(tmpList);
std::sort(splitList.begin(), splitList.end());
splitList.erase(std::unique(splitList.begin(), splitList.end()), splitList.end());
return splitList;
}
QString FreePeriodModel::day(int index) const
......
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