Dolphin: Make Nepomuk Support Optional

Use the KFileMetadataWidget if Nepomuk is not present.

REVIEW: 108236
This commit is contained in:
Vishesh Handa 2013-01-07 14:24:47 +05:30
parent 863a80dbd0
commit 24c9bc6ce7
5 changed files with 40 additions and 2 deletions

View file

@ -1,8 +1,12 @@
macro_optional_find_package(Soprano)
macro_optional_find_package(NepomukCore)
macro_optional_find_package(NepomukWidgets)
macro_log_feature(NepomukCore_FOUND "Nepomuk" "Nepomuk" "http://www.kde.org" FALSE "" "For adding desktop-wide tagging support to dolphin")
macro_bool_to_01(NepomukCore_FOUND HAVE_NEPOMUK)
macro_log_feature(NepomukCore_FOUND "Nepomuk Core" "Nepomuk Core functionality" "http://www.kde.org" FALSE "" "For fetching additional file metadata in dolphin")
macro_log_feature(NepomukWidgets_FOUND "Nepomuk Widgets" "Nepomuk Widgets" "http://www.kde.org" FALSE "" "For adding desktop-wide tagging support to dolphin")
if( DEFINED NepomukCore_FOUND AND DEFINED NepomukWidgets_FOUND )
set(HAVE_NEPOMUK TRUE)
endif()
configure_file(config-nepomuk.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-nepomuk.h )
macro_bool_to_01(X11_Xrender_FOUND HAVE_XRENDER)

View file

@ -31,7 +31,11 @@
#include <kseparator.h>
#include <KStringHandler>
#ifndef HAVE_NEPOMUK
#include <KFileMetaDataWidget>
#else
#include <nepomuk2/filemetadatawidget.h>
#endif
#include <panels/places/placesitem.h>
#include <panels/places/placesitemmodel.h>
@ -107,7 +111,11 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
const bool previewsShown = InformationPanelSettings::previewsShown();
m_preview->setVisible(previewsShown);
#ifndef HAVE_NEPOMUK
m_metaDataWidget = new KFileMetaDataWidget(parent);
#else
m_metaDataWidget = new Nepomuk2::FileMetaDataWidget(parent);
#endif
m_metaDataWidget->setFont(KGlobalSettings::smallestReadableFont());
m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
connect(m_metaDataWidget, SIGNAL(urlActivated(KUrl)), this, SIGNAL(urlActivated(KUrl)));

View file

@ -20,6 +20,7 @@
#ifndef INFORMATIONPANELCONTENT_H
#define INFORMATIONPANELCONTENT_H
#include "config-nepomuk.h"
#include <KConfig>
#include <KFileItem>
#include <KUrl>
@ -34,9 +35,13 @@ class QString;
class QLabel;
class QScrollArea;
#ifndef HAVE_NEPOMUK
class KFileMetaDataWidget;
#else
namespace Nepomuk2 {
class FileMetaDataWidget;
}
#endif
/**
* @brief Manages the widgets that display the meta information
@ -136,7 +141,11 @@ private:
PixmapViewer* m_preview;
PhononWidget* m_phononWidget;
QLabel* m_nameLabel;
#ifndef HAVE_NEPOMUK
KFileMetaDataWidget* m_metaDataWidget;
#else
Nepomuk2::FileMetaDataWidget* m_metaDataWidget;
#endif
QScrollArea* m_metaDataArea;
PlacesItemModel* m_placesItemModel;

View file

@ -30,7 +30,11 @@
#include <QStylePainter>
#include <QVBoxLayout>
#ifndef HAVE_NEPOMUK
#include <KFileMetaDataWidget>
#else
#include <nepomuk2/filemetadatawidget.h>
#endif
// For the blurred tooltip background
#include <plasma/windoweffects.h>
@ -56,7 +60,11 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) :
m_name->setFont(font);
// Create widget for the meta data
#ifndef HAVE_NEPOMUK
m_fileMetaDataWidget = new KFileMetaDataWidget(this);
#else
m_fileMetaDataWidget = new Nepomuk2::FileMetaDataWidget(this);
#endif
m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText);
m_fileMetaDataWidget->setReadOnly(true);
connect(m_fileMetaDataWidget, SIGNAL(metaDataRequestFinished(KFileItemList)),

View file

@ -23,13 +23,18 @@
#define FILEMETADATATOOLTIP_H
#include <QWidget>
#include "config-nepomuk.h"
class KFileItemList;
class QLabel;
#ifndef HAVE_NEPOMUK
class KFileMetaDataWidget;
#else
namespace Nepomuk2 {
class FileMetaDataWidget;
}
#endif
/**
* @brief Tooltip, that shows the meta information and a preview of one
@ -71,7 +76,11 @@ protected:
private:
QLabel* m_preview;
QLabel* m_name;
#ifndef HAVE_NEPOMUK
KFileMetaDataWidget* m_fileMetaDataWidget;
#else
Nepomuk2::FileMetaDataWidget* m_fileMetaDataWidget;
#endif
};
#endif