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

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 <KContacts/Email>
0014 #include <QWidget>
0015 class QToolButton;
0016 namespace Akonadi
0017 {
0018 class PreferredLineEditWidget;
0019 class MailTypeCombobox;
0020 class AKONADI_CONTACT_WIDGETS_TESTS_EXPORT MailWidget : public QWidget
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit MailWidget(QWidget *parent = nullptr);
0025     ~MailWidget() override;
0026 
0027     void clearWidget();
0028     void updateAddRemoveButton(bool addButtonEnabled);
0029     void setMail(const KContacts::Email &email);
0030     KContacts::Email email();
0031     void setPreferred(bool b);
0032     void setReadOnly(bool readOnly);
0033 Q_SIGNALS:
0034     void addWidget(Akonadi::MailWidget *);
0035     void removeWidget(Akonadi::MailWidget *);
0036     void preferredChanged(Akonadi::MailWidget *);
0037 
0038 private:
0039     void slotAddMail();
0040     void slotRemoveMail();
0041     void slotPreferredChanged();
0042     KContacts::Email mEmail;
0043     QString mOldType;
0044     PreferredLineEditWidget *mMailEdit = nullptr;
0045     Akonadi::MailTypeCombobox *mMailType = nullptr;
0046     QToolButton *mAddButton = nullptr;
0047     QToolButton *mRemoveButton = nullptr;
0048 };
0049 }