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 AgentInstanceFilterProxyModel;
21class AgentInstanceWidgetPrivate;
22class AccountActivitiesAbstract;
23
24/**
25 * @short Provides a widget that lists all available agent instances.
26 *
27 * The widget is listening on the dbus for changes, so the
28 * widget is updated automatically as soon as new agent instances
29 * are added to or removed from the system.
30 *
31 * @code
32 *
33 * MyWidget::MyWidget( QWidget *parent )
34 * : QWidget( parent )
35 * {
36 * QVBoxLayout *layout = new QVBoxLayout( this );
37 *
38 * mAgentInstanceWidget = new Akonadi::AgentInstanceWidget( this );
39 * layout->addWidget( mAgentInstanceWidget );
40 *
41 * connect( mAgentInstanceWidget, SIGNAL(doubleClicked(Akonadi::AgentInstance)),
42 * this, SLOT(slotInstanceSelected(Akonadi::AgentInstance)) );
43 * }
44 *
45 * ...
46 *
47 * MyWidget::slotInstanceSelected( Akonadi::AgentInstance &instance )
48 * {
49 * qCDebug(AKONADIWIDGETS_LOG) << "Selected instance" << instance.name();
50 * }
51 *
52 * @endcode
53 *
54 * @author Tobias Koenig <tokoe@kde.org>
55 */
56class AKONADIWIDGETS_EXPORT AgentInstanceWidget : public QWidget
57{
58 Q_OBJECT
59
60public:
61 /**
62 * Creates a new agent instance widget.
63 *
64 * @param parent The parent widget.
65 */
66 explicit AgentInstanceWidget(QWidget *parent = nullptr);
67
68 /**
69 * Destroys the agent instance widget.
70 */
72
73 /**
74 * Returns the current agent instance or an invalid agent instance
75 * if no agent instance is selected.
76 */
77 [[nodiscard]] AgentInstance currentAgentInstance() const;
78
79 /**
80 * Returns the selected agent instances.
81 * @since 4.5
82 */
83 [[nodiscard]] QList<AgentInstance> selectedAgentInstances() const;
84
85 /**
86 * Returns the agent filter proxy model, use this to filter by
87 * agent mimetype or capabilities.
88 */
89 [[nodiscard]] Akonadi::AgentInstanceFilterProxyModel *agentInstanceFilterProxyModel() const;
90
91 /**
92 * Returns the view used in the widget.
93 * @since 4.5
94 */
95 [[nodiscard]] QAbstractItemView *view() const;
96
97 [[nodiscard]] bool enablePlasmaActivities() const;
98 void setEnablePlasmaActivities(bool newEnablePlasmaActivities);
99
100 [[nodiscard]] AccountActivitiesAbstract *accountActivitiesAbstract() const;
101 void setAccountActivitiesAbstract(AccountActivitiesAbstract *abstract);
102
103Q_SIGNALS:
104 /**
105 * This signal is emitted whenever the current agent instance changes.
106 *
107 * @param current The current agent instance.
108 * @param previous The previous agent instance.
109 */
110 void currentChanged(const Akonadi::AgentInstance &current, const Akonadi::AgentInstance &previous);
111
112 /**
113 * This signal is emitted whenever there is a double click on an agent instance.
114 *
115 * @param current The current agent instance.
116 */
118
119 /**
120 * This signal is emitted whenever there is a click on an agent instance.
121 *
122 * @param current The current agent instance.
123 * @since 4.9.1
124 */
125 void clicked(const Akonadi::AgentInstance &current);
126
127private:
128 /// @cond PRIVATE
129 std::unique_ptr<AgentInstanceWidgetPrivate> const d;
130 /// @endcond
131};
132
133}
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 Mon Nov 4 2024 16:31:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.