Akonadi Contacts

emailaddressselection.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 <QSharedDataPointer>
15 #include <QString>
16 #include <QVector>
17 
18 namespace Akonadi
19 {
20 class Item;
21 class EmailAddressSelectionPrivate;
22 
23 /**
24  * @short An selection of an email address and corresponding name.
25  *
26  * This class encapsulates the selection of an email address and name
27  * as it is returned by EmailAddressSelectionWidget or EmailAddressSelectionDialog.
28  *
29  * It offers convenience methods to retrieve the quoted version of the
30  * email address and access to the Akonadi item that is associated with
31  * this address.
32  *
33  * @author Tobias Koenig <[email protected]>
34  * @since 4.5
35  */
36 class AKONADI_CONTACT_EXPORT EmailAddressSelection
37 {
38 public:
39  /**
40  * A list of email address selection objects.
41  */
43 
44  /**
45  * Creates a new email address selection.
46  */
48 
49  /**
50  * Creates a new email address selection from an @p other selection.
51  */
53 
54  /**
55  * Replaces this email address selection with the @p other selection.
56  */
57  EmailAddressSelection &operator=(const EmailAddressSelection &other);
58 
59  /**
60  * Destroys the email address selection.
61  */
63 
64  /**
65  * Returns whether the selection is valid.
66  */
67  Q_REQUIRED_RESULT bool isValid() const;
68 
69  /**
70  * Returns the name that is associated with the selected email address.
71  */
72  Q_REQUIRED_RESULT QString name() const;
73 
74  /**
75  * Returns the address part of the selected email address.
76  *
77  * @note If a contact group has been selected, the name of the contact
78  * group is returned here and must be expanded by the caller.
79  */
80  Q_REQUIRED_RESULT QString email() const;
81 
82  /**
83  * Returns the name and email address together, properly quoted if needed.
84  *
85  * @note If a contact group has been selected, the name of the contact
86  * group is returned here and must be expanded by the caller.
87  */
88  Q_REQUIRED_RESULT QString quotedEmail() const;
89 
90  /**
91  * Returns the Akonadi item that is associated with the selected email address.
92  */
93  Q_REQUIRED_RESULT Akonadi::Item item() const;
94 
95 private:
96  //@cond PRIVATE
97  friend class EmailAddressSelectionWidget;
98 
100  //@endcond
101 };
102 }
103 
104 Q_DECLARE_TYPEINFO(Akonadi::EmailAddressSelection, Q_MOVABLE_TYPE);
An selection of an email address and corresponding name.
A widget 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.