From: Peter Penz Date: Thu, 7 Jun 2012 21:08:05 +0000 (+0200) Subject: Hide "Recently Accessed" and "Search for" if indexing is disabled X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/5c163a41c5fdb8d97138cce455c81cb5732263aa Hide "Recently Accessed" and "Search for" if indexing is disabled The bookmarks for "Recently Accessed" and "Search for" require enabled indexing not only an enabled Nepomuk. BUG: 301340 FIXED-IN: 4.9.0 --- diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 8530b92f5..a0358cb43 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -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"))); diff --git a/src/panels/places/placesitemmodel.h b/src/panels/places/placesitemmodel.h index b0f66d652..a060f4549 100644 --- a/src/panels/places/placesitemmodel.h +++ b/src/panels/places/placesitemmodel.h @@ -260,7 +260,7 @@ private: #endif private: - bool m_nepomukRunning; + bool m_fileIndexingEnabled; bool m_hiddenItemsShown; QSet m_availableDevices;