]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Hide "Recently Accessed" and "Search for" if indexing is disabled
authorPeter Penz <peter.penz19@gmail.com>
Thu, 7 Jun 2012 21:08:05 +0000 (23:08 +0200)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 7 Jun 2012 21:10:04 +0000 (23:10 +0200)
The bookmarks for "Recently Accessed" and "Search for" require
enabled indexing not only an enabled Nepomuk.

BUG: 301340
FIXED-IN: 4.9.0

src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h

index 8530b92f56f36fee2b3e2880f0094b35369b30ec..a0358cb4326517e7f69193288d51bc59aac47019 100644 (file)
@@ -73,7 +73,7 @@ namespace {
 
 PlacesItemModel::PlacesItemModel(QObject* parent) :
     KStandardItemModel(parent),
-    m_nepomukRunning(false),
+    m_fileIndexingEnabled(false),
     m_hiddenItemsShown(false),
     m_availableDevices(),
     m_predicate(),
@@ -87,7 +87,11 @@ PlacesItemModel::PlacesItemModel(QObject* parent) :
     m_storageSetupInProgress()
 {
 #ifdef HAVE_NEPOMUK
-    m_nepomukRunning = (Nepomuk::ResourceManager::instance()->initialized());
+    if (Nepomuk::ResourceManager::instance()->initialized()) {
+        KConfig config("nepomukserverrc");
+        m_fileIndexingEnabled = config.group("Service-nepomukfileindexer").readEntry("autostart", false);
+    }
+
 #endif
     const QString file = KStandardDirs::locateLocal("data", "kfileplaces/bookmarks.xml");
     m_bookmarkManager = KBookmarkManager::managerForFile(file, "kfilePlaces");
@@ -808,8 +812,8 @@ bool PlacesItemModel::acceptBookmark(const KBookmark& bookmark,
     const bool allowedHere = (appName.isEmpty()
                               || appName == KGlobal::mainComponent().componentName()
                               || appName == KGlobal::mainComponent().componentName() + AppNamePrefix)
-                             && (m_nepomukRunning || (url.protocol() != QLatin1String("timeline") &&
-                                                      url.protocol() != QLatin1String("search")));
+                             && (m_fileIndexingEnabled || (url.protocol() != QLatin1String("timeline") &&
+                                                           url.protocol() != QLatin1String("search")));
 
     return (udi.isEmpty() && allowedHere) || deviceAvailable;
 }
@@ -890,7 +894,7 @@ void PlacesItemModel::createSystemBookmarks()
                                                 "user-trash",
                                                 i18nc("@item", "Trash")));
 
-    if (m_nepomukRunning) {
+    if (m_fileIndexingEnabled) {
         m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/today"),
                                                     timeLineIcon,
                                                     i18nc("@item Recently Accessed", "Today")));
index b0f66d652a6447b5635b117a1dc653372e96d579..a060f4549100363ade6fe57a40ed006d57e359d8 100644 (file)
@@ -260,7 +260,7 @@ private:
 #endif
 
 private:
-    bool m_nepomukRunning;
+    bool m_fileIndexingEnabled;
     bool m_hiddenItemsShown;
 
     QSet<QString> m_availableDevices;