]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/places/placesitemmodel.cpp
Merge remote-tracking branch 'origin/KDE/4.10'
[dolphin.git] / src / panels / places / placesitemmodel.cpp
index 1acbb57719c3a109f94e5aabec8b6b82d3319d3e..caf6b75662c4953fce522d86faf4f8dbfba0fe1e 100644 (file)
@@ -88,7 +88,11 @@ PlacesItemModel::PlacesItemModel(QObject* parent) :
     m_storageSetupInProgress()
 {
 #ifdef HAVE_NEPOMUK
-    if (Nepomuk2::ResourceManager::instance()->initialized()) {
+    Nepomuk2::ResourceManager* rm = Nepomuk2::ResourceManager::instance();
+    connect(rm, SIGNAL(nepomukSystemStarted()), this, SLOT(slotNepomukStarted()));
+    connect(rm, SIGNAL(nepomukSystemStopped()), this, SLOT(slotNepomukStopped()));
+
+    if (rm->initialized()) {
         KConfig config("nepomukserverrc");
         m_fileIndexingEnabled = config.group("Service-nepomukfileindexer").readEntry("autostart", true);
     }
@@ -949,6 +953,40 @@ void PlacesItemModel::createSystemBookmarks()
     }
 }
 
+void PlacesItemModel::clear() {
+    m_bookmarkedItems.clear();
+    KStandardItemModel::clear();
+}
+
+void PlacesItemModel::slotNepomukStarted()
+{
+    KConfig config("nepomukserverrc");
+    m_fileIndexingEnabled = config.group("Service-nepomukfileindexer").readEntry("autostart", true);
+    if (m_fileIndexingEnabled) {
+        m_systemBookmarks.clear();
+        m_systemBookmarksIndexes.clear();
+        createSystemBookmarks();
+
+        clear();
+        loadBookmarks();
+    }
+}
+
+void PlacesItemModel::slotNepomukStopped()
+{
+    if (m_fileIndexingEnabled) {
+        m_fileIndexingEnabled = false;
+
+        m_systemBookmarks.clear();
+        m_systemBookmarksIndexes.clear();
+        createSystemBookmarks();
+
+        clear();
+        loadBookmarks();
+    }
+}
+
+
 void PlacesItemModel::initializeAvailableDevices()
 {
     QString predicate("[[[[ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ]]"