Akonadi Contacts

displaynameeditwidget.h
1/*
2 This file is part of Contact Editor.
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 <QWidget>
12
13#include <KContacts/Addressee>
14
15class KComboBox;
16
17/**
18 * @short A widget for editing the display name of a contact.
19 *
20 * The widget will either use a predefined schema for formatting
21 * the name or a custom one.
22 */
23namespace Akonadi
24{
25class DisplayNameEditWidget : public QWidget
26{
28
29public:
30 /**
31 * Describes what the display name should look like.
32 */
33 enum DisplayType {
34 SimpleName, ///< A name of the form: givenName familyName
35 FullName, ///< A name of the form: prefix givenName additionalName familyName suffix
36 ReverseNameWithComma, ///< A name of the form: familyName, givenName
37 ReverseName, ///< A name of the form: familyName givenName
38 Organization, ///< The organization name
39 CustomName ///< Let the user input a display name
40 };
41
42 explicit DisplayNameEditWidget(QWidget *parent = nullptr);
43 ~DisplayNameEditWidget() override;
44
45 void loadContact(const KContacts::Addressee &contact);
46 void storeContact(KContacts::Addressee &contact) const;
47
48 void setReadOnly(bool readOnly);
49
50 void setDisplayType(DisplayType type);
51 [[nodiscard]] DisplayType displayType() const;
52
53public Q_SLOTS:
54 void changeName(const KContacts::Addressee &contact);
55 void changeOrganization(const QString &organization);
56
57protected:
58 bool eventFilter(QObject *object, QEvent *event) override;
59
60private:
61 void displayTypeChanged(int);
62 void setComboBoxEditable(bool);
63 void updateView();
64
65 KComboBox *mView = nullptr;
66 KContacts::Addressee mContact;
67 QWidget *mViewport = nullptr;
68 DisplayType mDisplayType = DisplayType::SimpleName;
69 int mAdditionalPopupWidth;
70};
71}
A widget for editing the display name of a contact.
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
virtual bool event(QEvent *event) override
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.