From 38bb5f1547e2a18d40a01fabf9b4478f5fe66130 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Mon, 6 May 2013 18:41:21 +0530 Subject: Dolphin Places: React to Nepomuk system changes Reload the places panel when Nepomuk starts up and shutsdown. This way the user does not need to restart Dolphin to see the custom searches and places after Nepomuk switches on. BUG: 304918 REVIEW: 110323 --- src/kitemviews/kstandarditemmodel.cpp | 9 +++++++++ src/kitemviews/kstandarditemmodel.h | 1 + 2 files changed, 10 insertions(+) (limited to 'src/kitemviews') diff --git a/src/kitemviews/kstandarditemmodel.cpp b/src/kitemviews/kstandarditemmodel.cpp index dbf608c92..959d62cb8 100644 --- a/src/kitemviews/kstandarditemmodel.cpp +++ b/src/kitemviews/kstandarditemmodel.cpp @@ -122,6 +122,15 @@ void KStandardItemModel::removeItem(int index) } } +void KStandardItemModel::clear() +{ + int size = m_items.size(); + m_items.clear(); + m_indexesForItems.clear(); + + emit itemsRemoved(KItemRangeList() << KItemRange(0, size)); +} + KStandardItem* KStandardItemModel::item(int index) const { if (index < 0 || index >= m_items.count()) { diff --git a/src/kitemviews/kstandarditemmodel.h b/src/kitemviews/kstandarditemmodel.h index 34032bf07..0debd6a6f 100644 --- a/src/kitemviews/kstandarditemmodel.h +++ b/src/kitemviews/kstandarditemmodel.h @@ -78,6 +78,7 @@ public: virtual QString roleDescription(const QByteArray& role) const; virtual QList > groups() const; + virtual void clear(); protected: /** * Is invoked after an item has been inserted and before the signal -- cgit v1.3