Akonadi Contacts

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

KDE's Doxygen guidelines are available online.