1 | /* |
2 | Copyright (c) 2009 Volker Krause <vkrause@kde.org> |
3 | Copyright (c) 2009 Igor Trindade Oliveira <igor_trindade@yahoo.com.br> |
4 | |
5 | This library is free software; you can redistribute it and/or modify it |
6 | under the terms of the GNU Library General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or (at your |
8 | option) any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, but WITHOUT |
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
13 | License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to the |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | 02110-1301, USA. |
19 | */ |
20 | |
21 | #ifndef RESOURCE_H |
22 | #define RESOURCE_H |
23 | |
24 | #include "wrappedobject.h" |
25 | #include <akonadi/agentinstance.h> |
26 | |
27 | #include <QHash> |
28 | #include <QPointer> |
29 | #include <QVariant> |
30 | |
31 | class Resource: public QObject, protected WrappedObject |
32 | { |
33 | Q_OBJECT |
34 | public: |
35 | explicit Resource( QObject *parent ); |
36 | ~Resource(); |
37 | |
38 | public slots: |
39 | QObject* newInstance(); |
40 | QObject* newInstance( const QString &type ); |
41 | |
42 | void setType( const QString &type ); |
43 | QString identifier() const; |
44 | |
45 | void setOption( const QString &key, const QVariant &value ); |
46 | void setPathOption( const QString &key, const QString &path ); |
47 | |
48 | bool createResource(); |
49 | void create(); |
50 | void destroy(); |
51 | void write(); |
52 | void recreate(); |
53 | |
54 | private: |
55 | QString mTypeIdentifier; |
56 | Akonadi::AgentInstance mInstance; |
57 | QHash<QString, QVariant> mSettings; |
58 | }; |
59 | |
60 | #endif |
61 | |