~ubuntu-branches/ubuntu/natty/kdebase-runtime/natty-proposed

« back to all changes in this revision

Viewing changes to nepomuk/services/queryservice/queryservice.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-11-24 11:07:10 UTC
  • mto: (0.8.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 129.
  • Revision ID: james.westby@ubuntu.com-20101124110710-6dbsyw0yh21qvn82
Tags: upstream-4.5.80
ImportĀ upstreamĀ versionĀ 4.5.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
   Copyright (c) 2008-2009 Sebastian Trueg <trueg@kde.org>
 
2
   Copyright (c) 2008-2010 Sebastian Trueg <trueg@kde.org>
3
3
 
4
4
   This library is free software; you can redistribute it and/or
5
5
   modify it under the terms of the GNU Library General Public
20
20
#define _NEPOMUK_QUERY_SERVICE_H_
21
21
 
22
22
#include <Nepomuk/Service>
 
23
#include <Nepomuk/Query/Query>
23
24
 
24
25
#include "dbusoperators_p.h"
25
26
 
31
32
class QDBusObjectPath;
32
33
class QDBusMessage;
33
34
class QDBusServiceWatcher;
 
35
class QThreadPool;
34
36
 
35
37
namespace Nepomuk {
36
38
    namespace Query {
47
49
            QueryService( QObject* parent, const QVariantList& );
48
50
            ~QueryService();
49
51
 
50
 
            static QueryService* instance();
 
52
            static QThreadPool* searchThreadPool();
51
53
 
52
54
        public Q_SLOTS:
53
55
            /**
54
 
             * Create a query folder from desktop query string \p query. The optional properties in \p requestProps will be
55
 
             * added to the Query object once \p query has been parsed by QueryParser.
 
56
             * Create a query folder from encoded query \p query.
56
57
             */
57
58
            Q_SCRIPTABLE QDBusObjectPath query( const QString& query, const QDBusMessage& msg );
58
59
 
59
60
            /**
 
61
             * Create a query folder from desktop query string \p query which needs to be parsable by QueryParser.
 
62
             */
 
63
            Q_SCRIPTABLE QDBusObjectPath desktopQuery( const QString& query, const QDBusMessage& msg );
 
64
 
 
65
            /**
60
66
             * Create a query folder from SPARQL query string \p query. The optional properties in \p requestProps are assumed
61
67
             * to be part of \p query already as done by Query::toSparqlQuery. They are simple needed to map bindings to properties.
62
68
             */
63
69
            Q_SCRIPTABLE QDBusObjectPath sparqlQuery( const QString& query, const RequestPropertyMapDBus& requestProps, const QDBusMessage& msg );
64
70
 
65
71
        private Q_SLOTS:
66
 
            void slotServiceUnregistered( const QString& serviceName );
67
 
            void slotFolderDestroyed( QObject* folder );
68
 
            void slotFolderConnectionDestroyed( QObject* conn );
 
72
            void slotFolderAboutToBeDeleted( Nepomuk::Query::Folder* folder );
69
73
 
70
74
        private:
71
75
            /**
72
76
             * Creates a new folder or reuses an existing one.
73
77
             */
 
78
            Folder* getFolder( const Query& query );
 
79
 
 
80
            /**
 
81
             * Creates a new folder or reuses an existing one.
 
82
             */
74
83
            Folder* getFolder( const QString& sparql, const RequestPropertyMap& requestProps );
75
84
 
76
 
            static QueryService* s_instance;
77
 
 
78
 
            QHash<QString, Folder*> m_openFolders;
79
 
            QHash<Folder*, QString> m_folderQueryHash;
80
 
            QMultiHash<QString, FolderConnection*> m_openConnections;      // maps from DBus service to connection
81
 
            QHash<FolderConnection*, QString> m_connectionDBusServiceHash; // maps connections to their using dbus service
 
85
            QHash<QString, Folder*> m_openSparqlFolders;
 
86
            QHash<Query, Folder*> m_openQueryFolders;
82
87
 
83
88
            int m_folderConnectionCnt; // only used for unique dbus object path generation
84
 
            QDBusServiceWatcher *m_serviceWatcher;
85
89
        };
86
90
    }
87
91
}