File indexing completed on 2025-01-05 04:49:50

0001 /*
0002    SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Akonadi/ServerManager>
0010 #include <KContacts/Addressee>
0011 #include <KSieveUi/AbstractSelectEmailLineEdit>
0012 class QLineEdit;
0013 class QToolButton;
0014 class EmailLineEdit : public KSieveUi::AbstractSelectEmailLineEdit
0015 {
0016     Q_OBJECT
0017 public:
0018     explicit EmailLineEdit(QWidget *parent = nullptr, const QList<QVariant> & = {});
0019     ~EmailLineEdit() override;
0020 
0021     void setText(const QString &str) override;
0022     [[nodiscard]] QString text() const override;
0023     [[nodiscard]] bool isValid() const override;
0024 
0025 private:
0026     void insertAddresses(const KContacts::Addressee::List &list);
0027     void slotTextChanged();
0028     void verifyAddress();
0029     void slotSelectEmail();
0030     void verifyAkonadiStatus();
0031     void akonadiStateChanged(Akonadi::ServerManager::State state);
0032     QString mNegativeBackground;
0033     QLineEdit *const mLineEdit;
0034     QToolButton *const mEmailButton;
0035     bool mEmailIsValid = false;
0036 };