Changeset View
Changeset View
Standalone View
Standalone View
src/freebusymodel/freeperiodmodel.cpp
Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Line(s) | 119 | while (tmpPeriod.start().date() != tmpPeriod.end().date()) { | |||
---|---|---|---|---|---|
127 | tmpPeriod = secondPeriod; | 127 | tmpPeriod = secondPeriod; | ||
128 | } | 128 | } | ||
129 | if (tmpPeriod.duration().asSeconds() >= validPeriodSecs) { | 129 | if (tmpPeriod.duration().asSeconds() >= validPeriodSecs) { | ||
130 | splitList << tmpPeriod; | 130 | splitList << tmpPeriod; | ||
131 | } | 131 | } | ||
132 | } | 132 | } | ||
133 | 133 | | |||
134 | // Perform some jiggery pokery to remove duplicates | 134 | // Perform some jiggery pokery to remove duplicates | ||
135 | 135 | std::sort(splitList.begin(), splitList.end()); | |||
136 | QList<KCalendarCore::Period> tmpList = splitList.toList(); | 136 | splitList.erase(std::unique(splitList.begin(), splitList.end()), splitList.end()); | ||
137 | #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) | 137 | return splitList; | ||
138 | const QSet<KCalendarCore::Period> set = tmpList.toSet(); | | |||
139 | #else | | |||
140 | const QSet<KCalendarCore::Period> set = QSet<KCalendarCore::Period>(tmpList.begin(), tmpList.end()); | | |||
141 | #endif | | |||
142 | tmpList = QList<KCalendarCore::Period>::fromSet(set); | | |||
143 | return KCalendarCore::Period::List::fromList(tmpList); | | |||
144 | } | 138 | } | ||
145 | 139 | | |||
146 | QString FreePeriodModel::day(int index) const | 140 | QString FreePeriodModel::day(int index) const | ||
147 | { | 141 | { | ||
148 | KCalendarCore::Period period = mPeriodList.at(index); | 142 | KCalendarCore::Period period = mPeriodList.at(index); | ||
149 | const QDate startDate = period.start().date(); | 143 | const QDate startDate = period.start().date(); | ||
150 | return ki18nc("@label Day of the week name, example: Monday,", "%1,"). | 144 | return ki18nc("@label Day of the week name, example: Monday,", "%1,"). | ||
151 | subs(QLocale::system().dayName(startDate.dayOfWeek(), QLocale::LongFormat)).toString(); | 145 | subs(QLocale::system().dayName(startDate.dayOfWeek(), QLocale::LongFormat)).toString(); | ||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |