Akonadi Contacts

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

KDE's Doxygen guidelines are available online.