File indexing completed on 2024-11-24 04:39:32

0001 /*
0002     This file is part of Contact Editor.
0003 
0004     SPDX-FileCopyrightText: 2016 eyeOS S.L.U., a Telefonica company, sales@eyeos.com
0005     SPDX-FileCopyrightText: 2016-2020 Laurent Montel <montel.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "displaynameeditwidget.h"
0013 #include <QWidget>
0014 
0015 #include <KContacts/Addressee>
0016 class KLineEdit;
0017 class QToolButton;
0018 namespace Akonadi
0019 {
0020 class NameWidget : public QWidget
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit NameWidget(QWidget *parent = nullptr);
0025     ~NameWidget() override;
0026 
0027     void loadContact(const KContacts::Addressee &contact);
0028     void storeContact(KContacts::Addressee &contact) const;
0029     void setReadOnly(bool readOnly);
0030 
0031     void setDisplayType(DisplayNameEditWidget::DisplayType type);
0032     [[nodiscard]] DisplayNameEditWidget::DisplayType displayType() const;
0033 
0034 Q_SIGNALS:
0035     void nameChanged(const KContacts::Addressee &contact);
0036 
0037 private:
0038     void slotTextChanged(const QString &text);
0039     void slotOpenNameEditDialog();
0040     DisplayNameEditWidget::DisplayType mDisplayType;
0041     KContacts::Addressee mContact;
0042     KLineEdit *mNameEdit = nullptr;
0043     QToolButton *mButtonEdit = nullptr;
0044 };
0045 }