File indexing completed on 2025-01-19 04:46:43

0001 /*
0002    SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "confirmaddressemailentrydialog.h"
0008 #include <KEmailValidator>
0009 #include <KLocalizedString>
0010 #include <QDialogButtonBox>
0011 #include <QLabel>
0012 #include <QLineEdit>
0013 #include <QVBoxLayout>
0014 
0015 ConfirmAddressEmailEntryDialog::ConfirmAddressEmailEntryDialog(QWidget *parent)
0016     : QDialog(parent)
0017     , mLineEdit(new QLineEdit(this))
0018 {
0019     auto mainLayout = new QVBoxLayout(this);
0020     mainLayout->setObjectName(QLatin1StringView("mainlayout"));
0021     auto label = new QLabel(i18n("Enter new domain name:"), this);
0022     label->setObjectName(QLatin1StringView("label"));
0023     mainLayout->addWidget(label);
0024 
0025     mLineEdit->setObjectName(QLatin1StringView("lineedit"));
0026     mainLayout->addWidget(mLineEdit);
0027 
0028     auto emailValidator = new KEmailValidator(this);
0029     mLineEdit->setValidator(emailValidator);
0030 
0031     auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
0032     buttons->setObjectName(QLatin1StringView("buttons"));
0033     mainLayout->addWidget(buttons);
0034     connect(buttons, &QDialogButtonBox::accepted, this, &ConfirmAddressEmailEntryDialog::accept);
0035     connect(buttons, &QDialogButtonBox::rejected, this, &ConfirmAddressEmailEntryDialog::reject);
0036 }
0037 
0038 QString ConfirmAddressEmailEntryDialog::emails() const
0039 {
0040     return mLineEdit->text();
0041 }
0042 
0043 void ConfirmAddressEmailEntryDialog::setValue(const QString &val)
0044 {
0045     mLineEdit->setText(val);
0046 }
0047 
0048 #include "moc_confirmaddressemailentrydialog.cpp"