add more spacing
[personal-kdebase.git] / runtime / nepomuk / services / queryservice / queryservice.h
blobe2b84e3066f9da148ddfd2fce4d7ad48dbb9f08a
1 /*
2 Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #ifndef _NEPOMUK_VIRTUAL_FOLDER_SERVICE_H_
20 #define _NEPOMUK_VIRTUAL_FOLDER_SERVICE_H_
22 #include <Nepomuk/Service>
24 #include <QtCore/QUrl>
25 #include <QtCore/QVariant>
26 #include <QtCore/QMultiHash>
28 class QDBusObjectPath;
29 class QDBusMessage;
32 namespace Nepomuk {
33 namespace Search {
35 class Folder;
36 class FolderConnection;
37 class Query;
39 class QueryService : public Service
41 Q_OBJECT
42 Q_CLASSINFO( "D-Bus Interface", "org.kde.nepomuk.QueryService" )
44 public:
45 QueryService( QObject* parent, const QVariantList& );
46 ~QueryService();
48 Soprano::Model* mainModel();
50 static QueryService* instance();
52 public Q_SLOTS:
53 Q_SCRIPTABLE QDBusObjectPath query( const QString& query, const QStringList& props, const QDBusMessage& msg );
54 Q_SCRIPTABLE QDBusObjectPath query( const Nepomuk::Search::Query& query, const QDBusMessage& msg );
56 private Q_SLOTS:
57 void slotServiceOwnerChanged( const QString& serviceName,
58 const QString&,
59 const QString& newOwner );
60 void slotFolderDestroyed( QObject* folder );
61 void slotFolderConnectionDestroyed( QObject* conn );
63 private:
64 /**
65 * Creates a new folder or reuses an existing one.
67 Folder* getFolder( const Query& query );
69 static QueryService* s_instance;
71 QHash<Query, Folder*> m_openFolders;
72 QHash<Folder*, Query> m_folderQueryHash;
73 QMultiHash<QString, FolderConnection*> m_openConnections; // maps from DBus service to connection
74 QHash<FolderConnection*, QString> m_connectionDBusServiceHash; // maps connections to their using dbus service
76 int m_folderConnectionCnt; // only used for unique dbus object path generation
81 #endif