1/*
2 Copyright (c) 2010 Volker Krause <vkrause@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef AKONADI_AGENTSERVER_H
21#define AKONADI_AGENTSERVER_H
22
23#include "agentpluginloader.h"
24
25#include <QtCore/QHash>
26#include <QtCore/QObject>
27#include <QtCore/QQueue>
28
29namespace Akonadi {
30
31class AgentThread;
32
33class AgentServer : public QObject
34{
35 Q_OBJECT
36 Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Akonadi.AgentServer")
37
38 typedef QPair<QString, qlonglong> ConfigureInfo;
39
40public:
41 explicit AgentServer(QObject *parent = 0);
42 ~AgentServer();
43
44public Q_SLOTS:
45 Q_SCRIPTABLE void agentInstanceConfigure(const QString &identifier, qlonglong windowId);
46 Q_SCRIPTABLE bool started(const QString &identifier) const;
47 Q_SCRIPTABLE void startAgent(const QString &identifier, const QString &typeIdentifier, const QString &fileName);
48 Q_SCRIPTABLE void stopAgent(const QString &identifier);
49 Q_SCRIPTABLE void quit();
50
51private Q_SLOTS:
52 void processConfigureRequest();
53
54private:
55 QHash<QString, AgentThread *> m_agents;
56 QQueue<ConfigureInfo> m_configureQueue;
57 AgentPluginLoader m_agentLoader;
58 bool m_processingConfigureRequests;
59 bool m_quiting;
60};
61
62}
63
64#endif
65