X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/e9b056dcf080a12a09fa1c1a55eab79edb2164b5..6e752f507a1dd82a40d4bd140457203842fc0c80:/src/kitemviews/kfileitemmodel.h diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 9001e7bd5..980efe66b 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: /** @@ -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 @@ -477,13 +490,15 @@ private: ItemGroupInfo timeRoleGroup(const std::function &fileTimeCb, const ItemData *itemData, bool withString = true) const; ItemGroupInfo permissionRoleGroup(const ItemData *itemData, bool withString = true) const; ItemGroupInfo ratingRoleGroup(const ItemData *itemData, bool withString = true) const; - QString genericStringRoleGroup(const QByteArray &role, const ItemData *itemData) const; + ItemGroupInfo typeRoleGroup(const ItemData *itemData) const; + ItemGroupInfo genericStringRoleGroup(const QByteArray &role, const ItemData *itemData) const; QList> nameRoleGroups() const; QList> sizeRoleGroups() const; QList> timeRoleGroups(const std::function &fileTimeCb) const; QList> permissionRoleGroups() const; QList> ratingRoleGroups() const; + QList> typeRoleGroups() const; QList> genericStringRoleGroups(const QByteArray &typeForRole) const; /** @@ -575,6 +590,9 @@ private: RoleType m_sortRole; RoleType m_groupRole; + QByteArray m_sortExtraInfo; + QByteArray m_groupExtraInfo; + int m_sortingProgressPercent; // Value of directorySortingProgress() signal QSet m_roles; @@ -643,13 +661,4 @@ inline bool KFileItemModel::ItemGroupInfo::operator!=(const ItemGroupInfo &other return comparable != other.comparable || text != other.text; } -inline bool KFileItemModel::ItemGroupInfo::operator<(const ItemGroupInfo &other) const -{ - if (comparable == other.comparable) { - return text < other.text; - } else { - return comparable < other.comparable; - } -} - #endif