Akonadi

agentinstancewidget.h
1/*
2 SPDX-FileCopyrightText: 2006-2008 Tobias Koenig <tokoe@kde.org>
3 SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#pragma once
9
10#include "akonadiwidgets_export.h"
11
12#include <QWidget>
13
14#include <memory>
15
17namespace Akonadi
18{
19class AgentInstance;
20class AgentFilterProxyModel;
21class AgentInstanceWidgetPrivate;
22
23/**
24 * @short Provides a widget that lists all available agent instances.
25 *
26 * The widget is listening on the dbus for changes, so the
27 * widget is updated automatically as soon as new agent instances
28 * are added to or removed from the system.
29 *
30 * @code
31 *
32 * MyWidget::MyWidget( QWidget *parent )
33 * : QWidget( parent )
34 * {
35 * QVBoxLayout *layout = new QVBoxLayout( this );
36 *
37 * mAgentInstanceWidget = new Akonadi::AgentInstanceWidget( this );
38 * layout->addWidget( mAgentInstanceWidget );
39 *
40 * connect( mAgentInstanceWidget, SIGNAL(doubleClicked(Akonadi::AgentInstance)),
41 * this, SLOT(slotInstanceSelected(Akonadi::AgentInstance)) );
42 * }
43 *
44 * ...
45 *
46 * MyWidget::slotInstanceSelected( Akonadi::AgentInstance &instance )
47 * {
48 * qCDebug(AKONADIWIDGETS_LOG) << "Selected instance" << instance.name();
49 * }
50 *
51 * @endcode
52 *
53 * @author Tobias Koenig <tokoe@kde.org>
54 */
55class AKONADIWIDGETS_EXPORT AgentInstanceWidget : public QWidget
56{
57 Q_OBJECT
58
59public:
60 /**
61 * Creates a new agent instance widget.
62 *
63 * @param parent The parent widget.
64 */
65 explicit AgentInstanceWidget(QWidget *parent = nullptr);
66
67 /**
68 * Destroys the agent instance widget.
69 */
71
72 /**
73 * Returns the current agent instance or an invalid agent instance
74 * if no agent instance is selected.
75 */
76 [[nodiscard]] AgentInstance currentAgentInstance() const;
77
78 /**
79 * Returns the selected agent instances.
80 * @since 4.5
81 */
82 [[nodiscard]] QList<AgentInstance> selectedAgentInstances() const;
83
84 /**
85 * Returns the agent filter proxy model, use this to filter by
86 * agent mimetype or capabilities.
87 */
88 [[nodiscard]] AgentFilterProxyModel *agentFilterProxyModel() const;
89
90 /**
91 * Returns the view used in the widget.
92 * @since 4.5
93 */
94 [[nodiscard]] QAbstractItemView *view() const;
95
96Q_SIGNALS:
97 /**
98 * This signal is emitted whenever the current agent instance changes.
99 *
100 * @param current The current agent instance.
101 * @param previous The previous agent instance.
102 */
103 void currentChanged(const Akonadi::AgentInstance &current, const Akonadi::AgentInstance &previous);
104
105 /**
106 * This signal is emitted whenever there is a double click on an agent instance.
107 *
108 * @param current The current agent instance.
109 */
111
112 /**
113 * This signal is emitted whenever there is a click on an agent instance.
114 *
115 * @param current The current agent instance.
116 * @since 4.9.1
117 */
118 void clicked(const Akonadi::AgentInstance &current);
119
120private:
121 /// @cond PRIVATE
122 std::unique_ptr<AgentInstanceWidgetPrivate> const d;
123 /// @endcond
124};
125
126}
Represents one agent instance and takes care of communication with it.
A proxy model for filtering AgentType or AgentInstance.
Provides a widget that lists all available agent instances.
void doubleClicked(const Akonadi::AgentInstance &current)
This signal is emitted whenever there is a double click on an agent instance.
void clicked(const Akonadi::AgentInstance &current)
This signal is emitted whenever there is a click on an agent instance.
~AgentInstanceWidget() override
Destroys the agent instance widget.
void currentChanged(const Akonadi::AgentInstance &current, const Akonadi::AgentInstance &previous)
This signal is emitted whenever the current agent instance changes.
A representation of an agent instance.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:51:45 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.