X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/ee16ff9b4816bcbe628f0271562280f3ee3eba85..40cc5f665d:/src/kitemviews/kfileitemmodel.cpp?ds=sidebyside diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 7929ad636..4af851733 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -1802,7 +1801,7 @@ QHash KFileItemModel::retrieveData(const KFileItem& item, data.insert(sharedValue("text"), item.text()); } - if (m_requestRole[ExtensionRole]) { + if (m_requestRole[ExtensionRole] && !isDir) { data.insert(sharedValue("extension"), QFileInfo(item.name()).suffix()); } @@ -2068,6 +2067,17 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const break; } + case AccessTimeRole: { + const long long dateTimeA = itemA.entry().numberValue(KIO::UDSEntry::UDS_ACCESS_TIME, -1); + const long long dateTimeB = itemB.entry().numberValue(KIO::UDSEntry::UDS_ACCESS_TIME, -1); + if (dateTimeA < dateTimeB) { + return -1; + } else if (dateTimeA > dateTimeB) { + return +1; + } + break; + } + case CreationTimeRole: { const long long dateTimeA = itemA.entry().numberValue(KIO::UDSEntry::UDS_CREATION_TIME, -1); const long long dateTimeB = itemB.entry().numberValue(KIO::UDSEntry::UDS_CREATION_TIME, -1); @@ -2610,13 +2620,13 @@ const KFileItemModel::RoleInfoMap* KFileItemModel::rolesInfoMap(int& count) { nullptr, NoRole, KLazyLocalizedString(), KLazyLocalizedString(), false, false }, { "text", NameRole, kli18nc("@label", "Name"), KLazyLocalizedString(), false, false }, { "size", SizeRole, kli18nc("@label", "Size"), KLazyLocalizedString(), false, false }, + { "modificationtime", ModificationTimeRole, kli18nc("@label", "Modified"), KLazyLocalizedString(), false, false }, + { "creationtime", CreationTimeRole, kli18nc("@label", "Created"), KLazyLocalizedString(), false, false }, + { "accesstime", AccessTimeRole, kli18nc("@label", "Accessed"), KLazyLocalizedString(), false, false }, { "type", TypeRole, kli18nc("@label", "Type"), KLazyLocalizedString(), false, false }, { "rating", RatingRole, kli18nc("@label", "Rating"), KLazyLocalizedString(), true, false }, { "tags", TagsRole, kli18nc("@label", "Tags"), KLazyLocalizedString(), true, false }, { "comment", CommentRole, kli18nc("@label", "Comment"), KLazyLocalizedString(), true, false }, - { "modificationtime", ModificationTimeRole, kli18nc("@label", "Modified"), kli18nc("@label file date property", "Date"), false, false }, - { "creationtime", CreationTimeRole, kli18nc("@label", "Created"), kli18nc("@label file date property", "Date"), false, false }, - { "accesstime", AccessTimeRole, kli18nc("@label", "Accessed"), kli18nc("@label file date property", "Date"), false, false }, { "title", TitleRole, kli18nc("@label", "Title"), kli18nc("@label", "Document"), true, true }, { "author", AuthorRole, kli18nc("@label", "Author"), kli18nc("@label", "Document"), true, true }, { "wordCount", WordCountRole, kli18nc("@label", "Word Count"), kli18nc("@label", "Document"), true, true },