Akonadi

agenttypewidget.h
1/*
2 SPDX-FileCopyrightText: 2006-2008 Tobias Koenig <tokoe@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadiwidgets_export.h"
10
11#include <QWidget>
12
13#include <memory>
14
15namespace Akonadi
16{
17class AgentFilterProxyModel;
18class AgentType;
19class AgentTypeWidgetPrivate;
20
21/**
22 * @short Provides a widget that lists all available agent types.
23 *
24 * The widget is listening on the dbus for changes, so the
25 * widget is updated automatically as soon as new agent types
26 * are added to or removed from the system.
27 *
28 * @code
29 *
30 * Akonadi::AgentTypeWidget *widget = new Akonadi::AgentTypeWidget( this );
31 *
32 * // only list agent types that provide contacts
33 * widget->agentFilterProxyModel()->addMimeTypeFilter( "text/directory" );
34 *
35 * @endcode
36 *
37 * If you want a dialog, you can use the Akonadi::AgentTypeDialog.
38 *
39 * @author Tobias Koenig <tokoe@kde.org>
40 */
41class AKONADIWIDGETS_EXPORT AgentTypeWidget : public QWidget
42{
43 Q_OBJECT
44
45public:
46 /**
47 * Creates a new agent type widget.
48 *
49 * @param parent The parent widget.
50 */
51 explicit AgentTypeWidget(QWidget *parent = nullptr);
52
53 /**
54 * Destroys the agent type widget.
55 */
56 ~AgentTypeWidget() override;
57
58 /**
59 * Returns the current agent type or an invalid agent type
60 * if no agent type is selected.
61 */
62 [[nodiscard]] AgentType currentAgentType() const;
63
64 /**
65 * Returns the agent filter proxy model, use this to filter by
66 * agent mimetype or capabilities.
67 */
68 [[nodiscard]] AgentFilterProxyModel *agentFilterProxyModel() const;
69
70Q_SIGNALS:
71 /**
72 * This signal is emitted whenever the current agent type changes.
73 *
74 * @param current The current agent type.
75 * @param previous The previous agent type.
76 */
77 void currentChanged(const Akonadi::AgentType &current, const Akonadi::AgentType &previous);
78
79 /**
80 * This signal is emitted whenever the user activates an agent.
81 * @since 4.2
82 */
83 void activated();
84
85private:
86 /// @cond PRIVATE
87 std::unique_ptr<AgentTypeWidgetPrivate> const d;
88 /// @endcond
89};
90
91}
A proxy model for filtering AgentType or AgentInstance.
Provides a widget that lists all available agent types.
~AgentTypeWidget() override
Destroys the agent type widget.
void currentChanged(const Akonadi::AgentType &current, const Akonadi::AgentType &previous)
This signal is emitted whenever the current agent type changes.
void activated()
This signal is emitted whenever the user activates an agent.
A representation of an agent type.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.