From f2d70693db58f0b912e29330017298928b0ddc0d Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Wed, 27 Feb 2013 13:35:20 +0100 Subject: Big Thanks to Frank Reininghaus, who helped me a lot with these changes! :) * Fixed the "Network browser" and "timeline" issues, by using the KDirLister's itemsAdded(KUrl,KFileItemList) signal -> Use the given Url to define the parent-child relationship. * Changed the name of the slot "slotNewItems" to "slotItemsAdded" for consistency with the signal. * Use a QHash instead of a QSet to store the filtered data (needed to keep the O(1) lookup for filtered KFileItems in slotItemsDeleted + needed to fix bug 311912 "After erasing a filter, some thumbnails randomly disappear") * Made the determination of the "expandedParentsCount" slightly simpler - just adding 1 to the parent's level (Also needed to fix the "Network browser" and "timeline" issues) FIXED-IN: 4.11.0 REVIEW: 109180 BUG: 304565 BUG: 311912 BUG: 312890 BUG: 315593 --- src/kitemviews/kfileitemmodel.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/kitemviews/kfileitemmodel.h') diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index a05d1f9d8..c233246c6 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -272,7 +272,7 @@ private slots: void slotCompleted(); void slotCanceled(); - void slotNewItems(const KFileItemList& items); + void slotItemsAdded(const KUrl& directoryUrl, const KFileItemList& items); void slotItemsDeleted(const KFileItemList& items); void slotRefreshItems(const QList >& items); void slotClear(); @@ -303,8 +303,13 @@ private: ItemData* parent; }; - void insertItems(const KFileItemList& items); - void removeItems(const KFileItemList& items); + enum RemoveItemsBehavior { + KeepItemData, + DeleteItemData + }; + + void insertItems(QList& items); + void removeItems(const KFileItemList& items, RemoveItemsBehavior behavior); /** * Helper method for insertItems() and removeItems(): Creates @@ -312,7 +317,7 @@ private: * Note that the ItemData instances are created dynamically and * must be deleted by the caller. */ - QList createItemDataList(const KFileItemList& items) const; + QList createItemDataList(const KUrl& parentUrl, const KFileItemList& items) const; void removeExpandedItems(); @@ -333,7 +338,7 @@ private: */ QByteArray roleForType(RoleType roleType) const; - QHash retrieveData(const KFileItem& item) const; + QHash retrieveData(const KFileItem& item, const ItemData* parent) const; /** * @return True if the item-data \a a should be ordered before the item-data @@ -416,7 +421,7 @@ private: * Determines the MIME-types of all items that can be done within * the given timeout. */ - static void determineMimeTypes(const KFileItemList& items, int timeout); + static void determineMimeTypes(const QList& items, int timeout); /** * Checks if the model's internal data structures are consistent. @@ -438,13 +443,13 @@ private: QHash m_items; // Allows O(1) access for KFileItemModel::index(const KFileItem& item) KFileItemModelFilter m_filter; - QSet m_filteredItems; // Items that got hidden by KFileItemModel::setNameFilter() + QHash m_filteredItems; // Items that got hidden by KFileItemModel::setNameFilter() bool m_requestRole[RolesCount]; QTimer* m_maximumUpdateIntervalTimer; QTimer* m_resortAllItemsTimer; - KFileItemList m_pendingItemsToInsert; + QList m_pendingItemsToInsert; // Cache for KFileItemModel::groups() mutable QList > m_groups; -- cgit v1.3.1