summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt20
-rw-r--r--src/bookmarks/bookmarkowner.cpp14
-rw-r--r--src/bookmarks/bookmarkowner.h3
-rw-r--r--src/bookmarks/bookmarkscontextmenu.cpp3
-rw-r--r--src/nepomuk/utils/nepomukutils_export.h40
-rw-r--r--src/nepomuk/utils/resourcemodel.cpp230
-rw-r--r--src/nepomuk/utils/resourcemodel.h177
-rw-r--r--src/nepomuk/utils/simpleresourcemodel.cpp170
-rw-r--r--src/nepomuk/utils/simpleresourcemodel.h144
-rw-r--r--src/urlbar/bookmarkwidget.cpp16
-rw-r--r--src/urlbar/bookmarkwidget.h13
-rw-r--r--src/urlbar/newresourcedialog.cpp30
-rw-r--r--src/urlbar/newresourcedialog.h6
-rw-r--r--src/urlbar/resourcelinkdialog.cpp162
-rw-r--r--src/urlbar/resourcelinkdialog.h4
15 files changed, 895 insertions, 137 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 143f9dc1..69821d81 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -110,13 +110,15 @@ set(rekonq_KDEINIT_SRCS
# Nepomuk OPTIONAL src files
-IF(HAVE_NEPOMUK)
+IF(NepomukCore_FOUND)
SET( rekonq_KDEINIT_SRCS
${rekonq_KDEINIT_SRCS}
urlbar/resourcelinkdialog.cpp
urlbar/newresourcedialog.cpp
+ nepomuk/utils/simpleresourcemodel.cpp
+ nepomuk/utils/resourcemodel.cpp
)
-ENDIF(HAVE_NEPOMUK)
+ENDIF(NepomukCore_FOUND)
# Opera sync optional src files
@@ -180,13 +182,14 @@ INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR}
)
# Nepomuk optional include directories
-IF(HAVE_NEPOMUK)
+IF(NepomukCore_FOUND)
INCLUDE_DIRECTORIES(${SOPRANO_INCLUDE_DIR}
- ${NEPOMUK_INCLUDE_DIR}
+ ${NEPOMUK_CORE_INCLUDE_DIR}
)
+ FIND_PACKAGE(Soprano REQUIRED)
INCLUDE(SopranoAddOntology)
-ENDIF(HAVE_NEPOMUK)
+ENDIF(NepomukCore_FOUND)
# Opera sync optional include directories
IF(HAVE_QCA2 AND HAVE_QTOAUTH)
@@ -231,13 +234,12 @@ TARGET_LINK_LIBRARIES ( kdeinit_rekonq
)
# Nepomuk optional target link libraries
-IF(HAVE_NEPOMUK)
+IF(NepomukCore_FOUND)
TARGET_LINK_LIBRARIES( kdeinit_rekonq
- ${NEPOMUK_LIBRARIES}
- ${NEPOMUK_QUERY_LIBRARIES}
+ ${NEPOMUK_CORE_LIBRARY}
${SOPRANO_LIBRARIES}
)
-ENDIF(HAVE_NEPOMUK)
+ENDIF(NepomukCore_FOUND)
# Opera sync optional link libraries
IF(HAVE_QCA2 AND HAVE_QTOAUTH)
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp
index ba2d8f63..329fd0bc 100644
--- a/src/bookmarks/bookmarkowner.cpp
+++ b/src/bookmarks/bookmarkowner.cpp
@@ -52,8 +52,8 @@
#include "resourcelinkdialog.h"
// Nepomuk Includes
-#include <Nepomuk/Resource>
-#include <Nepomuk/Vocabulary/NFO>
+#include <Nepomuk2/Resource>
+#include <Nepomuk2/Vocabulary/NFO>
#endif
@@ -221,9 +221,9 @@ KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
{
parent = BookmarkManager::self()->rootGroup();
#ifdef HAVE_NEPOMUK
- Nepomuk::Resource nfoResource;
+ Nepomuk2::Resource nfoResource;
nfoResource = ((QUrl)currentUrl());
- nfoResource.addType(Nepomuk::Vocabulary::NFO::Website());
+ nfoResource.addType(Nepomuk2::Vocabulary::NFO::Website());
nfoResource.setLabel(currentTitle());
#endif
}
@@ -327,9 +327,9 @@ void BookmarkOwner::editBookmark(KBookmark bookmark)
#ifdef HAVE_NEPOMUK
void BookmarkOwner::fancyBookmark(KBookmark bookmark)
{
- Nepomuk::Resource nfoResource = (KUrl)bookmark.url();
+ Nepomuk2::Resource nfoResource = (KUrl)bookmark.url();
- QPointer<Nepomuk::ResourceLinkDialog> r = new Nepomuk::ResourceLinkDialog(nfoResource);
+ QPointer<Nepomuk2::ResourceLinkDialog> r = new Nepomuk2::ResourceLinkDialog(nfoResource);
r->exec();
r->deleteLater();
@@ -373,7 +373,7 @@ bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark)
bmg.deleteBookmark(bookmark);
#ifdef HAVE_NEPOMUK
- Nepomuk::Resource nfoResource(bookmark.url());
+ Nepomuk2::Resource nfoResource(bookmark.url());
nfoResource.remove();
#endif
m_manager->emitChanged(bmg);
diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h
index 6a18c237..5be30853 100644
--- a/src/bookmarks/bookmarkowner.h
+++ b/src/bookmarks/bookmarkowner.h
@@ -34,9 +34,6 @@
// Rekonq Includes
#include "rekonq_defines.h"
-// Nepomuk config include
-#include <config-nepomuk.h>
-
// KDE Includes
#include <KAction>
#include <KBookmarkOwner>
diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp
index 69cde758..2ae74b5c 100644
--- a/src/bookmarks/bookmarkscontextmenu.cpp
+++ b/src/bookmarks/bookmarkscontextmenu.cpp
@@ -28,9 +28,6 @@
// Self Includes
#include "bookmarkscontextmenu.h"
-// Nepomuk config include
-#include <config-nepomuk.h>
-
// Local Includes
#include "bookmarkowner.h"
#include "bookmarkmanager.h"
diff --git a/src/nepomuk/utils/nepomukutils_export.h b/src/nepomuk/utils/nepomukutils_export.h
new file mode 100644
index 00000000..718bd7c3
--- /dev/null
+++ b/src/nepomuk/utils/nepomukutils_export.h
@@ -0,0 +1,40 @@
+/* This file is part of the KDE project
+ Copyright (C) 2007 David Faure <faure@kde.org>
+ Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef NEPOMUKUTILS_EXPORT_H
+#define NEPOMUKUTILS_EXPORT_H
+
+/* needed for KDE_EXPORT and KDE_IMPORT macros */
+#include <kdemacros.h>
+
+#ifndef NEPOMUKUTILS_EXPORT
+# if defined(KDELIBS_STATIC_LIBS)
+ /* No export/import for static libraries */
+# define NEPOMUKUTILS_EXPORT
+# elif defined(MAKE_NEPOMUKUTILS_LIB)
+ /* We are building this library */
+# define NEPOMUKUTILS_EXPORT KDE_EXPORT
+# else
+ /* We are using this library */
+# define NEPOMUKUTILS_EXPORT KDE_IMPORT
+# endif
+#endif
+
+#endif
diff --git a/src/nepomuk/utils/resourcemodel.cpp b/src/nepomuk/utils/resourcemodel.cpp
new file mode 100644
index 00000000..72c71e9b
--- /dev/null
+++ b/src/nepomuk/utils/resourcemodel.cpp
@@ -0,0 +1,230 @@
+/*
+ This file is part of the Nepomuk KDE project.
+ Copyright (C) 2007-2010 Sebastian Trueg <trueg@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "resourcemodel.h"
+
+#include <QtCore/QUrl>
+#include <QtCore/QList>
+#include <QtCore/QMimeData>
+
+#include "kurl.h"
+#include "kdebug.h"
+#include "kcategorizedsortfilterproxymodel.h"
+#include "kicon.h"
+#include "klocale.h"
+
+#include <Nepomuk2/Resource>
+#include <Nepomuk2/Types/Class>
+#include <Nepomuk2/Variant>
+
+#include <Soprano/Vocabulary/RDFS>
+#include <Soprano/Vocabulary/NAO>
+
+
+Q_DECLARE_METATYPE(Nepomuk2::Types::Class)
+
+
+class Nepomuk2::Utils::ResourceModel::Private
+{
+public:
+};
+
+
+Nepomuk2::Utils::ResourceModel::ResourceModel( QObject* parent )
+ : QAbstractItemModel( parent ),
+ d( new Private() )
+{
+}
+
+
+Nepomuk2::Utils::ResourceModel::~ResourceModel()
+{
+ delete d;
+}
+
+
+QModelIndex Nepomuk2::Utils::ResourceModel::parent( const QModelIndex& child ) const
+{
+ Q_UNUSED(child);
+ return QModelIndex();
+}
+
+
+int Nepomuk2::Utils::ResourceModel::columnCount( const QModelIndex& parent ) const
+{
+ Q_UNUSED(parent);
+ return ResourceModelColumnCount;
+}
+
+
+QVariant Nepomuk2::Utils::ResourceModel::data( const QModelIndex& index, int role ) const
+{
+ Nepomuk2::Resource res = resourceForIndex( index );
+ if( !res.isValid() ) {
+ return QVariant();
+ }
+
+ //
+ // Part 1: column specific data
+ //
+ switch( index.column() ) {
+ case ResourceColumn:
+ switch( role ) {
+ case Qt::DisplayRole:
+ case Qt::EditRole:
+ return res.genericLabel();
+
+ case Qt::DecorationRole: {
+ QString iconName = res.genericIcon();
+ if( !iconName.isEmpty() ) {
+ return KIcon( iconName );
+ }
+ else {
+ QIcon icon = Types::Class(res.type()).icon();
+ if( !icon.isNull() )
+ return icon;
+ else
+ return QVariant();
+ }
+ }
+
+ case Qt::ToolTipRole:
+ return KUrl( res.uri() ).prettyUrl();
+
+ }
+
+ case ResourceTypeColumn:
+ switch( role ) {
+ case Qt::DisplayRole:
+ case Qt::EditRole:
+ return Types::Class( res.type() ).label();
+
+ case Qt::DecorationRole: {
+ QIcon icon = Types::Class(res.type()).icon();
+ if( !icon.isNull() )
+ return icon;
+ else
+ return QVariant();
+ }
+
+ case Qt::ToolTipRole:
+ return KUrl(res.type()).prettyUrl();
+ }
+ }
+
+
+ //
+ // Part 2: column-independant data
+ //
+ switch( role ) {
+ case KCategorizedSortFilterProxyModel::CategorySortRole:
+ // FIXME: sort files before other stuff and so on
+
+ case KCategorizedSortFilterProxyModel::CategoryDisplayRole: {
+ Q_ASSERT( !res.type().isEmpty() );
+ Nepomuk2::Types::Class c( res.type() );
+ QString cat = c.label();
+ if ( cat.isEmpty() ) {
+ cat = c.name();
+ }
+ if ( c.uri() == Soprano::Vocabulary::RDFS::Resource() || cat.isEmpty() ) {
+ cat = i18nc( "@title KCategorizedSortFilterProxyModel grouping for all Nepomukj resources that are of type rdfs:Resource", "Miscellaneous" );
+ }
+
+ return cat;
+ }
+
+ case ResourceRole:
+ return QVariant::fromValue( res );
+
+ case ResourceTypeRole:
+ return QVariant::fromValue( Nepomuk2::Types::Class(res.type()) );
+
+ case ResourceCreationDateRole:
+ return res.property( Soprano::Vocabulary::NAO::created() ).toDateTime();
+ }
+
+ // fallback
+ return QVariant();
+}
+
+
+QVariant Nepomuk2::Utils::ResourceModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if( role == Qt::DisplayRole ) {
+ switch( section ) {
+ case ResourceColumn:
+ return i18nc("@title:column The Nepomuk resource label and icon", "Resource");
+ case ResourceTypeColumn:
+ return i18nc("@title:column The Nepomuk resource's RDF type", "Resource Type");
+ }
+ }
+
+ return QAbstractItemModel::headerData(section, orientation, role);
+}
+
+
+Qt::ItemFlags Nepomuk2::Utils::ResourceModel::flags( const QModelIndex& index ) const
+{
+ if ( index.isValid() ) {
+ return QAbstractItemModel::flags( index ) | Qt::ItemIsDragEnabled;
+ }
+ else {
+ return QAbstractItemModel::flags( index );
+ }
+}
+
+
+QMimeData* Nepomuk2::Utils::ResourceModel::mimeData( const QModelIndexList& indexes ) const
+{
+ KUrl::List uris;
+ foreach ( const QModelIndex& index, indexes ) {
+ if (index.isValid()) {
+ uris << index.data( ResourceRole ).value<Resource>().uri();
+ }
+ }
+
+ QMimeData* mimeData = new QMimeData();
+ uris.populateMimeData( mimeData );
+
+ QByteArray data;
+ QDataStream s( &data, QIODevice::WriteOnly );
+ s << uris;
+ mimeData->setData( mimeTypes().first(), data );
+
+ return mimeData;
+}
+
+
+QStringList Nepomuk2::Utils::ResourceModel::mimeTypes() const
+{
+ return( QStringList()
+ << QLatin1String( "application/x-nepomuk-resource-uri" )
+ << KUrl::List::mimeDataTypes() );
+}
+
+
+bool Nepomuk2::Utils::ResourceModel::setData( const QModelIndex& index, const QVariant& value, int role )
+{
+ return QAbstractItemModel::setData(index, value, role);
+}
+
+#include "resourcemodel.moc"
diff --git a/src/nepomuk/utils/resourcemodel.h b/src/nepomuk/utils/resourcemodel.h
new file mode 100644
index 00000000..526c7ac0
--- /dev/null
+++ b/src/nepomuk/utils/resourcemodel.h
@@ -0,0 +1,177 @@
+/*
+ This file is part of the Nepomuk KDE project.
+ Copyright (C) 2007-2010 Sebastian Trueg <trueg@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _NEPOMUK_RESOUCE_MODEL_H_
+#define _NEPOMUK_RESOUCE_MODEL_H_
+
+#include <QtCore/QAbstractItemModel>
+
+#include "nepomukutils_export.h"
+
+namespace Nepomuk2 {
+
+ class Resource;
+
+ namespace Utils {
+ /**
+ * \class ResourceModel resourcemodel.h Nepomuk/Utils/ResourceModel
+ *
+ * \brief Base class for all models providing a plain list of resources.
+ *
+ * The %ResourceModel is a base class for models that handle a set of
+ * %Nepomuk Resource instances. This can be a simple list as in SimpleResourceModel
+ * or a set of query results as in ResultModel. It could also be a dynamic list
+ * which is updated while the user scrolls it.
+ *
+ * %ResourceModel cannot be instanciated by itself. Use one of the subclasses
+ * or derive your own subclass from it.
+ *
+ * At least the following methods need to be implemented in a subclass:
+ * \li resourceForIndex()
+ * \li indexForResource(),
+ * \li QAbstractItemModel::rowCount()
+ * \li QAbstractItemModel::index()
+ *
+ * \author Sebastian Trueg <trueg@kde.org>
+ *
+ * \since 4.6
+ */
+ class NEPOMUKUTILS_EXPORT ResourceModel : public QAbstractItemModel
+ {
+ Q_OBJECT
+
+ public:
+ /**
+ * Constructor.
+ */
+ ResourceModel( QObject* parent = 0 );
+
+ /**
+ * Destructor
+ */
+ virtual ~ResourceModel();
+
+ /**
+ * The columns supported by ResourceModel are identified
+ * by this enumeration.
+ */
+ enum ResourceModelColumns {
+ /// The first column displays the label of the resource and its icon
+ ResourceColumn = 0,
+
+ /// The second column displays the resource's type
+ ResourceTypeColumn = 1,
+
+ /// The number of columns
+ ResourceModelColumnCount = 2
+ };
+
+ /**
+ * Custom roles that can be accessed for example in delegates.
+ */
+ enum ResourceRoles {
+ /**
+ * The resource itself, provided as a Nepomuk::Resource instance.
+ */
+ ResourceRole = 7766897,
+
+ /**
+ * The type of the resource, provided as a Nepomuk::Types::Class
+ * instance.
+ */
+ ResourceTypeRole = 687585,
+
+ /**
+ * The creation date of the resource.
+ */
+ ResourceCreationDateRole = 7766898
+ };
+
+ /**
+ * Get the Resource which corresponds to \p index.
+ *
+ * \return The Resource which corresponds to \p index or an invalid Resource
+ * if \p index is invalid.
+ */
+ virtual Resource resourceForIndex( const QModelIndex& index ) const = 0;
+
+ /**
+ * Get the index for a resource.
+ *
+ * \return The index which corresponds to \p res of an invalid QModelIndex
+ * if \p res is not part of this model.
+ */
+ virtual QModelIndex indexForResource( const Resource& res ) const = 0;
+
+ /**
+ * The default implementation returns an invalid QModelIndex, thus providing
+ * a plain list.
+ */
+ virtual QModelIndex parent( const QModelIndex& child ) const;
+
+ /**
+ * The default implementation returns 2 with the first column representing the resource
+ * itself and the second one showing the type.
+ */
+ virtual int columnCount( const QModelIndex& parent ) const;
+
+ /**
+ * Handles most roles typically used in applications like Qt::DisplayRole, Qt::ToolTipRole,
+ * and Qt::DecorationRole. Additionally KCategorizedSortFilterProxyModel roles are supported
+ * categorizing by resource types.
+ */
+ virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
+
+ /**
+ * Provides header data for the supported columns.
+ */
+ virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
+
+ /**
+ * Reimplemented to support dragging of resources out of the model.
+ */
+ virtual Qt::ItemFlags flags( const QModelIndex& index ) const;
+
+ /**
+ * Stores the resource URIs via KUrl::List::populateMimeData() and as a specific
+ * "application/x-nepomuk-resource-uri" mime type to indicate that these are URIs
+ * corresponding to actual %Nepomuk resources.
+ */
+ virtual QMimeData* mimeData( const QModelIndexList& indexes ) const;
+
+ /**
+ * \return The KUrl mime types and "application/x-nepomuk-resource-uri".
+ */
+ virtual QStringList mimeTypes() const;
+
+ /**
+ * Provided for future extensions.
+ */
+ virtual bool setData( const QModelIndex& index, const QVariant& value, int role );
+
+ private:
+ class Private;
+ Private* const d;
+ };
+ }
+}
+
+#endif
diff --git a/src/nepomuk/utils/simpleresourcemodel.cpp b/src/nepomuk/utils/simpleresourcemodel.cpp
new file mode 100644
index 00000000..f500f648
--- /dev/null
+++ b/src/nepomuk/utils/simpleresourcemodel.cpp
@@ -0,0 +1,170 @@
+/*
+ This file is part of the Nepomuk KDE project.
+ Copyright (C) 2008-2010 Sebastian Trueg <trueg@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "simpleresourcemodel.h"
+
+#include <QtCore/QUrl>
+#include <QtCore/QList>
+
+#include <Nepomuk2/Resource>
+#include <Nepomuk2/Query/Result>
+
+#include "kdebug.h"
+#include "kurl.h"
+
+
+class Nepomuk2::Utils::SimpleResourceModel::Private
+{
+public:
+ QList<Nepomuk2::Resource> resources;
+};
+
+
+Nepomuk2::Utils::SimpleResourceModel::SimpleResourceModel( QObject* parent )
+ : ResourceModel( parent ),
+ d( new Private() )
+{
+}
+
+
+Nepomuk2::Utils::SimpleResourceModel::~SimpleResourceModel()
+{
+ delete d;
+}
+
+
+QModelIndex Nepomuk2::Utils::SimpleResourceModel::indexForResource( const Resource& res ) const
+{
+ Q_ASSERT( res.isValid() );
+ // FIXME: performance
+ int i = 0;
+ QList<Nepomuk2::Resource>::const_iterator end = d->resources.constEnd();
+ for ( QList<Nepomuk2::Resource>::const_iterator it = d->resources.constBegin(); it != end; ++it ) {
+ if ( *it == res ) {
+ return index( i, 0 );
+ }
+ ++i;
+ }
+
+ return QModelIndex();
+}
+
+
+Nepomuk2::Resource Nepomuk2::Utils::SimpleResourceModel::resourceForIndex( const QModelIndex& index ) const
+{
+ if ( index.isValid() && index.row() < d->resources.count() ) {
+ return d->resources[index.row()];
+ }
+ else {
+ return Resource();
+ }
+}
+
+
+int Nepomuk2::Utils::SimpleResourceModel::rowCount( const QModelIndex& parent ) const
+{
+ if ( parent.isValid() ) {
+ return 0;
+ }
+ else {
+ return d->resources.count();
+ }
+}
+
+
+QModelIndex Nepomuk2::Utils::SimpleResourceModel::index( int row, int column, const QModelIndex& parent ) const
+{
+ if ( !parent.isValid() && row < d->resources.count() ) {
+ return createIndex( row, column, 0 );
+ }
+ else {
+ return QModelIndex();
+ }
+}
+
+
+bool Nepomuk2::Utils::SimpleResourceModel::removeRows(int row, int count, const QModelIndex& parent)
+{
+ if( count < 1 || row < 0 || (row + count) > d->resources.size() || parent.isValid() )
+ return false;
+
+ beginRemoveRows( parent, row, row + count -1 );
+
+ QList<Resource>::iterator begin, end;
+ begin = end = d->resources.begin();
+ begin += row;
+ end += row + count;
+ d->resources.erase( begin, end );
+
+ endRemoveRows();
+ return true;
+}
+
+
+void Nepomuk2::Utils::SimpleResourceModel::setResources( const QList<Nepomuk2::Resource>& resources )
+{
+ d->resources = resources;
+ reset();
+}
+
+
+void Nepomuk2::Utils::SimpleResourceModel::addResources( const QList<Nepomuk2::Resource>& resources )
+{
+ if(!resources.isEmpty()) {
+ beginInsertRows( QModelIndex(), d->resources.count(), d->resources.count() + resources.count() - 1 );
+ d->resources << resources;
+ endInsertRows();
+ }
+}
+
+
+void Nepomuk2::Utils::SimpleResourceModel::addResource( const Nepomuk2::Resource& resource )
+{
+ addResources( QList<Resource>() << resource );
+}
+
+
+void Nepomuk2::Utils::SimpleResourceModel::setResults( const QList<Nepomuk2::Query::Result>& results)
+{
+ clear();
+ addResults( results );
+}
+
+void Nepomuk2::Utils::SimpleResourceModel::addResults( const QList<Nepomuk2::Query::Result>& results )
+{
+ Q_FOREACH( const Query::Result& result, results ) {
+ addResource( result.resource() );
+ }
+}
+
+void Nepomuk2::Utils::SimpleResourceModel::addResult( const Nepomuk2::Query::Result result )
+{
+ addResource( result.resource() );
+}
+
+
+void Nepomuk2::Utils::SimpleResourceModel::clear()
+{
+ d->resources.clear();
+ reset();
+}
+
+#include "simpleresourcemodel.moc"
diff --git a/src/nepomuk/utils/simpleresourcemodel.h b/src/nepomuk/utils/simpleresourcemodel.h
new file mode 100644
index 00000000..2f48d930
--- /dev/null
+++ b/src/nepomuk/utils/simpleresourcemodel.h
@@ -0,0 +1,144 @@
+/*
+ This file is part of the Nepomuk KDE project.
+ Copyright (C) 2008-2010 Sebastian Trueg <trueg@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _NEPOMUK_SIMPLE_RESOURCE_MODEL_H_
+#define _NEPOMUK_SIMPLE_RESOURCE_MODEL_H_
+
+#include "resourcemodel.h"
+
+#include "nepomukutils_export.h"
+
+#include <Nepomuk2/Resource>
+#include <Nepomuk2/Query/Result>
+
+#include <QtCore/QList>
+
+namespace Nepomuk2 {
+ namespace Utils {
+ /**
+ * \class SimpleResourceModel simpleresourcemodel.h Nepomuk/Utils/SimpleResourceModel
+ *
+ * A simple ResourceModel that handles a list of Resource instances which
+ * can be managed via the setResources(), addResource(), addResources(), and
+ * clear() methods.
+ *
+ * \author Sebastian Trueg <trueg@kde.org>
+ *
+ * \since 4.6
+ */
+ class NEPOMUKUTILS_EXPORT SimpleResourceModel : public ResourceModel
+ {
+ Q_OBJECT
+
+ public:
+ /**
+ * Creates an empty resource model.
+ */
+ SimpleResourceModel( QObject* parent = 0 );
+
+ /**
+ * Destructor
+ */
+ ~SimpleResourceModel();
+
+ /**
+ * Get the Resource which corresponds to \p index.
+ *
+ * \return The Resource which corresponds to \p index or an invalid Resource
+ * if \p index is invalid.
+ */
+ QModelIndex indexForResource( const Resource& res ) const;
+
+ /**
+ * Get the index for a resource.
+ *
+ * \return The index which corresponds to \p res of an invalid QModelIndex
+ * if \p res is not part of this model.
+ */
+ Resource resourceForIndex( const QModelIndex& index ) const;
+
+ /**
+ * \return The number of resources added to the model for an invalid parent index.
+ */
+ int rowCount( const QModelIndex& parent = QModelIndex() ) const;
+
+ /**
+ * Creates an index for the cell at \p row and \p column.
+ */
+ QModelIndex index( int row, int column, const QModelIndex& parent = QModelIndex() ) const;
+
+ /**
+ * Removes those resources from the model.
+ */
+ bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
+
+ public Q_SLOTS:
+ /**
+ * Set the resources to be provided by the model to \p resources.
+ */
+ void setResources( const QList<Nepomuk2::Resource>& resources );
+
+ /**
+ * Add \p resources to the list of resources being provided by the
+ * model.
+ */
+ void addResources( const QList<Nepomuk2::Resource>& resources );
+
+ /**
+ * Add \p resource to the list of resources being provided by the
+ * model.
+ */
+ void addResource( const Nepomuk2::Resource& resource );
+
+ /**
+ * This method is similar to setResources(). It is provided for
+ * allowing convenient connections from signals that provide
+ * Query::Result objects.
+ */
+ void setResults( const QList<Nepomuk2::Query::Result>& results );
+
+ /**
+ * This method is similar to addResources(). It is provided for
+ * allowing convenient connections from signals that provide
+ * Query::Result objects like Query::QueryServiceClient::newResults().
+ */
+ void addResults( const QList<Nepomuk2::Query::Result>& results );
+
+ /**
+ * This method is similar to addResource(). It is provided for
+ * allowing convenient connections from signals that provide
+ * Query::Result objects.
+ */
+ void addResult( const Nepomuk2::Query::Result result );
+
+ /**
+ * Clear the model by removing all resources added via setResources() and friends.
+ */
+ void clear();
+
+ private:
+ class Private;
+ Private* const d;
+ };
+ }
+}
+
+#endif
diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp
index e266a071..a0e5cd44 100644
--- a/src/urlbar/bookmarkwidget.cpp
+++ b/src/urlbar/bookmarkwidget.cpp
@@ -153,8 +153,8 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
m_tagLine->setPlaceholderText(i18n("add tags(comma separated)"));
- QList<Nepomuk::Tag> tagList = Nepomuk::Tag::allTags();
- Q_FOREACH(const Nepomuk::Tag &t, tagList)
+ QList<Nepomuk2::Tag> tagList = Nepomuk2::Tag::allTags();
+ Q_FOREACH(const Nepomuk2::Tag &t, tagList)
{
m_tList.append(t.label());
}
@@ -287,9 +287,9 @@ void BookmarkWidget::removeBookmark()
#ifdef HAVE_NEPOMUK
-void BookmarkWidget::addTags(QList<Nepomuk::Tag> tagList)
+void BookmarkWidget::addTags(QList<Nepomuk2::Tag> tagList)
{
- Q_FOREACH(const Nepomuk::Tag & tag, tagList)
+ Q_FOREACH(const Nepomuk2::Tag & tag, tagList)
{
if (!m_nfoResource.tags().contains(tag))
{
@@ -297,7 +297,7 @@ void BookmarkWidget::addTags(QList<Nepomuk::Tag> tagList)
}
}
- Q_FOREACH(Nepomuk::Tag tag, m_nfoResource.tags())
+ Q_FOREACH(Nepomuk2::Tag tag, m_nfoResource.tags())
{
if (!tagList.contains(tag))
{
@@ -308,7 +308,7 @@ void BookmarkWidget::addTags(QList<Nepomuk::Tag> tagList)
void BookmarkWidget::parseTags()
{
- QList<Nepomuk::Tag> tagList;
+ QList<Nepomuk2::Tag> tagList;
if (m_tagLine->text().contains(','))
{
QString text = m_tagLine->text();
@@ -334,7 +334,7 @@ void BookmarkWidget::loadTags()
QString list;
if (!m_nfoResource.tags().isEmpty())
{
- Q_FOREACH(const Nepomuk::Tag & tag, m_nfoResource.tags())
+ Q_FOREACH(const Nepomuk2::Tag & tag, m_nfoResource.tags())
{
list.append(tag.genericLabel());
list.append(",");
@@ -358,7 +358,7 @@ void BookmarkWidget::addCommentSlot()
void BookmarkWidget::linkToResourceSlot()
{
- QPointer<Nepomuk::ResourceLinkDialog> r = new Nepomuk::ResourceLinkDialog(m_nfoResource);
+ QPointer<Nepomuk2::ResourceLinkDialog> r = new Nepomuk2::ResourceLinkDialog(m_nfoResource);
r->exec();
r->deleteLater();
diff --git a/src/urlbar/bookmarkwidget.h b/src/urlbar/bookmarkwidget.h
index 39f6fbd4..e6021c90 100644
--- a/src/urlbar/bookmarkwidget.h
+++ b/src/urlbar/bookmarkwidget.h
@@ -34,14 +34,11 @@
#include <QGridLayout>
#include <QPlainTextEdit>
-// Nepomuk config include
-#include <config-nepomuk.h>
-
// Nepomuk Includes
#ifdef HAVE_NEPOMUK
-#include <Nepomuk/Resource>
-#include <Nepomuk/Tag>
-#include <Nepomuk/Vocabulary/NFO>
+#include <Nepomuk2/Resource>
+#include <Nepomuk2/Tag>
+#include <Nepomuk2/Vocabulary/NFO>
#endif
// Forward Declarations
@@ -61,7 +58,7 @@ public:
void showAt(const QPoint &pos);
#ifdef HAVE_NEPOMUK
- void addTags(QList<Nepomuk::Tag>);
+ void addTags(QList<Nepomuk2::Tag>);
void parseTags();
void loadTags();
#endif
@@ -91,7 +88,7 @@ private:
QStringList m_tList;
#ifdef HAVE_NEPOMUK
- Nepomuk::Resource m_nfoResource;
+ Nepomuk2::Resource m_nfoResource;
bool m_isNepomukEnabled;
#endif
};
diff --git a/src/urlbar/newresourcedialog.cpp b/src/urlbar/newresourcedialog.cpp
index 39cffc36..592d1b31 100644
--- a/src/urlbar/newresourcedialog.cpp
+++ b/src/urlbar/newresourcedialog.cpp
@@ -29,10 +29,10 @@
#include "newresourcedialog.moc"
// Nepomuk Includes
-#include <Nepomuk/Vocabulary/NCO>
-#include <Nepomuk/Vocabulary/PIMO>
-#include <Nepomuk/Resource>
-#include <Nepomuk/Tag>
+#include <Nepomuk2/Vocabulary/NCO>
+#include <Nepomuk2/Vocabulary/PIMO>
+#include <Nepomuk2/Resource>
+#include <Nepomuk2/Tag>
// Qt Includes
#include <QPlainTextEdit>
@@ -40,20 +40,20 @@
#include <QLabel>
-class Nepomuk::NewResourceDialog::Private
+class Nepomuk2::NewResourceDialog::Private
{
public:
KLineEdit *m_resourceName;
QPlainTextEdit *m_description;
QLabel *m_titleResource;
QLabel *m_desResource;
- Nepomuk::NewResourceDialog *q;
- Nepomuk::Resource m_nofResource;
+ Nepomuk2::NewResourceDialog *q;
+ Nepomuk2::Resource m_nofResource;
int m_index;
};
-Nepomuk::NewResourceDialog::NewResourceDialog(int index, Nepomuk::Resource& nfoResource, QWidget* parent):
+Nepomuk2::NewResourceDialog::NewResourceDialog(int index, Nepomuk2::Resource& nfoResource, QWidget* parent):
KDialog(parent),
d(new Private())
{
@@ -80,41 +80,41 @@ Nepomuk::NewResourceDialog::NewResourceDialog(int index, Nepomuk::Resource& nfoR
}
-Nepomuk::NewResourceDialog::~NewResourceDialog()
+Nepomuk2::NewResourceDialog::~NewResourceDialog()
{
delete d;
}
-void Nepomuk::NewResourceDialog::newResourceSlot()
+void Nepomuk2::NewResourceDialog::newResourceSlot()
{
if (d->m_index == 1)
{
- Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Person());
+ Nepomuk2::Resource newResource(d->m_resourceName->text(), Nepomuk2::Vocabulary::PIMO::Person());
newResource.addSymbol("user-identity");
d->m_nofResource.addIsRelated(newResource);
}
else if (d->m_index == 2)
{
- Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Project());
+ Nepomuk2::Resource newResource(d->m_resourceName->text(), Nepomuk2::Vocabulary::PIMO::Project());
newResource.addSymbol("project-development");
d->m_nofResource.addIsRelated(newResource);
}
else if (d->m_index == 3)
{
- Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Task());
+ Nepomuk2::Resource newResource(d->m_resourceName->text(), Nepomuk2::Vocabulary::PIMO::Task());
newResource.addSymbol("view-pim-tasks");
d->m_nofResource.addIsRelated(newResource);
}
else if (d->m_index == 4)
{
- Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Location());
+ Nepomuk2::Resource newResource(d->m_resourceName->text(), Nepomuk2::Vocabulary::PIMO::Location());
newResource.addSymbol("user-location");
d->m_nofResource.addIsRelated(newResource);
}
else if (d->m_index == 5)
{
- Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Note());
+ Nepomuk2::Resource newResource(d->m_resourceName->text(), Nepomuk2::Vocabulary::PIMO::Note());
newResource.addSymbol("knotes");
d->m_nofResource.addIsRelated(newResource);
}
diff --git a/src/urlbar/newresourcedialog.h b/src/urlbar/newresourcedialog.h
index 651c631c..7aacb358 100644
--- a/src/urlbar/newresourcedialog.h
+++ b/src/urlbar/newresourcedialog.h
@@ -32,17 +32,17 @@
#include <KDialog>
#include <KLineEdit>
-#include <Nepomuk/Resource>
+#include <Nepomuk2/Resource>
-namespace Nepomuk
+namespace Nepomuk2
{
class NewResourceDialog : public KDialog
{
Q_OBJECT
public:
- explicit NewResourceDialog(int index, Nepomuk::Resource& nfoResource, QWidget* parent = 0);
+ explicit NewResourceDialog(int index, Nepomuk2::Resource& nfoResource, QWidget* parent = 0);
virtual ~NewResourceDialog();
private Q_SLOTS:
diff --git a/src/urlbar/resourcelinkdialog.cpp b/src/urlbar/resourcelinkdialog.cpp
index 799171f2..dbff77b8 100644
--- a/src/urlbar/resourcelinkdialog.cpp
+++ b/src/urlbar/resourcelinkdialog.cpp
@@ -54,18 +54,22 @@
#include <KIcon>
// Nepomuk Includes
-#include <Nepomuk/Utils/SimpleResourceModel>
-#include <Nepomuk/Query/Term>
-#include <Nepomuk/Query/Result>
-#include <Nepomuk/Query/ResourceTypeTerm>
-#include <Nepomuk/Query/QueryServiceClient>
-#include <Nepomuk/Vocabulary/PIMO>
-#include <Nepomuk/Vocabulary/NCO>
-#include <Nepomuk/Query/QueryParser>
-#include <Nepomuk/Variant>
-
-
-class Nepomuk::ResourceLinkDialog::Private
+#include <Nepomuk2/Query/Term>
+#include <Nepomuk2/Query/Result>
+#include <Nepomuk2/Query/ResourceTypeTerm>
+#include <Nepomuk2/Query/QueryServiceClient>
+#include <Nepomuk2/Vocabulary/PIMO>
+#include <Nepomuk2/Vocabulary/NCO>
+#include <Nepomuk2/Query/QueryParser>
+#include <Nepomuk2/Variant>
+
+// Nepomuk Ported Classes
+#include "nepomuk/utils/simpleresourcemodel.h"
+
+// Soprano Includes
+#include <Soprano/Vocabulary/NAO>
+
+class Nepomuk2::ResourceLinkDialog::Private
{
public:
void _k_selectionChanged();
@@ -82,20 +86,20 @@ public:
QPushButton *m_newResourceButton;
Utils::SimpleResourceModel *m_resourceModel;
Utils::SimpleResourceModel *m_linkedResourceModel;
- Nepomuk::ResourceLinkDialog *q;
+ Nepomuk2::ResourceLinkDialog *q;
- Nepomuk::Resource m_nfoResource;
+ Nepomuk2::Resource m_nfoResource;
};
-void Nepomuk::ResourceLinkDialog::Private::_k_selectionChanged()
+void Nepomuk2::ResourceLinkDialog::Private::_k_selectionChanged()
{
q->enableButton(KDialog::User1, !m_resourceView->selectionModel()->selectedRows().isEmpty());
}
-Nepomuk::ResourceLinkDialog::ResourceLinkDialog(Nepomuk::Resource &nfoResource, QWidget* parent):
+Nepomuk2::ResourceLinkDialog::ResourceLinkDialog(Nepomuk2::Resource &nfoResource, QWidget* parent):
KDialog(parent),
d(new Private())
{
@@ -182,21 +186,21 @@ Nepomuk::ResourceLinkDialog::ResourceLinkDialog(Nepomuk::Resource &nfoResource,
}
-Nepomuk::ResourceLinkDialog::~ResourceLinkDialog()
+Nepomuk2::ResourceLinkDialog::~ResourceLinkDialog()
{
delete d;
}
-void Nepomuk::ResourceLinkDialog::setRelatedResources()
+void Nepomuk2::ResourceLinkDialog::setRelatedResources()
{
- QList<Nepomuk::Resource> relatedResourceList = d->m_nfoResource.isRelateds();
+ QList<Nepomuk2::Resource> relatedResourceList = d->m_nfoResource.isRelateds();
d->m_linkedResourceModel->setResources(relatedResourceList);
}
-void Nepomuk::ResourceLinkDialog::linkResourceSlot()
+void Nepomuk2::ResourceLinkDialog::linkResourceSlot()
{
QModelIndexList selectedResourceList;
selectedResourceList << d->m_resourceView->selectionModel()->selectedIndexes();
@@ -209,16 +213,16 @@ void Nepomuk::ResourceLinkDialog::linkResourceSlot()
}
-void Nepomuk::ResourceLinkDialog::unlinkResourceSlot()
+void Nepomuk2::ResourceLinkDialog::unlinkResourceSlot()
{
- d->m_nfoResource.removeProperty(Nepomuk::Resource::isRelatedUri(),
+ d->m_nfoResource.removeProperty(Soprano::Vocabulary::NAO::isRelated().toString(),
d->m_linkedResourceModel->resourceForIndex(
d->m_linkedResources->selectionModel()->currentIndex()));
setRelatedResources();
}
-void Nepomuk::ResourceLinkDialog::showContextMenu(const QPoint &pos)
+void Nepomuk2::ResourceLinkDialog::showContextMenu(const QPoint &pos)
{
d->m_removeResourceAction = new KAction(this);
d->m_removeResourceAction->setText(i18n("&Unlink "));
@@ -232,9 +236,9 @@ void Nepomuk::ResourceLinkDialog::showContextMenu(const QPoint &pos)
}
-void Nepomuk::ResourceLinkDialog::createNewResourceSlot()
+void Nepomuk2::ResourceLinkDialog::createNewResourceSlot()
{
- QPointer<Nepomuk::NewResourceDialog> r = new Nepomuk::NewResourceDialog(d->m_resourceSelect->currentIndex(), d->m_nfoResource);
+ QPointer<Nepomuk2::NewResourceDialog> r = new Nepomuk2::NewResourceDialog(d->m_resourceSelect->currentIndex(), d->m_nfoResource);
r->exec();
setRelatedResources();
@@ -243,60 +247,60 @@ void Nepomuk::ResourceLinkDialog::createNewResourceSlot()
}
-void Nepomuk::ResourceLinkDialog::dynamicSearchingSlot()
+void Nepomuk2::ResourceLinkDialog::dynamicSearchingSlot()
{
- Nepomuk::Query::Query query;
- Nepomuk::Query::QueryServiceClient *test;
+ Nepomuk2::Query::Query query;
+ Nepomuk2::Query::QueryServiceClient *test;
switch (d->m_resourceSelect->currentIndex())
{
case 1:
- query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
- query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person());
- test = new Nepomuk::Query::QueryServiceClient(this);
+ query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text());
+ query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Person());
+ test = new Nepomuk2::Query::QueryServiceClient(this);
test->query(query);
d->m_resourceModel->clear();
- connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
- d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
+ connect(test, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)),
+ d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>)));
break;
case 2:
- query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
- query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Project());
- test = new Nepomuk::Query::QueryServiceClient(this);
+ query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text());
+ query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Project());
+ test = new Nepomuk2::Query::QueryServiceClient(this);
test->query(query);
d->m_resourceModel->clear();
- connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
- d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
+ connect(test, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)),
+ d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>)));
break;
case 3:
- query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
- query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Task());
- test = new Nepomuk::Query::QueryServiceClient(this);
+ query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text());
+ query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Task());
+ test = new Nepomuk2::Query::QueryServiceClient(this);
test->query(query);
d->m_resourceModel->clear();
- connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
- d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
+ connect(test, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)),
+ d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>)));
break;
case 4:
- query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
- query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Location());
- test = new Nepomuk::Query::QueryServiceClient(this);
+ query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text());
+ query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Location());
+ test = new Nepomuk2::Query::QueryServiceClient(this);
test->query(query);
d->m_resourceModel->clear();
- connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
- d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
+ connect(test, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)),
+ d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>)));
break;
case 5:
- query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
- query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Note());
- test = new Nepomuk::Query::QueryServiceClient(this);
+ query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text());
+ query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Note());
+ test = new Nepomuk2::Query::QueryServiceClient(this);
test->query(query);
d->m_resourceModel->clear();
- connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
- d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
+ connect(test, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)),
+ d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>)));
break;
default:
@@ -305,7 +309,7 @@ void Nepomuk::ResourceLinkDialog::dynamicSearchingSlot()
}
-void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index)
+void Nepomuk2::ResourceLinkDialog::resourceSelectedSlot(int index)
{
enableButton(User1, true);
d->m_newResourceButton->setEnabled(true);
@@ -317,12 +321,12 @@ void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index)
//List Personal Contacts
if (index == 1)
{
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person());
- Nepomuk::Query::Query query(term);
+ Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Person());
+ Nepomuk2::Query::Query query(term);
query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
- QList <Nepomuk::Resource> resource;
- Q_FOREACH(const Nepomuk::Query::Result & result, results)
+ QList<Nepomuk2::Query::Result>results = Nepomuk2::Query::QueryServiceClient::syncQuery(query);
+ QList <Nepomuk2::Resource> resource;
+ Q_FOREACH(const Nepomuk2::Query::Result & result, results)
{
resource.append(result.resource());
}
@@ -331,12 +335,12 @@ void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index)
//List Projects
else if (index == 2)
{
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Project());
- Nepomuk::Query::Query query(term);
+ Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Project());
+ Nepomuk2::Query::Query query(term);
query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
- QList <Nepomuk::Resource> resource;
- Q_FOREACH(const Nepomuk::Query::Result & result, results)
+ QList<Nepomuk2::Query::Result>results = Nepomuk2::Query::QueryServiceClient::syncQuery(query);
+ QList <Nepomuk2::Resource> resource;
+ Q_FOREACH(const Nepomuk2::Query::Result & result, results)
{
resource.append(result.resource());
}
@@ -345,12 +349,12 @@ void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index)
//List Tasks
else if (index == 3)
{
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Task());
- Nepomuk::Query::Query query(term);
+ Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Task());
+ Nepomuk2::Query::Query query(term);
query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
- QList <Nepomuk::Resource> resource;
- Q_FOREACH(const Nepomuk::Query::Result & result, results)
+ QList<Nepomuk2::Query::Result>results = Nepomuk2::Query::QueryServiceClient::syncQuery(query);
+ QList <Nepomuk2::Resource> resource;
+ Q_FOREACH(const Nepomuk2::Query::Result & result, results)
{
resource.append(result.resource());
}
@@ -359,12 +363,12 @@ void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index)
//List Places
else if (index == 4)
{
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Location());
- Nepomuk::Query::Query query(term);
+ Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Location());
+ Nepomuk2::Query::Query query(term);
query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
- QList <Nepomuk::Resource> resource;
- Q_FOREACH(const Nepomuk::Query::Result & result, results)
+ QList<Nepomuk2::Query::Result>results = Nepomuk2::Query::QueryServiceClient::syncQuery(query);
+ QList <Nepomuk2::Resource> resource;
+ Q_FOREACH(const Nepomuk2::Query::Result & result, results)
{
resource.append(result.resource());
}
@@ -373,12 +377,12 @@ void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index)
//List Notes
else if (index == 5)
{
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Note());
- Nepomuk::Query::Query query(term);
+ Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Note());
+ Nepomuk2::Query::Query query(term);
query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
- QList <Nepomuk::Resource> resource;
- Q_FOREACH(const Nepomuk::Query::Result & result, results)
+ QList<Nepomuk2::Query::Result>results = Nepomuk2::Query::QueryServiceClient::syncQuery(query);
+ QList <Nepomuk2::Resource> resource;
+ Q_FOREACH(const Nepomuk2::Query::Result & result, results)
{
resource.append(result.resource());
}
diff --git a/src/urlbar/resourcelinkdialog.h b/src/urlbar/resourcelinkdialog.h
index e628aa10..689ef4fe 100644
--- a/src/urlbar/resourcelinkdialog.h
+++ b/src/urlbar/resourcelinkdialog.h
@@ -36,7 +36,7 @@
#include <KConfigDialog>
-namespace Nepomuk
+namespace Nepomuk2
{
class Resource;
@@ -50,7 +50,7 @@ class ResourceLinkDialog : public KDialog
Q_OBJECT
public:
- explicit ResourceLinkDialog(Nepomuk::Resource& nfoResource, QWidget* parent = 0);
+ explicit ResourceLinkDialog(Nepomuk2::Resource& nfoResource, QWidget* parent = 0);
virtual ~ResourceLinkDialog();
void setRelatedResources();