Akonadi Contacts

emailaddressselectiondialog.h
1 /*
2  This file is part of Akonadi Contact.
3 
4  SPDX-FileCopyrightText: 2010 KDAB
5  SPDX-FileContributor: Tobias Koenig <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #pragma once
11 
12 #include "akonadi-contact_export.h"
13 
14 #include "abstractemailaddressselectiondialog.h"
15 #include "emailaddressselectionwidget.h"
16 
17 #include <memory>
18 
19 namespace Akonadi
20 {
21 class EmailAddressSelectionDialogPrivate;
22 
23 /**
24  * @short A dialog to select email addresses from Akonadi.
25  *
26  * This dialog allows the user to select an name and email address from
27  * the Akonadi storage.
28  * The selected addresses are returned as EmailAddressSelectionWidget::Selection objects
29  * which encapsulate the name, email address and the Akonadi item that has been selected.
30  *
31  * Example:
32  *
33  * @code
34  *
35  * Akonadi::EmailAddressSelectionDialog dlg( this );
36  * if ( dlg.exec() ) {
37  * const Akonadi::EmailAddressSelectionWidget::Selection::List selections = dlg.selectedAddresses();
38  * foreach ( const Akonadi::EmailAddressSelectionWidget::Selection &selection, selections ) {
39  * qCDebug(AKONADICONTACT_LOG) << "Name:" << selection.name() << "Email:" << selection.email();
40  * }
41  * }
42  *
43  * @endcode
44  *
45  * @author Tobias Koenig <[email protected]>
46  * @since 4.5
47  */
48 class AKONADI_CONTACT_EXPORT EmailAddressSelectionDialog : public AbstractEmailAddressSelectionDialog
49 {
50  Q_OBJECT
51 
52 public:
53  /**
54  * Creates a new email address selection dialog.
55  *
56  * @param parent The parent widget.
57  */
58  explicit EmailAddressSelectionDialog(QWidget *parent = nullptr);
59 
60  /**
61  * Creates a new email address selection dialog.
62  *
63  * @param model A custom, ContactsTreeModel based model to use.
64  * @param parent The parent widget.
65  */
66  explicit EmailAddressSelectionDialog(QAbstractItemModel *model, QWidget *parent = nullptr);
67 
68  /**
69  * Destroys the email address selection dialog.
70  */
71  ~EmailAddressSelectionDialog() override;
72 
73  /**
74  * Returns the list of selected email addresses.
75  */
76  Q_REQUIRED_RESULT EmailAddressSelection::List selectedAddresses() const override;
77 
78  /**
79  * Returns the email address selection view that is used.
80  */
81  Q_REQUIRED_RESULT EmailAddressSelectionWidget *view() const override;
82 
83 private:
84  //@cond PRIVATE
85  std::unique_ptr<EmailAddressSelectionDialogPrivate> const d;
86  //@endcond
87 };
88 }
A widget to select email addresses from Akonadi.
A dialog to select email addresses from Akonadi.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 03:57:18 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.