Akonadi Contacts

emailaddressselection.h
1/*
2 This file is part of Akonadi Contact.
3
4 SPDX-FileCopyrightText: 2010 KDAB
5 SPDX-FileContributor: Tobias Koenig <tokoe@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10#pragma once
11
12#include "akonadi-contact-core_export.h"
13
14#include <QList>
15#include <QSharedDataPointer>
16#include <QString>
17
18namespace Akonadi
19{
20class Item;
21class 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 <tokoe@kde.org>
34 * @since 4.5
35 */
36class AKONADI_CONTACT_CORE_EXPORT EmailAddressSelection
37{
38public:
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 [[nodiscard]] bool isValid() const;
68
69 /**
70 * Returns the name that is associated with the selected email address.
71 */
72 [[nodiscard]] QString name() const;
73 void setName(const QString &name);
74
75 /**
76 * Returns the address part of the selected email address.
77 *
78 * @note If a contact group has been selected, the name of the contact
79 * group is returned here and must be expanded by the caller.
80 */
81 [[nodiscard]] QString email() const;
82 void setEmail(const QString &email);
83
84 /**
85 * Returns the name and email address together, properly quoted if needed.
86 *
87 * @note If a contact group has been selected, the name of the contact
88 * group is returned here and must be expanded by the caller.
89 */
90 [[nodiscard]] QString quotedEmail() const;
91
92 /**
93 * Returns the Akonadi item that is associated with the selected email address.
94 */
95 [[nodiscard]] Akonadi::Item item() const;
96
97 void setItem(const Akonadi::Item &item);
98
99private:
100 //@cond PRIVATE
101 friend class EmailAddressSelectionWidget;
102
104 //@endcond
105};
106}
107
108Q_DECLARE_TYPEINFO(Akonadi::EmailAddressSelection, Q_RELOCATABLE_TYPE);
A widget to select email addresses from Akonadi.
An selection of an email address and corresponding name.
~EmailAddressSelection()
Destroys the email address selection.
EmailAddressSelection(const EmailAddressSelection &other)
Creates a new email address selection from an other selection.
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 Mon Nov 18 2024 12:08:08 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.