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

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 "akonadi_contact_widgets_private_export.h"
0013 #include <QWidget>
0014 class QToolButton;
0015 namespace KContacts
0016 {
0017 class PhoneNumber;
0018 }
0019 namespace Akonadi
0020 {
0021 class PreferredLineEditWidget;
0022 class PhoneComboBoxType;
0023 class AKONADI_CONTACT_WIDGETS_TESTS_EXPORT PhoneWidget : public QWidget
0024 {
0025     Q_OBJECT
0026 public:
0027     explicit PhoneWidget(QWidget *parent = nullptr);
0028     ~PhoneWidget() override;
0029 
0030     void updateAddRemoveButton(bool addButtonEnabled);
0031     void loadPhone(const KContacts::PhoneNumber &number);
0032     KContacts::PhoneNumber storePhone();
0033     void clearWidget();
0034     void setPreferred(bool b);
0035     void setReadOnly(bool readOnly);
0036 Q_SIGNALS:
0037     void addWidget(Akonadi::PhoneWidget *);
0038     void removeWidget(Akonadi::PhoneWidget *);
0039     void preferredChanged(Akonadi::PhoneWidget *);
0040 
0041 private:
0042     void slotAddPhone();
0043     void slotRemovePhone();
0044     void slotPreferredChanged();
0045     PreferredLineEditWidget *mPhoneNumberEdit = nullptr;
0046     QToolButton *mAddButton = nullptr;
0047     QToolButton *mRemoveButton = nullptr;
0048     PhoneComboBoxType *mPhoneType = nullptr;
0049 };
0050 }