1 | /* |
2 | Copyright (c) 2008 Tobias Koenig <tokoe@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_AGENTTYPE_H |
21 | #define AKONADI_AGENTTYPE_H |
22 | |
23 | #include "akonadi_export.h" |
24 | |
25 | #include <QtCore/QList> |
26 | #include <QtCore/QMetaType> |
27 | #include <QtCore/QSharedDataPointer> |
28 | |
29 | class QIcon; |
30 | class QString; |
31 | class QStringList; |
32 | class QVariant; |
33 | typedef QMap<QString, QVariant> QVariantMap; |
34 | |
35 | namespace Akonadi |
36 | { |
37 | |
38 | /** |
39 | * @short A representation of an agent type. |
40 | * |
41 | * The agent type is a representation of an available agent, that can |
42 | * be started as an agent instance. |
43 | * It provides all information about the type. |
44 | * |
45 | * All available agent types can be retrieved from the AgentManager. |
46 | * |
47 | * @code |
48 | * |
49 | * Akonadi::AgentType::List types = Akonadi::AgentManager::self()->types(); |
50 | * foreach ( const Akonadi::AgentType &type, types ) { |
51 | * qDebug() << "Name:" << type.name() << "(" << type.identifier() << ")"; |
52 | * } |
53 | * |
54 | * @endcode |
55 | * |
56 | * @author Tobias Koenig <tokoe@kde.org> |
57 | */ |
58 | class AKONADI_EXPORT AgentType |
59 | { |
60 | friend class AgentManager; |
61 | friend class AgentManagerPrivate; |
62 | |
63 | public: |
64 | /** |
65 | * Describes a list of agent types. |
66 | */ |
67 | typedef QList<AgentType> List; |
68 | |
69 | /** |
70 | * Creates a new agent type. |
71 | */ |
72 | AgentType(); |
73 | |
74 | /** |
75 | * Creates an agent type from an @p other agent type. |
76 | */ |
77 | AgentType(const AgentType &other); |
78 | |
79 | /** |
80 | * Destroys the agent type. |
81 | */ |
82 | ~AgentType(); |
83 | |
84 | /** |
85 | * Returns whether the agent type is valid. |
86 | */ |
87 | bool isValid() const; |
88 | |
89 | /** |
90 | * Returns the unique identifier of the agent type. |
91 | */ |
92 | QString identifier() const; |
93 | |
94 | /** |
95 | * Returns the i18n'ed name of the agent type. |
96 | */ |
97 | QString name() const; |
98 | |
99 | /** |
100 | * Returns the description of the agent type. |
101 | */ |
102 | QString description() const; |
103 | |
104 | /** |
105 | * Returns the name of the icon of the agent type. |
106 | */ |
107 | QString iconName() const; |
108 | |
109 | /** |
110 | * Returns the icon of the agent type. |
111 | */ |
112 | QIcon icon() const; |
113 | |
114 | /** |
115 | * Returns the list of supported mime types of the agent type. |
116 | */ |
117 | QStringList mimeTypes() const; |
118 | |
119 | /** |
120 | * Returns the list of supported capabilities of the agent type. |
121 | */ |
122 | QStringList capabilities() const; |
123 | |
124 | /** |
125 | * Returns a Map of custom properties of the agent type. |
126 | * @since 4.12 |
127 | */ |
128 | QVariantMap customProperties() const; |
129 | |
130 | /** |
131 | * @internal |
132 | * @param other other agent type |
133 | */ |
134 | AgentType &operator=(const AgentType &other); |
135 | |
136 | /** |
137 | * @internal |
138 | * @param other other agent type |
139 | */ |
140 | bool operator==(const AgentType &other) const; |
141 | |
142 | private: |
143 | //@cond PRIVATE |
144 | class Private; |
145 | QSharedDataPointer<Private> d; |
146 | //@endcond |
147 | }; |
148 | |
149 | } |
150 | |
151 | Q_DECLARE_TYPEINFO(Akonadi::AgentType, Q_MOVABLE_TYPE); |
152 | |
153 | Q_DECLARE_METATYPE(Akonadi::AgentType) |
154 | |
155 | #endif |
156 | |