Akonadi Contacts

contactgroupviewer.h
1/*
2 This file is part of Akonadi Contact.
3
4 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#pragma once
10
11#include "akonadi-contact-widgets_export.h"
12
13#include <Akonadi/ItemMonitor>
14
15#include <QWidget>
16
17#include <memory>
18
19namespace Akonadi
20{
21class AbstractContactGroupFormatter;
22class ContactGroupViewerPrivate;
23
24/**
25 * @short A viewer component for contact groups in Akonadi.
26 *
27 * This widgets provides a way to show a contact group from the
28 * Akonadi storage.
29 *
30 * Example:
31 *
32 * @code
33 *
34 * using namespace Akonadi;
35 *
36 * const Item group = ...
37 *
38 * ContactGroupViewer *viewer = new ContactGroupViewer( this );
39 * viewer->setContactGroup( group );
40 *
41 * @endcode
42 *
43 * @author Tobias Koenig <tokoe@kde.org>
44 * @since 4.4
45 */
46class AKONADI_CONTACT_WIDGETS_EXPORT ContactGroupViewer : public QWidget, public Akonadi::ItemMonitor
47{
48 Q_OBJECT
49
50public:
51 /**
52 * Creates a new contact group viewer.
53 *
54 * @param parent The parent widget.
55 */
56 explicit ContactGroupViewer(QWidget *parent = nullptr);
57
58 /**
59 * Destroys the contact group viewer.
60 */
62
63 /**
64 * Returns the contact group that is currently displayed.
65 */
66 [[nodiscard]] Akonadi::Item contactGroup() const;
67
68 /**
69 * Sets the contact group @p formatter that should be used for formatting the
70 * contact group. If formatter is @c 0, the standard formatter will be used.
71 * @param formatter the formatter to use
72 * @note The contact viewer won't take ownership of the formatter.
73 * @since 4.6
74 */
75 void setContactGroupFormatter(Akonadi::AbstractContactGroupFormatter *formatter);
76
77 /**
78 * @since 5.20.41
79 */
80 void updateView();
81
82public Q_SLOTS:
83 /**
84 * Sets the contact @p group that shall be displayed in the viewer.
85 */
86 void setContactGroup(const Akonadi::Item &group);
87
88Q_SIGNALS:
89 /**
90 * This signal is emitted whenever the user has clicked on
91 * a URL in the viewer (e.g. a mailto: link).
92 *
93 * @param url The url that has been clicked.
94 */
95 void urlClicked(const QUrl &url);
96
97private:
98 /**
99 * This method is called whenever the displayed contact @p group has been changed.
100 */
101 AKONADI_CONTACT_WIDGETS_NO_EXPORT void itemChanged(const Akonadi::Item &group) override;
102
103 /**
104 * This method is called whenever the displayed contact group has been
105 * removed from Akonadi.
106 */
107 AKONADI_CONTACT_WIDGETS_NO_EXPORT void itemRemoved() override;
108
109private:
110 //@cond PRIVATE
111 std::unique_ptr<ContactGroupViewerPrivate> const d;
112 //@endcond
113};
114}
The interface for all contact group formatters.
A viewer component for contact groups in Akonadi.
void urlClicked(const QUrl &url)
This signal is emitted whenever the user has clicked on a URL in the viewer (e.g.
~ContactGroupViewer() override
Destroys the contact group viewer.
A widget for editing the display name of a contact.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:00:16 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.