mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
Adapt Dolphin Nepomuk support to namespace changes.
svn path=/trunk/KDE/kdebase/apps/; revision=674158
This commit is contained in:
parent
53a66dee98
commit
b2547cf9a4
|
@ -86,15 +86,15 @@ qt4_add_dbus_adaptor(dolphin_SRCS
|
|||
dolphinmainwindow.h DolphinMainWindow)
|
||||
kde4_add_executable(dolphin ${dolphin_SRCS})
|
||||
|
||||
find_package(KMetaData)
|
||||
macro_bool_to_01(KMetaData_FOUND HAVE_KMETADATA)
|
||||
find_package(Nepomuk)
|
||||
macro_bool_to_01(Nepomuk_FOUND HAVE_NEPOMUK)
|
||||
|
||||
configure_file(config-kmetadata.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kmetadata.h )
|
||||
configure_file(config-nepomuk.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-nepomuk.h )
|
||||
target_link_libraries(dolphin ${KDE4_KDECORE_LIBS} ${KDE4_KDEPRINT_LIBS} ${KDE4_KFILE_LIBS} konq dolphinprivate)
|
||||
|
||||
if (KMetaData_FOUND)
|
||||
target_link_libraries(dolphin ${KMETADATA_LIBRARIES})
|
||||
endif (KMetaData_FOUND)
|
||||
if (Nepomuk_FOUND)
|
||||
target_link_libraries(dolphin ${NEPOMUK_LIBRARIES})
|
||||
endif (Nepomuk_FOUND)
|
||||
|
||||
install(TARGETS dolphin DESTINATION ${BIN_INSTALL_DIR})
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#cmakedefine HAVE_KMETADATA
|
1
src/config-nepomuk.h.cmake
Normal file
1
src/config-nepomuk.h.cmake
Normal file
|
@ -0,0 +1 @@
|
|||
#cmakedefine HAVE_NEPOMUK
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "dolphinmainwindow.h"
|
||||
|
||||
#include <config-kmetadata.h>
|
||||
#include "config-nepomuk.h"
|
||||
|
||||
#include "dolphinapplication.h"
|
||||
#include "dolphinnewmenu.h"
|
||||
|
@ -1000,7 +1000,7 @@ void DolphinMainWindow::init()
|
|||
// assure a proper default size if Dolphin runs the first time
|
||||
resize(700, 500);
|
||||
}
|
||||
#ifdef HAVE_KMETADATA
|
||||
#ifdef HAVE_NEPOMUK
|
||||
if (!MetaDataWidget::metaDataAvailable())
|
||||
activeViewContainer()->statusBar()->setMessage(i18n("Failed to contact Nepomuk service, annotation and tagging are disabled."), DolphinStatusBar::Error);
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "infosidebarpage.h"
|
||||
|
||||
#include <config-kmetadata.h>
|
||||
#include "config-nepomuk.h"
|
||||
|
||||
#include <kfileplacesmodel.h>
|
||||
#include <klocale.h>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "metadatawidget.h"
|
||||
|
||||
#include <config-kmetadata.h>
|
||||
#include <config-nepomuk.h>
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
|
@ -27,23 +27,20 @@
|
|||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QTextEdit>
|
||||
|
||||
#ifdef HAVE_KMETADATA
|
||||
#include <kmetadata/kmetadatatagwidget.h>
|
||||
#include <kmetadata/resourcemanager.h>
|
||||
#include <kmetadata/resource.h>
|
||||
#include <kmetadata/variant.h>
|
||||
#include <kmetadata/kratingwidget.h>
|
||||
#ifdef HAVE_NEPOMUK
|
||||
#include <nepomuk/kmetadatatagwidget.h>
|
||||
#include <nepomuk/resourcemanager.h>
|
||||
#include <nepomuk/resource.h>
|
||||
#include <nepomuk/variant.h>
|
||||
#include <nepomuk/kratingwidget.h>
|
||||
#include <nepomuk/global.h>
|
||||
#endif
|
||||
|
||||
// FIXME: these should be replaced by using KMetaData::File once it is available again
|
||||
static const char* s_nfoFile = "http://ont.semanticdesktop.org/2007/03/22/nfo#File";
|
||||
static const char* s_nfoFileUrl = "http://ont.semanticdesktop.org/2007/03/22/nfo#fileUrl";
|
||||
|
||||
|
||||
bool MetaDataWidget::metaDataAvailable()
|
||||
{
|
||||
#ifdef HAVE_KMETADATA
|
||||
return !Nepomuk::KMetaData::ResourceManager::instance()->init();
|
||||
#ifdef HAVE_NEPOMUK
|
||||
return !Nepomuk::ResourceManager::instance()->init();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
@ -53,18 +50,18 @@ bool MetaDataWidget::metaDataAvailable()
|
|||
class MetaDataWidget::Private
|
||||
{
|
||||
public:
|
||||
#ifdef HAVE_KMETADATA
|
||||
#ifdef HAVE_NEPOMUK
|
||||
void loadComment(const QString& comment);
|
||||
|
||||
QMap<KUrl, Nepomuk::KMetaData::Resource> files;
|
||||
QMap<KUrl, Nepomuk::Resource> files;
|
||||
|
||||
QTextEdit* editComment;
|
||||
KRatingWidget* ratingWidget;
|
||||
Nepomuk::KMetaData::TagWidget* tagWidget;
|
||||
Nepomuk::TagWidget* tagWidget;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef HAVE_KMETADATA
|
||||
#ifdef HAVE_NEPOMUK
|
||||
void MetaDataWidget::Private::loadComment(const QString& comment)
|
||||
{
|
||||
editComment->blockSignals(true);
|
||||
|
@ -83,11 +80,11 @@ void MetaDataWidget::Private::loadComment(const QString& comment)
|
|||
MetaDataWidget::MetaDataWidget(QWidget* parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
#ifdef HAVE_KMETADATA
|
||||
#ifdef HAVE_NEPOMUK
|
||||
d = new Private;
|
||||
d->editComment = new QTextEdit(this);
|
||||
d->ratingWidget = new KRatingWidget(this);
|
||||
d->tagWidget = new Nepomuk::KMetaData::TagWidget(this);
|
||||
d->tagWidget = new Nepomuk::TagWidget(this);
|
||||
connect(d->ratingWidget, SIGNAL(ratingChanged(unsigned int)), this, SLOT(slotRatingChanged(unsigned int)));
|
||||
connect(d->editComment, SIGNAL(textChanged()), this, SLOT(slotCommentChanged()));
|
||||
|
||||
|
@ -128,13 +125,13 @@ void MetaDataWidget::setFile(const KUrl& url)
|
|||
|
||||
void MetaDataWidget::setFiles(const KUrl::List& urls)
|
||||
{
|
||||
#ifdef HAVE_KMETADATA
|
||||
#ifdef HAVE_NEPOMUK
|
||||
// FIXME: replace with KMetaData::File once we have it again
|
||||
d->files.clear();
|
||||
bool first = true;
|
||||
QList<Nepomuk::KMetaData::Resource> fileRes;
|
||||
QList<Nepomuk::Resource> fileRes;
|
||||
Q_FOREACH( KUrl url, urls ) {
|
||||
Nepomuk::KMetaData::Resource file( url.url(), s_nfoFile );
|
||||
Nepomuk::Resource file( url.url(), Nepomuk::NFO::File() );
|
||||
// file.setLocation(url.url());
|
||||
d->files.insert( url, file );
|
||||
fileRes.append( file );
|
||||
|
@ -163,8 +160,8 @@ void MetaDataWidget::setFiles(const KUrl::List& urls)
|
|||
|
||||
void MetaDataWidget::slotCommentChanged()
|
||||
{
|
||||
#ifdef HAVE_KMETADATA
|
||||
for ( QMap<KUrl, Nepomuk::KMetaData::Resource>::iterator it = d->files.begin();
|
||||
#ifdef HAVE_NEPOMUK
|
||||
for ( QMap<KUrl, Nepomuk::Resource>::iterator it = d->files.begin();
|
||||
it != d->files.end(); ++it ) {
|
||||
it.value().setDescription(d->editComment->toPlainText());
|
||||
}
|
||||
|
@ -174,8 +171,8 @@ void MetaDataWidget::slotCommentChanged()
|
|||
|
||||
void MetaDataWidget::slotRatingChanged(unsigned int rating)
|
||||
{
|
||||
#ifdef HAVE_KMETADATA
|
||||
for ( QMap<KUrl, Nepomuk::KMetaData::Resource>::iterator it = d->files.begin();
|
||||
#ifdef HAVE_NEPOMUK
|
||||
for ( QMap<KUrl, Nepomuk::Resource>::iterator it = d->files.begin();
|
||||
it != d->files.end(); ++it ) {
|
||||
it.value().setRating(rating);
|
||||
}
|
||||
|
@ -185,7 +182,7 @@ void MetaDataWidget::slotRatingChanged(unsigned int rating)
|
|||
|
||||
bool MetaDataWidget::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
#ifdef HAVE_KMETADATA
|
||||
#ifdef HAVE_NEPOMUK
|
||||
if (obj == d->editComment->viewport() || obj == d->editComment) {
|
||||
if (event->type() == QEvent::FocusOut) {
|
||||
// make sure the info text is displayed again
|
||||
|
|
Loading…
Reference in a new issue