Akonadi

agenttypewidget.h
1 /*
2  SPDX-FileCopyrightText: 2006-2008 Tobias Koenig <[email protected]>
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 
15 namespace Akonadi
16 {
17 class AgentFilterProxyModel;
18 class AgentType;
19 class 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 <[email protected]>
40  */
41 class AKONADIWIDGETS_EXPORT AgentTypeWidget : public QWidget
42 {
43  Q_OBJECT
44 
45 public:
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  Q_REQUIRED_RESULT AgentType currentAgentType() const;
63 
64  /**
65  * Returns the agent filter proxy model, use this to filter by
66  * agent mimetype or capabilities.
67  */
68  Q_REQUIRED_RESULT AgentFilterProxyModel *agentFilterProxyModel() const;
69 
70 Q_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 
85 private:
86  /// @cond PRIVATE
87  std::unique_ptr<AgentTypeWidgetPrivate> const d;
88  /// @endcond
89 };
90 
91 }
92 
A representation of an agent type.
Provides a widget that lists all available agent types.
A proxy model for filtering AgentType or AgentInstance.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Jun 27 2022 04:01:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.