X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/6f6f080bb883afbfcd8e4208348630d73e4ba559..b4e80645e8e39ef7fcc1545136bad06ab3dd5f3e:/src/kitemviews/kfileitemmodel.h diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index f89eae946..13554d8c7 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -211,6 +211,13 @@ public: */ static QList rolesInformation(); + /** + * @return Provides static information for all available grouping + * behaviors supported by KFileItemModel but not directly + * mapped to roles of KFileItemModel. + */ + static QList extraGroupingInformation(); + /** set to true to hide application/x-trash files */ void setShowTrashMime(bool show); @@ -265,7 +272,7 @@ Q_SIGNALS: * Is emitted if an error message (e.g. "Unknown location") * should be shown. */ - void errorMessage(const QString &message); + void errorMessage(const QString &message, const int kioErrorCode); /** * Is emitted if a redirection from the current URL \a oldUrl @@ -293,9 +300,9 @@ Q_SIGNALS: protected: void onGroupedSortingChanged(bool current) override; void onSortRoleChanged(const QByteArray ¤t, const QByteArray &previous, bool resortItems = true) override; - void onSortOrderChanged(Qt::SortOrder current, Qt::SortOrder previous, bool resortItems = true) override; + void onSortOrderChanged(Qt::SortOrder current, Qt::SortOrder previous) override; void onGroupRoleChanged(const QByteArray ¤t, const QByteArray &previous, bool resortItems = true) override; - void onGroupOrderChanged(Qt::SortOrder current, Qt::SortOrder previous, bool resortItems = true) override; + void onGroupOrderChanged(Qt::SortOrder current, Qt::SortOrder previous) override; private Q_SLOTS: /** @@ -373,7 +380,7 @@ private: QHash values; ItemData *parent; }; - + struct ItemGroupInfo { int comparable; QString text; @@ -396,6 +403,12 @@ private: */ QList createItemDataList(const QUrl &parentUrl, const KFileItemList &items) const; + /** + * Helper method for prepareItemsForSorting(). + * For a set role, fills 'values' of ItemData non-lazily. + */ + void prepareItemsWithRole(QList &itemDataList, RoleType roleType); + /** * Prepares the items for sorting. Normally, the hash 'values' in ItemData is filled * lazily to save time and memory, but for some sort roles, it is expected that the @@ -626,7 +639,9 @@ inline bool KFileItemModel::isRoleValueNatural(RoleType roleType) inline bool KFileItemModel::nameLessThan(const ItemData *a, const ItemData *b) { - return a->item.text() < b->item.text(); + // Split extension, taking into account it can be empty + constexpr QString::SectionFlags flags = QString::SectionSkipEmpty | QString::SectionIncludeLeadingSep; + return a->item.text().section('.', 0, 0, flags) < b->item.text().section('.', 0, 0, flags); } inline bool KFileItemModel::isChildItem(int index) const