Akonadi

agenttypedialog.h
1/*
2 SPDX-FileCopyrightText: 2006 Tobias Koenig <tokoe@kde.org>
3 SPDX-FileCopyrightText: 2008 Omat Holding B.V. <info@omat.nl>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#pragma once
9
10#include "agenttypewidget.h"
11// AkonadiCore
12#include "akonadi/agenttype.h"
13
14#include <QDialog>
15
16#include <memory>
17
18namespace Akonadi
19{
20class AgentTypeDialogPrivate;
21
22/**
23 * @short A dialog to select an available agent type.
24 *
25 * This dialogs allows the user to select an agent type from the
26 * list of all available agent types. The list can be filtered
27 * by the proxy model returned by agentFilterProxyModel().
28 *
29 * @code
30 *
31 * Akonadi::AgentTypeDialog dlg( this );
32 *
33 * // only list agent types that provide contacts
34 * dlg.agentFilterProxyModel()->addMimeTypeFilter( "text/directory" );
35 *
36 * if ( dlg.exec() ) {
37 * const AgentType agentType = dlg.agentType();
38 * ...
39 * }
40 *
41 * @endcode
42 *
43 * @author Tom Albers <tomalbers@kde.nl>
44 * @since 4.2
45 */
46class AKONADIWIDGETS_EXPORT AgentTypeDialog : public QDialog
47{
49
50public:
51 /**
52 * Creates a new agent type dialog.
53 *
54 * @param parent The parent widget of the dialog.
55 */
56 explicit AgentTypeDialog(QWidget *parent = nullptr);
57
58 /**
59 * Destroys the agent type dialog.
60 */
61 ~AgentTypeDialog() override;
62
63 /**
64 * Returns the agent type that was selected by the user,
65 * or an empty agent type object if no agent type has been selected.
66 */
67 [[nodiscard]] AgentType agentType() const;
68
69 /**
70 * Returns the agent filter proxy model that can be used
71 * to filter the agent types that shall be shown in the
72 * dialog.
73 */
74 [[nodiscard]] AgentFilterProxyModel *agentFilterProxyModel() const;
75
76public Q_SLOTS:
77 void done(int result) override;
78
79private:
80 /// @cond PRIVATE
81 std::unique_ptr<AgentTypeDialogPrivate> const d;
82 /// @endcond
83};
84
85}
A proxy model for filtering AgentType or AgentInstance.
AgentFilterProxyModel * agentFilterProxyModel() const
Returns the agent filter proxy model that can be used to filter the agent types that shall be shown i...
AgentType agentType() const
Returns the agent type that was selected by the user, or an empty agent type object if no agent type ...
AgentTypeDialog(QWidget *parent=nullptr)
Creates a new agent type dialog.
A representation of an agent type.
Helper integration between Akonadi and Qt.
QDialog(QWidget *parent, Qt::WindowFlags f)
int result() const const
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
QWidget(QWidget *parent, Qt::WindowFlags f)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:49:58 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.