+ /**
+ * Helper method for lessThan() and expandedParentsCountCompare(): Compares
+ * the passed item-data using m_groupRole as criteria. Both items must
+ * have the same parent item, otherwise the comparison will be wrong.
+ */
+ int groupRoleCompare(const ItemData *a, const ItemData *b, const QCollator &collator) const;
+
+ int stringCompare(const QString &a, const QString &b, const QCollator &collator) const;
+
+ ItemGroupInfo nameRoleGroup(const ItemData *itemData, bool withString = true) const;
+ ItemGroupInfo sizeRoleGroup(const ItemData *itemData, bool withString = true) const;
+ ItemGroupInfo timeRoleGroup(const std::function<QDateTime(const ItemData *)> &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;
+ ItemGroupInfo typeRoleGroup(const ItemData *itemData) const;
+ ItemGroupInfo genericStringRoleGroup(const QByteArray &role, const ItemData *itemData) const;
+
+ QList<QPair<int, QVariant>> nameRoleGroups() const;
+ QList<QPair<int, QVariant>> sizeRoleGroups() const;
+ QList<QPair<int, QVariant>> timeRoleGroups(const std::function<QDateTime(const ItemData *)> &fileTimeCb) const;
+ QList<QPair<int, QVariant>> permissionRoleGroups() const;
+ QList<QPair<int, QVariant>> ratingRoleGroups() const;
+ QList<QPair<int, QVariant>> typeRoleGroups() const;
+ QList<QPair<int, QVariant>> genericStringRoleGroups(const QByteArray &typeForRole) const;
+
+ /**
+ * Helper method for all xxxRoleGroups() methods to check whether the
+ * item with the given index is a child-item. A child-item is defined
+ * as item having an expansion-level > 0. All xxxRoleGroups() methods
+ * should skip the grouping if the item is a child-item (although
+ * KItemListView would be capable to show sub-groups in groups this
+ * results in visual clutter for most usecases).
+ */
+ bool isChildItem(int index) const;
+
+ void scheduleResortAllItems();
+
+ /**
+ * Is invoked by KFileItemModelRolesUpdater and results in emitting the
+ * sortProgress signal with a percent-value of the progress.
+ */
+ void emitSortProgress(int resolvedCount);
+
+ /**
+ * Applies the filters set through @ref setNameFilter and @ref setMimeTypeFilters.
+ */
+ void applyFilters();
+
+ /**
+ * Removes filtered items whose expanded parents have been deleted
+ * or collapsed via setExpanded(parentIndex, false).
+ */
+ void removeFilteredChildren(const KItemRangeList &parents);
+
+ /**
+ * Loads the selected choice of sorting method from Dolphin General Settings
+ */
+ void loadSortingSettings();
+
+ /**
+ * Maps the QByteArray-roles to RoleTypes and provides translation- and
+ * group-contexts.
+ */
+ struct RoleInfoMap {
+ const char *const role;
+ const RoleType roleType;
+ const KLazyLocalizedString roleTranslation;
+ const KLazyLocalizedString groupTranslation;
+ const KLazyLocalizedString tooltipTranslation;
+ const bool requiresBaloo;
+ const bool requiresIndexer;
+ };
+
+ /**
+ * @return Map of user visible roles that are accessible by KFileItemModel::rolesInformation().
+ */
+ static const RoleInfoMap *rolesInfoMap(int &count);
+
+ /**
+ * Determines the MIME-types of all items that can be done within
+ * the given timeout.
+ */
+ static void determineMimeTypes(const KFileItemList &items, int timeout);
+
+ /**
+ * @return Returns a copy of \a value that is implicitly shared
+ * with other users to save memory.
+ */
+ static QByteArray sharedValue(const QByteArray &value);
+
+ /**
+ * Checks if the model's internal data structures are consistent.
+ */
+ bool isConsistent() const;
+
+ /**
+ * Filters out the expanded folders that don't pass the filter themselves and don't have any filter-passing children.
+ * Will update the removedItemRanges arguments to include the parents that have been filtered.
+ * @returns the number of parents that have been filtered.
+ * @param removedItemRanges The ranges of items being deleted/filtered, will get updated
+ * @param parentsToEnsureVisible Parents that must be visible no matter what due to being ancestors of newly visible items
+ */
+ int filterChildlessParents(KItemRangeList &removedItemRanges, const QSet<ItemData *> &parentsToEnsureVisible = QSet<ItemData *>());