File indexing completed on 2024-06-23 05:07:16
0001 /* 0002 SPDX-FileCopyrightText: 2006 Tobias Koenig <tokoe@kde.org> 0003 SPDX-FileCopyrightText: 2008 Omat Holding B.V. <info@omat.nl> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include "agenttypewidget.h" 0011 // AkonadiCore 0012 #include "akonadi/agenttype.h" 0013 0014 #include <QDialog> 0015 0016 #include <memory> 0017 0018 namespace Akonadi 0019 { 0020 class AgentTypeDialogPrivate; 0021 0022 /** 0023 * @short A dialog to select an available agent type. 0024 * 0025 * This dialogs allows the user to select an agent type from the 0026 * list of all available agent types. The list can be filtered 0027 * by the proxy model returned by agentFilterProxyModel(). 0028 * 0029 * @code 0030 * 0031 * Akonadi::AgentTypeDialog dlg( this ); 0032 * 0033 * // only list agent types that provide contacts 0034 * dlg.agentFilterProxyModel()->addMimeTypeFilter( "text/directory" ); 0035 * 0036 * if ( dlg.exec() ) { 0037 * const AgentType agentType = dlg.agentType(); 0038 * ... 0039 * } 0040 * 0041 * @endcode 0042 * 0043 * @author Tom Albers <tomalbers@kde.nl> 0044 * @since 4.2 0045 */ 0046 class AKONADIWIDGETS_EXPORT AgentTypeDialog : public QDialog 0047 { 0048 Q_OBJECT 0049 0050 public: 0051 /** 0052 * Creates a new agent type dialog. 0053 * 0054 * @param parent The parent widget of the dialog. 0055 */ 0056 explicit AgentTypeDialog(QWidget *parent = nullptr); 0057 0058 /** 0059 * Destroys the agent type dialog. 0060 */ 0061 ~AgentTypeDialog() override; 0062 0063 /** 0064 * Returns the agent type that was selected by the user, 0065 * or an empty agent type object if no agent type has been selected. 0066 */ 0067 [[nodiscard]] AgentType agentType() const; 0068 0069 /** 0070 * Returns the agent filter proxy model that can be used 0071 * to filter the agent types that shall be shown in the 0072 * dialog. 0073 */ 0074 [[nodiscard]] AgentFilterProxyModel *agentFilterProxyModel() const; 0075 0076 public Q_SLOTS: 0077 void done(int result) override; 0078 0079 private: 0080 /// @cond PRIVATE 0081 std::unique_ptr<AgentTypeDialogPrivate> const d; 0082 /// @endcond 0083 }; 0084 0085 }