2
* Copyright (C) 2013 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Author: Pete Woods <pete.woods@canonical.com>
19
#ifndef HUD_SERVICE_QUERYIMPL_H_
20
#define HUD_SERVICE_QUERYIMPL_H_
22
#include <common/ResultsModel.h>
23
#include <common/AppstackModel.h>
24
#include <service/ApplicationList.h>
25
#include <service/Query.h>
26
#include <service/Voice.h>
28
#include <QDBusContext>
29
#include <QDBusConnection>
30
#include <QDBusServiceWatcher>
31
#include <QDBusVariant>
32
#include <QScopedPointer>
33
#include <QSharedPointer>
42
class Q_DECL_EXPORT QueryImpl: public Query, protected QDBusContext {
45
QueryImpl(unsigned int id, const QString &query, const QString &sender,
46
HudService &service, ApplicationList::Ptr applicationList,
47
Voice::Ptr voice, const QDBusConnection &connection,
52
const QDBusObjectPath & path() const override;
54
const QList<Result> & results() const override;
56
QString appstackModel() const override;
58
QString currentQuery() const override;
60
QString resultsModel() const override;
62
Q_PROPERTY(QStringList ToolbarItems READ toolbarItems)
63
QStringList toolbarItems() const override;
68
void ExecuteCommand(const QDBusVariant &item, uint timestamp);
70
QString ExecuteParameterized(const QDBusVariant &item, uint timestamp,
71
QString &prefix, QString &baseAction, QDBusObjectPath &actionPath,
72
QDBusObjectPath &modelPath, int &modelSection);
74
void ExecuteToolbar(const QString &item, uint timestamp);
76
int UpdateApp(const QString &app);
78
int UpdateQuery(const QString &query);
80
int VoiceQuery(QString &query);
83
void serviceUnregistered(const QString &service);
88
void updateToken(Window::Ptr window);
90
void notifyPropertyChanged(const QString& interface,
91
const QString& propertyName);
93
QScopedPointer<QueryAdaptor> m_adaptor;
95
QDBusConnection m_connection;
97
QDBusObjectPath m_path;
99
HudService &m_service;
101
ApplicationList::Ptr m_applicationList;
107
QDBusServiceWatcher m_serviceWatcher;
109
QSharedPointer<hud::common::ResultsModel> m_resultsModel;
111
QSharedPointer<hud::common::AppstackModel> m_appstackModel;
113
QList<Result> m_results;
115
WindowToken::Ptr m_windowToken;
121
#endif /* HUD_SERVICE_QUERYIMPL_H_ */