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_AGENTTHREAD_H |
21 | #define AKONADI_AGENTTHREAD_H |
22 | |
23 | #include <QtCore/QThread> |
24 | |
25 | namespace Akonadi { |
26 | |
27 | /** |
28 | * @short A class that encapsulates an agent instance inside a thread. |
29 | */ |
30 | class AgentThread : public QThread |
31 | { |
32 | Q_OBJECT |
33 | |
34 | public: |
35 | /** |
36 | * Creates a new agent thread. |
37 | * |
38 | * @param identifier The unique identifier for this agent |
39 | * @param factory The factory object that creates the agent instance. |
40 | * @param parent The parent object. |
41 | */ |
42 | AgentThread(const QString &identifier, QObject *factory, QObject *parent = 0); |
43 | |
44 | /** |
45 | * Configures the agent. |
46 | * |
47 | * @param windowId The parent window id for the config dialog. |
48 | */ |
49 | void configure(qlonglong windowId); |
50 | |
51 | protected: |
52 | void run(); |
53 | |
54 | private: |
55 | QString m_identifier; |
56 | QObject *m_factory; |
57 | QObject *m_instance; |
58 | }; |
59 | |
60 | } |
61 | |
62 | #endif |
63 | |