┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels
diff options
context:
space:
mode:
authorVishesh Handa <[email protected]>2014-02-06 20:29:09 +0100
committerVishesh Handa <[email protected]>2014-02-06 20:29:09 +0100
commit64afe7b22622f79b34aafd54501b08120ab2fc5c (patch)
tree125752b2bc33c5e9db84f197dced5d61a7d46e94 /src/panels
parent2c20502c346d975bff854567c038bf0b78c3b857 (diff)
Port Dolphin to Baloo
Nepomuk is being replaced with Baloo
Diffstat (limited to 'src/panels')
-rw-r--r--src/panels/information/filemetadataconfigurationdialog.cpp8
-rw-r--r--src/panels/information/filemetadataconfigurationdialog.h10
-rw-r--r--src/panels/information/informationpanelcontent.cpp12
-rw-r--r--src/panels/information/informationpanelcontent.h12
-rw-r--r--src/panels/places/placesitemmodel.cpp80
-rw-r--r--src/panels/places/placesitemmodel.h25
6 files changed, 47 insertions, 100 deletions
diff --git a/src/panels/information/filemetadataconfigurationdialog.cpp b/src/panels/information/filemetadataconfigurationdialog.cpp
index 0d1395b04..4ad9066c4 100644
--- a/src/panels/information/filemetadataconfigurationdialog.cpp
+++ b/src/panels/information/filemetadataconfigurationdialog.cpp
@@ -19,10 +19,10 @@
#include "filemetadataconfigurationdialog.h"
-#ifndef HAVE_NEPOMUK
+#ifndef HAVE_BALOO
#include <kfilemetadataconfigurationwidget.h>
#else
-#include <nepomuk2/filemetadataconfigwidget.h>
+#include <baloo/filemetadataconfigwidget.h>
#endif
#include <KLocale>
@@ -44,10 +44,10 @@ FileMetaDataConfigurationDialog::FileMetaDataConfigurationDialog(QWidget* parent
"be shown:"), this);
m_descriptionLabel->setWordWrap(true);
-#ifndef HAVE_NEPOMUK
+#ifndef HAVE_BALOO
m_configWidget = new KFileMetaDataConfigurationWidget(this);
#else
- m_configWidget = new Nepomuk2::FileMetaDataConfigWidget(this);
+ m_configWidget = new Baloo::FileMetaDataConfigWidget(this);
#endif
diff --git a/src/panels/information/filemetadataconfigurationdialog.h b/src/panels/information/filemetadataconfigurationdialog.h
index e897d245b..a3ce9548b 100644
--- a/src/panels/information/filemetadataconfigurationdialog.h
+++ b/src/panels/information/filemetadataconfigurationdialog.h
@@ -22,12 +22,12 @@
#include <KDialog>
#include <KFileItem>
-#include "config-nepomuk.h"
+#include "config-baloo.h"
-#ifndef HAVE_NEPOMUK
+#ifndef HAVE_BALOO
class KFileMetaDataConfigurationWidget;
#else
-namespace Nepomuk2 {
+namespace Baloo {
class FileMetaDataConfigWidget;
}
#endif
@@ -71,10 +71,10 @@ protected slots:
private:
QLabel* m_descriptionLabel;
-#ifndef HAVE_NEPOMUK
+#ifndef HAVE_BALOO
KFileMetaDataConfigurationWidget* m_configWidget;
#else
- Nepomuk2::FileMetaDataConfigWidget* m_configWidget;
+ Baloo::FileMetaDataConfigWidget* m_configWidget;
#endif
};
diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp
index f2f7378d7..b2dd1582e 100644
--- a/src/panels/information/informationpanelcontent.cpp
+++ b/src/panels/information/informationpanelcontent.cpp
@@ -31,10 +31,10 @@
#include <kseparator.h>
#include <KStringHandler>
-#ifndef HAVE_NEPOMUK
+#ifndef HAVE_BALOO
#include <KFileMetaDataWidget>
#else
-#include <nepomuk2/filemetadatawidget.h>
+#include <baloo/filemetadatawidget.h>
#endif
#include <panels/places/placesitem.h>
@@ -112,10 +112,10 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
const bool previewsShown = InformationPanelSettings::previewsShown();
m_preview->setVisible(previewsShown);
-#ifndef HAVE_NEPOMUK
+#ifndef HAVE_BALOO
m_metaDataWidget = new KFileMetaDataWidget(parent);
#else
- m_metaDataWidget = new Nepomuk2::FileMetaDataWidget(parent);
+ m_metaDataWidget = new Baloo::FileMetaDataWidget(parent);
#endif
m_metaDataWidget->setFont(KGlobalSettings::smallestReadableFont());
m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
@@ -166,7 +166,7 @@ void InformationPanelContent::showItem(const KFileItem& item)
}
const KUrl itemUrl = item.url();
- const bool isSearchUrl = itemUrl.protocol().contains("search") && item.nepomukUri().isEmpty();
+ const bool isSearchUrl = itemUrl.protocol().contains("search") && item.localPath().isEmpty();
if (!applyPlace(itemUrl)) {
setNameLabelText(item.text());
if (isSearchUrl) {
@@ -355,7 +355,7 @@ void InformationPanelContent::slotHasVideoChanged(bool hasVideo)
void InformationPanelContent::refreshMetaData()
{
- if (!m_item.isNull() && m_item.nepomukUri().isValid()) {
+ if (!m_item.isNull()) {
showItem(m_item);
}
}
diff --git a/src/panels/information/informationpanelcontent.h b/src/panels/information/informationpanelcontent.h
index cad6b51b0..67fdf6c5a 100644
--- a/src/panels/information/informationpanelcontent.h
+++ b/src/panels/information/informationpanelcontent.h
@@ -20,7 +20,7 @@
#ifndef INFORMATIONPANELCONTENT_H
#define INFORMATIONPANELCONTENT_H
-#include "config-nepomuk.h"
+#include "config-baloo.h"
#include <KConfig>
#include <KFileItem>
#include <KUrl>
@@ -38,13 +38,13 @@ class QLabel;
class QScrollArea;
namespace KIO {
- class PreviewJob;
+ class PreviewJob;
}
-#ifndef HAVE_NEPOMUK
+#ifndef HAVE_BALOO
class KFileMetaDataWidget;
#else
-namespace Nepomuk2 {
+namespace Baloo {
class FileMetaDataWidget;
}
#endif
@@ -147,10 +147,10 @@ private:
PixmapViewer* m_preview;
PhononWidget* m_phononWidget;
QLabel* m_nameLabel;
-#ifndef HAVE_NEPOMUK
+#ifndef HAVE_BALOO
KFileMetaDataWidget* m_metaDataWidget;
#else
- Nepomuk2::FileMetaDataWidget* m_metaDataWidget;
+ Baloo::FileMetaDataWidget* m_metaDataWidget;
#endif
QScrollArea* m_metaDataArea;
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index 681479dfb..baa770dfd 100644
--- a/src/panels/places/placesitemmodel.cpp
+++ b/src/panels/places/placesitemmodel.cpp
@@ -51,22 +51,17 @@
#include <views/dolphinview.h>
#include <views/viewproperties.h>
-#ifdef HAVE_NEPOMUK
- #include <Nepomuk2/ResourceManager>
- #include <Nepomuk2/Query/ComparisonTerm>
- #include <Nepomuk2/Query/LiteralTerm>
- #include <Nepomuk2/Query/FileQuery>
- #include <Nepomuk2/Query/ResourceTypeTerm>
- #include <Nepomuk2/Vocabulary/NFO>
- #include <Nepomuk2/Vocabulary/NIE>
+#ifdef HAVE_BALOO
+ #include <baloo/query.h>
+ #include <baloo/indexerconfig.h>
#endif
namespace {
// As long as KFilePlacesView from kdelibs is available in parallel, the
// system-bookmarks for "Recently Accessed" and "Search For" should be
// shown only inside the Places Panel. This is necessary as the stored
- // URLs needs to get translated to a Nepomuk-search-URL on-the-fly to
- // be independent from changes in the Nepomuk-search-URL-syntax.
+ // URLs needs to get translated to a Baloo-search-URL on-the-fly to
+ // be independent from changes in the Baloo-search-URL-syntax.
// Hence a prefix to the application-name of the stored bookmarks is
// added, which is only read by PlacesItemModel.
const char* AppNamePrefix = "-places-panel";
@@ -87,16 +82,9 @@ PlacesItemModel::PlacesItemModel(QObject* parent) :
m_updateBookmarksTimer(0),
m_storageSetupInProgress()
{
-#ifdef HAVE_NEPOMUK
- 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);
- }
-
+#ifdef HAVE_BALOO
+ Baloo::IndexerConfig config;
+ m_fileIndexingEnabled = config.fileIndexingEnabled();
#endif
const QString file = KStandardDirs::locateLocal("data", "kfileplaces/bookmarks.xml");
m_bookmarkManager = KBookmarkManager::managerForFile(file, "kfilePlaces");
@@ -959,35 +947,6 @@ void PlacesItemModel::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' ]]"
@@ -1145,7 +1104,7 @@ bool PlacesItemModel::equalBookmarkIdentifiers(const KBookmark& b1, const KBookm
KUrl PlacesItemModel::createTimelineUrl(const KUrl& url)
{
- // TODO: Clarify with the Nepomuk-team whether it makes sense
+ // TODO: Clarify with the Baloo-team whether it makes sense
// provide default-timeline-URLs like 'yesterday', 'this month'
// and 'last month'.
KUrl timelineUrl;
@@ -1195,18 +1154,16 @@ KUrl PlacesItemModel::createSearchUrl(const KUrl& url)
{
KUrl searchUrl;
-#ifdef HAVE_NEPOMUK
+#ifdef HAVE_BALOO
const QString path = url.pathOrUrl();
if (path.endsWith(QLatin1String("documents"))) {
- searchUrl = searchUrlForTerm(Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::Document()));
+ searchUrl = searchUrlForType("Document");
} else if (path.endsWith(QLatin1String("images"))) {
- searchUrl = searchUrlForTerm(Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::Image()));
+ searchUrl = searchUrlForType("Image");
} else if (path.endsWith(QLatin1String("audio"))) {
- searchUrl = searchUrlForTerm(Nepomuk2::Query::ComparisonTerm(Nepomuk2::Vocabulary::NIE::mimeType(),
- Nepomuk2::Query::LiteralTerm("audio")));
+ searchUrl = searchUrlForType("Audio");
} else if (path.endsWith(QLatin1String("videos"))) {
- searchUrl = searchUrlForTerm(Nepomuk2::Query::ComparisonTerm(Nepomuk2::Vocabulary::NIE::mimeType(),
- Nepomuk2::Query::LiteralTerm("video")));
+ searchUrl = searchUrlForType("Video");
} else {
Q_ASSERT(false);
}
@@ -1217,10 +1174,13 @@ KUrl PlacesItemModel::createSearchUrl(const KUrl& url)
return searchUrl;
}
-#ifdef HAVE_NEPOMUK
-KUrl PlacesItemModel::searchUrlForTerm(const Nepomuk2::Query::Term& term)
+#ifdef HAVE_BALOO
+KUrl PlacesItemModel::searchUrlForType(const QString& type)
{
- const Nepomuk2::Query::FileQuery query(term);
+ Baloo::Query query;
+ query.addType("File");
+ query.addType(type);
+
return query.toSearchUrl();
}
#endif
diff --git a/src/panels/places/placesitemmodel.h b/src/panels/places/placesitemmodel.h
index cd37e7353..4a374e502 100644
--- a/src/panels/places/placesitemmodel.h
+++ b/src/panels/places/placesitemmodel.h
@@ -20,7 +20,7 @@
#ifndef PLACESITEMMODEL_H
#define PLACESITEMMODEL_H
-#include <config-nepomuk.h>
+#include <config-baloo.h>
#include <kitemviews/kstandarditemmodel.h>
@@ -37,16 +37,6 @@ class PlacesItem;
class QAction;
class QTimer;
-#ifdef HAVE_NEPOMUK
- namespace Nepomuk2
- {
- namespace Query
- {
- class Term;
- }
- }
-#endif
-
// #define PLACESITEMMODEL_DEBUG
/**
@@ -127,7 +117,7 @@ public:
/**
* @return Converts the URL, which contains "virtual" URLs for system-items like
- * "search:/documents" into a Nepomuk-Query-URL that will be handled by
+ * "search:/documents" into a Query-URL that will be handled by
* the corresponding IO-slave. Virtual URLs for bookmarks are used to
* be independent from internal format changes.
*/
@@ -163,9 +153,6 @@ private slots:
* timeout of m_saveBookmarksTimer to prevent unnecessary savings.
*/
void saveBookmarks();
-
- void slotNepomukStarted();
- void slotNepomukStopped();
private:
struct SystemBookmarkData;
@@ -252,13 +239,13 @@ private:
*/
static KUrl createSearchUrl(const KUrl& url);
-#ifdef HAVE_NEPOMUK
+#ifdef HAVE_BALOO
/**
- * Helper method for createSearchUrl().
+ * Helper method for createSearchUrl()
* @return URL that can be listed by KIO and results in searching
- * for the given term.
+ * for the given type
*/
- static KUrl searchUrlForTerm(const Nepomuk2::Query::Term& term);
+ static KUrl searchUrlForType(const QString& type);
#endif
#ifdef PLACESITEMMODEL_DEBUG