};
void insertItems(QList<ItemData*>& items);
- void removeItems(const KFileItemList& items, RemoveItemsBehavior behavior);
+ void removeItems(const KItemRangeList& itemRanges, RemoveItemsBehavior behavior);
/**
* Helper method for insertItems() and removeItems(): Creates
*/
QList<ItemData*> createItemDataList(const KUrl& parentUrl, const KFileItemList& items) const;
+ static int expandedParentsCount(const ItemData* data);
+
void removeExpandedItems();
+ /**
+ * This function is called by setData() and slotRefreshItems(). It emits
+ * the itemsChanged() signal, checks if the sort order is still correct,
+ * and starts m_resortAllItemsTimer if that is not the case.
+ */
+ void emitItemsChangedAndTriggerResorting(const KItemRangeList& itemRanges, const QSet<QByteArray>& changedRoles);
+
/**
* Resets all values from m_requestRole to false.
*/
*/
bool isChildItem(int index) const;
- /**
- * @return Recursive list of child items that have \a item as upper most parent.
- */
- KFileItemList childItems(const KFileItem& item) const;
-
/**
* Is invoked by KFileItemModelRolesUpdater and results in emitting the
* sortProgress signal with a percent-value of the progress.
* Removes filtered items whose expanded parents have been deleted
* or collapsed via setExpanded(parentIndex, false).
*/
- void removeFilteredChildren(const KFileItemList& parentsList);
+ void removeFilteredChildren(const KItemRangeList& parents);
/**
* Maps the QByteArray-roles to RoleTypes and provides translation- and
*/
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.
*/
// Cache for KFileItemModel::groups()
mutable QList<QPair<int, QVariant> > m_groups;
- // Stores the URLs of the expanded directories.
- QSet<KUrl> m_expandedDirs;
+ // Stores the URLs (key: target url, value: url) of the expanded directories.
+ QHash<KUrl, KUrl> m_expandedDirs;
// URLs that must be expanded. The expanding is initially triggered in setExpanded()
// and done step after step in slotCompleted().
inline bool KFileItemModel::isChildItem(int index) const
{
- return m_requestRole[ExpandedParentsCountRole] && m_itemData.at(index)->values.value("expandedParentsCount").toInt() > 0;
+ if (m_itemData.at(index)->parent) {
+ return true;
+ } else {
+ return false;
+ }
}
#endif