Akonadi Contacts

contactgroupeditordialog.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 <QDialog>
14 
15 namespace Akonadi
16 {
17 class Item;
18 class Collection;
19 class ContactGroupEditor;
20 
21 /**
22  * @short A dialog for creating or editing a contact group in Akonadi.
23  *
24  * This dialog provides a way to create a new contact group or edit
25  * an existing contact group in Akonadi.
26  *
27  * Example for creating a new contact group:
28  *
29  * @code
30  *
31  * using namespace Akonadi;
32  *
33  * ContactGroupEditorDialog *dlg = new ContactGroupEditorDialog( ContactGroupEditorDialog::CreateMode, this );
34  * connect( dlg, SIGNAL(contactGroupStored(Akonadi::Item)),
35  * this, SLOT(contactGroupStored(Akonadi::Item)) );
36  * dlg->show();
37  *
38  * @endcode
39  *
40  * Example for editing an existing contact group:
41  *
42  * @code
43  *
44  * using namespace Akonadi;
45  *
46  * const Item contactGroup = ...;
47  *
48  * ContactGroupEditorDialog *dlg = new ContactGroupEditorDialog( ContactGroupEditorDialog::EditMode, this );
49  * connect( dlg, SIGNAL(contactGroupStored(Akonadi::Item)),
50  * this, SLOT(contactGroupStored(Akonadi::Item)) );
51  * dlg->setContactGroup( contactGroup );
52  * dlg->show();
53  *
54  * @endcode
55  *
56  * @author Tobias Koenig <[email protected]>
57  * @since 4.4
58  */
59 class AKONADI_CONTACT_EXPORT ContactGroupEditorDialog : public QDialog
60 {
61  Q_OBJECT
62 
63 public:
64  /**
65  * Describes the mode of the contact group editor.
66  */
67  enum Mode {
68  CreateMode, ///< Creates a new contact group
69  EditMode ///< Edits an existing contact group
70  };
71 
72  /**
73  * Creates a new contact group editor dialog.
74  *
75  * @param mode The mode of the dialog.
76  * @param parent The parent widget of the dialog.
77  */
78  explicit ContactGroupEditorDialog(Mode mode, QWidget *parent = nullptr);
79 
80  /**
81  * Destroys the contact group editor dialog.
82  */
83  ~ContactGroupEditorDialog() override;
84 
85  /**
86  * Sets the contact @p group to edit when in EditMode.
87  */
88  void setContactGroup(const Akonadi::Item &group);
89 
90  /**
91  * Sets the @p addressbook that shall be selected as default
92  * for storage in create mode.
93  */
94  void setDefaultAddressBook(const Akonadi::Collection &addressbook);
95 
96  /**
97  * Returns the ContactGroupEditor that is used by the dialog.
98  */
99  Q_REQUIRED_RESULT ContactGroupEditor *editor() const;
100 
101  void reject() override;
102 Q_SIGNALS:
103  /**
104  * This signal is emitted whenever a contact group was updated or stored.
105  *
106  * @param group The contact group.
107  */
108  void contactGroupStored(const Akonadi::Item &group);
109 
110 private:
111  void slotAccepted();
112 
113  //@cond PRIVATE
114  class Private;
115  Private *const d;
116  //@endcond
117 };
118 }
119 
A dialog for creating or editing a contact group in Akonadi.
An widget to edit contact groups in Akonadi.
Mode
Describes the mode of the contact group editor.
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.