summaryrefslogtreecommitdiff
path: root/src/bookmarks
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-05-27 12:00:28 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-05-27 23:34:32 +0200
commita33b32930451d479108fce701267f6c8bdc19319 (patch)
treedd45422752326580e8596e0aac3e047b976faca7 /src/bookmarks
parentFancy bookmarking on rekonq :) (diff)
downloadrekonq-a33b32930451d479108fce701267f6c8bdc19319.tar.xz
Let nepomuk dependencies being optional
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/bookmarkowner.cpp39
-rw-r--r--src/bookmarks/bookmarkowner.h7
-rw-r--r--src/bookmarks/bookmarkscontextmenu.cpp5
3 files changed, 39 insertions, 12 deletions
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp
index 74683874..6cea5e9c 100644
--- a/src/bookmarks/bookmarkowner.cpp
+++ b/src/bookmarks/bookmarkowner.cpp
@@ -37,19 +37,27 @@
#include "mainview.h"
#include "mainwindow.h"
#include "webtab.h"
-#include "resourcelinkdialog.h"
// KDE Includes
#include <KBookmarkDialog>
#include <KLocalizedString>
#include <KMessageBox>
-#include <Nepomuk/Resource>
-#include <Nepomuk/Vocabulary/NFO>
-
// Qt Includes
#include <QClipboard>
+// Nepomuk config include
+#include "../config-nepomuk.h"
+
+#ifdef HAVE_NEPOMUK
+ // Local Nepomuk Includes
+ #include "resourcelinkdialog.h"
+
+ // Nepomuk Includes
+ #include <Nepomuk/Resource>
+ #include <Nepomuk/Vocabulary/NFO>
+#endif
+
BookmarkOwner::BookmarkOwner(KBookmarkManager *manager, QObject *parent)
: QObject(parent)
@@ -90,9 +98,11 @@ KAction* BookmarkOwner::createAction(const KBookmark &bookmark, const BookmarkAc
case EDIT:
return createAction(i18n("Edit"), "configure",
i18n("Edit the bookmark"), SLOT(editBookmark(KBookmark)), bookmark);
+#ifdef HAVE_NEPOMUK
case FANCYBOOKMARK:
return createAction(i18n("Fancy Bookmark"), "nepomuk",
i18n("Link Nepomuk resources"), SLOT(fancyBookmark(KBookmark)), bookmark);
+#endif
case DELETE:
return createAction(i18n("Delete"), "edit-delete",
i18n("Delete the bookmark"), SLOT(deleteBookmark(KBookmark)), bookmark);
@@ -212,12 +222,12 @@ KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
else
{
parent = rApp->bookmarkManager()->rootGroup();
+#ifdef HAVE_NEPOMUK
Nepomuk::Resource nfoResource;
nfoResource = ((QUrl)currentUrl());
nfoResource.addType( Nepomuk::Vocabulary::NFO::Website() );
nfoResource.setLabel( currentTitle() );
- qDebug()<<nfoResource.uri();
-
+#endif
}
KBookmark newBk = parent.addBookmark(currentTitle(), KUrl(currentUrl()));
@@ -310,13 +320,16 @@ void BookmarkOwner::editBookmark(KBookmark bookmark)
delete dialog;
}
-void BookmarkOwner::fancyBookmark(KBookmark bookmark)
-{
- Nepomuk::Resource nfoResource = (KUrl)bookmark.url();
- Nepomuk::ResourceLinkDialog r( nfoResource );
- r.exec();
-}
+#ifdef HAVE_NEPOMUK
+ void BookmarkOwner::fancyBookmark(KBookmark bookmark)
+ {
+ Nepomuk::Resource nfoResource = (KUrl)bookmark.url();
+ Nepomuk::ResourceLinkDialog r( nfoResource );
+ r.exec();
+
+ }
+#endif
bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark)
{
@@ -354,8 +367,10 @@ bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark)
return false;
bmg.deleteBookmark(bookmark);
+#ifdef HAVE_NEPOMUK
Nepomuk::Resource nfoResource(bookmark.url());
nfoResource.remove();
+#endif
m_manager->emitChanged(bmg);
return true;
}
diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h
index a9712d55..01a5c480 100644
--- a/src/bookmarks/bookmarkowner.h
+++ b/src/bookmarks/bookmarkowner.h
@@ -34,6 +34,9 @@
// Rekonq Includes
#include "rekonq_defines.h"
+// Nepomuk config include
+#include "../config-nepomuk.h"
+
// KDE Includes
#include <KAction>
#include <KBookmarkOwner>
@@ -60,7 +63,9 @@ public:
NEW_SEPARATOR,
COPY,
EDIT,
+#ifdef HAVE_NEPOMUK
FANCYBOOKMARK,
+#endif
DELETE,
NUM_ACTIONS,
SET_TOOLBAR_FOLDER,
@@ -108,7 +113,9 @@ public Q_SLOTS:
void copyLink(const KBookmark &bookmark);
void editBookmark(KBookmark bookmark);
+#ifdef HAVE_NEPOMUK
void fancyBookmark(KBookmark bookmark);
+#endif
bool deleteBookmark(const KBookmark &bookmark);
void setToolBarFolder(KBookmark bookmark = KBookmark());
void unsetToolBarFolder();
diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp
index bc8f0e3a..b49f6883 100644
--- a/src/bookmarks/bookmarkscontextmenu.cpp
+++ b/src/bookmarks/bookmarkscontextmenu.cpp
@@ -27,6 +27,9 @@
// Self Includes
#include "bookmarkscontextmenu.h"
+// Nepomuk config include
+#include "../config-nepomuk.h"
+
// Local Includes
#include "bookmarkowner.h"
#include "bookmarkmanager.h"
@@ -67,7 +70,9 @@ void BookmarksContextMenu::addBookmarkActions()
addSeparator();
addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::EDIT));
+#ifdef HAVE_NEPOMUK
addAction(m_bmOwner->createAction(bookmark(),BookmarkOwner::FANCYBOOKMARK));
+#endif
addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::DELETE));
}