[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bakonadi/1=2E5=5D_server=3A_Unbreak_searching_with_N?=
From: Volker Krause <vkrause () kde ! org>
Date: 2011-02-28 22:39:39
Message-ID: 20110228223939.152E3A60C9 () git ! kde ! org
[Download RAW message or body]
Git commit be3b9db96000256b286fad422855d0c92095d6c5 by Volker Krause.
Committed on 28/02/2011 at 23:35.
Pushed by vkrause into branch '1.5'.
Unbreak searching with Nepomuk 4.6.
Apparently, the Nepomuk query service D-Bus API changed *again*, breaking
searching in Akonadi. Now we use the interface used in KDE 4.6, so older
versions probably don't work anymore.
M +1 -1 server/CMakeLists.txt
M +34 -18 server/src/nepomuk/dbusoperators.cpp
M +28 -13 server/src/nepomuk/dbusoperators.h
A +8 -0 server/src/nepomuk/nepomukquery_export.h [License: UNKNOWN] *
M +1 -4 server/src/nepomuk/org.kde.nepomuk.Query.xml
D +0 -30 server/src/nepomuk/querymetatype.h
The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.
http://commits.kde.org/akonadi/be3b9db96000256b286fad422855d0c92095d6c5
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
index da8e912..9044e29 100644
--- a/server/CMakeLists.txt
+++ b/server/CMakeLists.txt
@@ -139,7 +139,7 @@ if (Soprano_FOUND)
src/nepomuk/result.cpp
)
- set_source_files_properties(src/nepomuk/org.kde.nepomuk.QueryService.xml \
PROPERTIES INCLUDE "querymetatype.h") + \
set_source_files_properties(src/nepomuk/org.kde.nepomuk.QueryService.xml PROPERTIES \
INCLUDE "dbusoperators.h") \
set_source_files_properties(src/nepomuk/org.kde.nepomuk.Query.xml PROPERTIES INCLUDE \
"result.h")
qt4_add_dbus_interface(libakonadiprivate_SRCS \
src/nepomuk/org.kde.nepomuk.QueryService.xml queryserviceinterface)
diff --git a/server/src/nepomuk/dbusoperators.cpp \
b/server/src/nepomuk/dbusoperators.cpp index 7ad6a13..c125805 100644
--- a/server/src/nepomuk/dbusoperators.cpp
+++ b/server/src/nepomuk/dbusoperators.cpp
@@ -19,16 +19,12 @@
*/
#include "dbusoperators.h"
-#include "querymetatype.h"
-
-#include <soprano/version.h>
#include <QtDBus/QDBusMetaType>
-Q_DECLARE_METATYPE(Nepomuk::Query::Result)
-Q_DECLARE_METATYPE(Soprano::Node)
-Q_DECLARE_METATYPE(QList<int>)
-Q_DECLARE_METATYPE(QList<Nepomuk::Query::Result>)
+#include <Soprano/Node>
+#include <Soprano/BindingSet>
+
void Nepomuk::Query::registerDBusTypes()
{
@@ -38,10 +34,11 @@ void Nepomuk::Query::registerDBusTypes()
qDBusRegisterMetaType<RequestPropertyMapDBus>();
}
+
QDBusArgument& operator<<( QDBusArgument& arg, const Nepomuk::Query::Result& result \
) {
//
- // Signature: (sda{s(isss)}s)
+ // Signature: (sda{s(isss)}a{s(isss)}s)
//
arg.beginStructure();
@@ -49,19 +46,28 @@ QDBusArgument& operator<<( QDBusArgument& arg, const \
Nepomuk::Query::Result& res // resource URI and score
arg << QString::fromAscii( result.resourceUri().toEncoded() ) << result.score();
- arg.beginMap( QVariant::String, qMetaTypeId<Soprano::Node>() );
-
// request properties
+ arg.beginMap( QVariant::String, qMetaTypeId<Soprano::Node>() );
QHash<QUrl, Soprano::Node> rp = result.requestProperties();
for ( QHash<QUrl, Soprano::Node>::const_iterator it = rp.constBegin(); it != \
rp.constEnd(); ++it ) { arg.beginMapEntry();
arg << QString::fromAscii( it.key().toEncoded() ) << it.value();
arg.endMapEntry();
}
+ arg.endMap();
+ // additional bindings
+ arg.beginMap( QVariant::String, qMetaTypeId<Soprano::Node>() );
+ const Soprano::BindingSet additionalBindings; // = result.additionalBindings();
+ foreach( const QString& binding, additionalBindings.bindingNames() ) {
+ arg.beginMapEntry();
+ arg << binding << additionalBindings[binding];
+ arg.endMapEntry();
+ }
arg.endMap();
- arg << QString(); // excerpt
+ // full text search excerpt
+ arg << QString();//<< result.excerpt();
arg.endStructure();
@@ -72,7 +78,7 @@ QDBusArgument& operator<<( QDBusArgument& arg, const \
Nepomuk::Query::Result& res const QDBusArgument& operator>>( const QDBusArgument& \
arg, Nepomuk::Query::Result& result ) {
//
- // Signature: (sda{s(isss)})
+ // Signature: (sda{s(isss)}s)
//
arg.beginStructure();
@@ -89,16 +95,30 @@ const QDBusArgument& operator>>( const QDBusArgument& arg, \
Nepomuk::Query::Resul arg.beginMapEntry();
arg >> rs >> node;
arg.endMapEntry();
- if( !rs.startsWith(QLatin1String("|")) )
- result.addRequestProperty( QUrl::fromEncoded( rs.toAscii() ), node );
+ result.addRequestProperty( QUrl::fromEncoded( rs.toAscii() ), node );
+ }
+ arg.endMap();
+
+ Soprano::BindingSet additionalBindings;
+ arg.beginMap();
+ while ( !arg.atEnd() ) {
+ QString binding;
+ Soprano::Node node;
+ arg.beginMapEntry();
+ arg >> binding >> node;
+ arg.endMapEntry();
+ additionalBindings.insert( binding, node );
}
arg.endMap();
QString excerpt;
arg >> excerpt;
+// result.setExcerpt( excerpt );
arg.endStructure();
+// result.setAdditionalBindings( additionalBindings );
+
return arg;
}
@@ -129,14 +149,10 @@ const QDBusArgument& operator>>( const QDBusArgument& arg, \
Soprano::Node& node ) QString value, language, dataTypeUri;
arg >> type >> value >> language >> dataTypeUri;
if ( type == Soprano::Node::LiteralNode ) {
-#if SOPRANO_IS_VERSION( 2, 3, 0 )
if ( dataTypeUri.isEmpty() )
node = Soprano::Node( Soprano::LiteralValue::createPlainLiteral( value, \
language ) ); else
node = Soprano::Node( Soprano::LiteralValue::fromString( value, \
QUrl::fromEncoded( dataTypeUri.toAscii() ) ) );
-#else
- node = Soprano::Node( Soprano::LiteralValue::fromString( value, dataTypeUri \
), language );
-#endif
}
else if ( type == Soprano::Node::ResourceNode ) {
node = Soprano::Node( QUrl::fromEncoded( value.toAscii() ) );
diff --git a/server/src/nepomuk/dbusoperators.h b/server/src/nepomuk/dbusoperators.h
index b665c22..a3bec79 100644
--- a/server/src/nepomuk/dbusoperators.h
+++ b/server/src/nepomuk/dbusoperators.h
@@ -1,19 +1,21 @@
/*
- Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
+ Copyright (c) 2008-2009 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 version 2 as published by the Free Software Foundation.
+ 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
- Library General Public License for more details.
+ Lesser 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.
+ 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_SEARCH_DBUS_OPERATORS_H_
@@ -22,17 +24,30 @@
#include <QtDBus/QDBusArgument>
#include "result.h"
+#include "nepomukquery_export.h"
+
+Q_DECLARE_METATYPE(Nepomuk::Query::Result)
+Q_DECLARE_METATYPE(Soprano::Node)
+Q_DECLARE_METATYPE(QList<Nepomuk::Query::Result>)
+typedef QHash<QString, QString> RequestPropertyMapDBus;
+Q_DECLARE_METATYPE( RequestPropertyMapDBus )
namespace Nepomuk {
namespace Query {
- void registerDBusTypes();
+ /**
+ * Register the DBus types necessary for communication with the Nepomuk
+ * query service. This method is only made public for the query service
+ * itself which links to this library, too.
+ */
+ NEPOMUKQUERY_EXPORT void registerDBusTypes();
}
}
-QDBusArgument& operator<<( QDBusArgument& arg, const Soprano::Node& );
-const QDBusArgument& operator>>( const QDBusArgument& arg, Soprano::Node& );
+// We export the non-public operators so that we do not need duplicated code in \
kdebase +NEPOMUKQUERY_EXPORT QDBusArgument& operator<<( QDBusArgument& arg, const \
Soprano::Node& ); +NEPOMUKQUERY_EXPORT const QDBusArgument& operator>>( const \
QDBusArgument& arg, Soprano::Node& );
-QDBusArgument& operator<<( QDBusArgument& arg, const Nepomuk::Query::Result& );
-const QDBusArgument& operator>>( const QDBusArgument& arg, Nepomuk::Query::Result& \
); +NEPOMUKQUERY_EXPORT QDBusArgument& operator<<( QDBusArgument& arg, const \
Nepomuk::Query::Result& ); +NEPOMUKQUERY_EXPORT const QDBusArgument& operator>>( \
const QDBusArgument& arg, Nepomuk::Query::Result& );
#endif
diff --git a/server/src/nepomuk/nepomukquery_export.h \
b/server/src/nepomuk/nepomukquery_export.h new file mode 100644
index 0000000..79ec2cf
--- /dev/null
+++ b/server/src/nepomuk/nepomukquery_export.h
@@ -0,0 +1,8 @@
+#ifndef NEPOMUKQUERY_EXPORT_H
+#define NEPOMUKQUERY_EXPORT_H
+
+#ifndef NEPOMUKQUERY_EXPORT
+#define NEPOMUKQUERY_EXPORT
+#endif
+
+#endif
diff --git a/server/src/nepomuk/org.kde.nepomuk.Query.xml \
b/server/src/nepomuk/org.kde.nepomuk.Query.xml index 9f1834b..96e131a 100644
--- a/server/src/nepomuk/org.kde.nepomuk.Query.xml
+++ b/server/src/nepomuk/org.kde.nepomuk.Query.xml
@@ -12,7 +12,7 @@
<arg type="s" direction="out" />
</method>
<signal name="newEntries">
- <arg name="entries" type="a(sda{s(isss)})" />
+ <arg name="entries" type="a(sda{s(isss)}s)" />
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" \
value="QList<Nepomuk::Query::Result>" /> </signal>
<signal name="entriesRemoved">
@@ -21,9 +21,6 @@
<signal name="resultCount">
<arg name="count" type="i" />
</signal>
- <signal name="totalResultCount">
- <arg name="count" type="i" />
- </signal>
<signal name="finishedListing" />
</interface>
</node>
diff --git a/server/src/nepomuk/querymetatype.h b/server/src/nepomuk/querymetatype.h
deleted file mode 100644
index 3d48e51..0000000
--- a/server/src/nepomuk/querymetatype.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Copyright (C) 2008-2009 by Sebastian Trueg <trueg at kde.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/*
- * This file looks very weird but is the only way to get the Query metatype
- * into the service interface when generated via qdbusxml2cpp.
- */
-
-#ifndef _NEPOMUK_QUERY_META_TYPE_H_
-#define _NEPOMUK_QUERY_META_TYPE_H_
-
-typedef QHash<QString, QString> RequestPropertyMapDBus;
-Q_DECLARE_METATYPE( RequestPropertyMapDBus )
-
-#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic