1 | /* |
2 | Copyright (c) 2006 Tobias Koenig <tokoe@kde.org> |
3 | Copyright (c) 2008 Omat Holding B.V. <info@omat.nl> |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with this library. If not, see <http://www.gnu.org/licenses/>. |
17 | */ |
18 | |
19 | #ifndef AKONADI_AGENTTYPEDIALOG_H |
20 | #define AKONADI_AGENTTYPEDIALOG_H |
21 | |
22 | #include "agenttypewidget.h" |
23 | #include "agenttype.h" |
24 | |
25 | #include <KDE/KDialog> |
26 | |
27 | namespace Akonadi { |
28 | |
29 | /** |
30 | * @short A dialog to select an available agent type. |
31 | * |
32 | * This dialogs allows the user to select an agent type from the |
33 | * list of all available agent types. The list can be filtered |
34 | * by the proxy model returned by agentFilterProxyModel(). |
35 | * |
36 | * @code |
37 | * |
38 | * Akonadi::AgentTypeDialog dlg( this ); |
39 | * |
40 | * // only list agent types that provide contacts |
41 | * dlg.agentFilterProxyModel()->addMimeTypeFilter( "text/directory" ); |
42 | * |
43 | * if ( dlg.exec() ) { |
44 | * const AgentType agentType = dlg.agentType(); |
45 | * ... |
46 | * } |
47 | * |
48 | * @endcode |
49 | * |
50 | * @author Tom Albers <tomalbers@kde.nl> |
51 | * @since 4.2 |
52 | */ |
53 | class AKONADI_EXPORT AgentTypeDialog : public KDialog |
54 | { |
55 | Q_OBJECT |
56 | |
57 | public: |
58 | /** |
59 | * Creates a new agent type dialog. |
60 | * |
61 | * @param parent The parent widget of the dialog. |
62 | */ |
63 | AgentTypeDialog(QWidget *parent = 0); |
64 | |
65 | /** |
66 | * Destroys the agent type dialog. |
67 | */ |
68 | ~AgentTypeDialog(); |
69 | |
70 | /** |
71 | * Returns the agent type that was selected by the user, |
72 | * or an empty agent type object if no agent type has been selected. |
73 | */ |
74 | AgentType agentType() const; |
75 | |
76 | /** |
77 | * Returns the agent filter proxy model that can be used |
78 | * to filter the agent types that shall be shown in the |
79 | * dialog. |
80 | */ |
81 | AgentFilterProxyModel *agentFilterProxyModel() const; |
82 | |
83 | public Q_SLOTS: |
84 | virtual void done(int result); |
85 | |
86 | private: |
87 | //@cond PRIVATE |
88 | class Private; |
89 | Private *const d; |
90 | //@endcond |
91 | }; |
92 | |
93 | } |
94 | |
95 | #endif |
96 | |