File indexing completed on 2025-02-16 04:49:30

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 "checkbeforesendupdatesmtpdialog.h"
0008 #include <KLocalizedString>
0009 #include <QCheckBox>
0010 #include <QDialogButtonBox>
0011 #include <QLabel>
0012 #include <QVBoxLayout>
0013 
0014 CheckBeforeSendUpdateSmtpDialog::CheckBeforeSendUpdateSmtpDialog(QWidget *parent)
0015     : QDialog(parent)
0016     , mChangeSmtp(new QCheckBox(i18n("Update SMTP server"), this))
0017 {
0018     setWindowTitle(i18nc("@title:window", "Check SMTP server"));
0019     auto mainLayout = new QVBoxLayout(this);
0020     mainLayout->setObjectName(QLatin1StringView("mainlayout"));
0021 
0022     auto lab = new QLabel(i18n("Do you want to send the email with a different SMTP than the one defined in the current identity?"), this);
0023     lab->setObjectName(QLatin1StringView("label"));
0024     lab->setWordWrap(true);
0025     mainLayout->addWidget(lab);
0026 
0027     mChangeSmtp->setObjectName(QLatin1StringView("changesmtp"));
0028     mChangeSmtp->setChecked(false);
0029     mainLayout->addWidget(mChangeSmtp);
0030 
0031     auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No, this);
0032     buttonBox->setObjectName(QLatin1StringView("buttonbox"));
0033     mainLayout->addWidget(buttonBox);
0034     connect(buttonBox, &QDialogButtonBox::accepted, this, &CheckBeforeSendUpdateSmtpDialog::accept);
0035     connect(buttonBox, &QDialogButtonBox::rejected, this, &CheckBeforeSendUpdateSmtpDialog::reject);
0036 }
0037 
0038 CheckBeforeSendUpdateSmtpDialog::~CheckBeforeSendUpdateSmtpDialog() = default;
0039 
0040 bool CheckBeforeSendUpdateSmtpDialog::changeSmtp() const
0041 {
0042     return mChangeSmtp->isChecked();
0043 }
0044 
0045 #include "moc_checkbeforesendupdatesmtpdialog.cpp"