┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodel.h
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2013-02-27 13:35:20 +0100
committerEmmanuel Pescosta <[email protected]>2013-02-27 13:35:20 +0100
commitf2d70693db58f0b912e29330017298928b0ddc0d (patch)
tree72b485e58dac4bc2085051c3cfe314bd047091c4 /src/kitemviews/kfileitemmodel.h
parent6b91e4e6b80f23f2123eb7b85b4a2bf1e348fe84 (diff)
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<KFileItem, ItemData*> instead of a QSet<KFileItem> 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
Diffstat (limited to 'src/kitemviews/kfileitemmodel.h')
-rw-r--r--src/kitemviews/kfileitemmodel.h21
1 files changed, 13 insertions, 8 deletions
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<QPair<KFileItem, KFileItem> >& 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<ItemData*>& 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<ItemData*> createItemDataList(const KFileItemList& items) const;
+ QList<ItemData*> createItemDataList(const KUrl& parentUrl, const KFileItemList& items) const;
void removeExpandedItems();
@@ -333,7 +338,7 @@ private:
*/
QByteArray roleForType(RoleType roleType) const;
- QHash<QByteArray, QVariant> retrieveData(const KFileItem& item) const;
+ QHash<QByteArray, QVariant> 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<ItemData*>& items, int timeout);
/**
* Checks if the model's internal data structures are consistent.
@@ -438,13 +443,13 @@ private:
QHash<KUrl, int> m_items; // Allows O(1) access for KFileItemModel::index(const KFileItem& item)
KFileItemModelFilter m_filter;
- QSet<KFileItem> m_filteredItems; // Items that got hidden by KFileItemModel::setNameFilter()
+ QHash<KFileItem, ItemData*> m_filteredItems; // Items that got hidden by KFileItemModel::setNameFilter()
bool m_requestRole[RolesCount];
QTimer* m_maximumUpdateIntervalTimer;
QTimer* m_resortAllItemsTimer;
- KFileItemList m_pendingItemsToInsert;
+ QList<ItemData*> m_pendingItemsToInsert;
// Cache for KFileItemModel::groups()
mutable QList<QPair<int, QVariant> > m_groups;