Changeset View
Changeset View
Standalone View
Standalone View
lib/semanticinfo/sorteddirmodel.cpp
Show First 20 Lines • Show All 250 Lines • ▼ Show 20 Line(s) | 250 | { | |||
---|---|---|---|---|---|
251 | d->mDelayedApplyFiltersTimer.start(); | 251 | d->mDelayedApplyFiltersTimer.start(); | ||
252 | } | 252 | } | ||
253 | 253 | | |||
254 | void SortedDirModel::doApplyFilters() | 254 | void SortedDirModel::doApplyFilters() | ||
255 | { | 255 | { | ||
256 | QSortFilterProxyModel::invalidateFilter(); | 256 | QSortFilterProxyModel::invalidateFilter(); | ||
257 | } | 257 | } | ||
258 | 258 | | |||
259 | bool SortedDirModel::lessThan(const QModelIndex& left, const QModelIndex& right) const | | |||
260 | { | | |||
261 | const KFileItem leftItem = itemForSourceIndex(left); | | |||
262 | const KFileItem rightItem = itemForSourceIndex(right); | | |||
263 | | ||||
264 | const bool leftIsDirOrArchive = ArchiveUtils::fileItemIsDirOrArchive(leftItem); | | |||
265 | const bool rightIsDirOrArchive = ArchiveUtils::fileItemIsDirOrArchive(rightItem); | | |||
266 | | ||||
267 | if (leftIsDirOrArchive != rightIsDirOrArchive) { | | |||
268 | return leftIsDirOrArchive; | | |||
269 | } | | |||
270 | | ||||
271 | if (sortColumn() != KDirModel::ModifiedTime) { | | |||
272 | return KDirSortFilterProxyModel::lessThan(left, right); | | |||
273 | } | | |||
274 | | ||||
275 | const QDateTime leftDate = TimeUtils::dateTimeForFileItem(leftItem); | | |||
276 | const QDateTime rightDate = TimeUtils::dateTimeForFileItem(rightItem); | | |||
277 | | ||||
278 | return leftDate < rightDate; | | |||
279 | } | | |||
280 | | ||||
281 | bool SortedDirModel::hasDocuments() const | 259 | bool SortedDirModel::hasDocuments() const | ||
282 | { | 260 | { | ||
283 | const int count = rowCount(); | 261 | const int count = rowCount(); | ||
284 | if (count == 0) { | 262 | if (count == 0) { | ||
285 | return false; | 263 | return false; | ||
286 | } | 264 | } | ||
287 | for (int row = 0; row < count; ++row) { | 265 | for (int row = 0; row < count; ++row) { | ||
288 | const QModelIndex idx = index(row, 0); | 266 | const QModelIndex idx = index(row, 0); | ||
Show All 14 Lines |