MailTransport

smtpconfigdialog.cpp
1/*
2 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "smtpconfigdialog.h"
8
9#include "smtpconfigwidget.h"
10#include "transport.h"
11#include "transportmanager.h"
12#include "transporttype.h"
13
14#include <QDialogButtonBox>
15#include <QPushButton>
16#include <QVBoxLayout>
17
18using namespace MailTransport;
19
20SmtpConfigDialog::SmtpConfigDialog(Transport *transport, QWidget *parent)
21 : QDialog(parent)
22{
23 Q_ASSERT(transport);
24 mTransport = transport;
25 auto mainLayout = new QVBoxLayout(this);
26 mConfigWidget = new SMTPConfigWidget(transport, this);
27 mConfigWidget->setObjectName(QLatin1StringView("smtpconfigwidget"));
28 mainLayout->addWidget(mConfigWidget);
30 buttonBox->setObjectName(QLatin1StringView("buttons"));
31 mOkButton = buttonBox->button(QDialogButtonBox::Ok);
32 mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
33 mainLayout->addWidget(buttonBox);
34
35 connect(mOkButton, &QAbstractButton::clicked, this, &SmtpConfigDialog::okClicked);
36 connect(buttonBox, &QDialogButtonBox::accepted, this, &SmtpConfigDialog::accept);
37 connect(buttonBox, &QDialogButtonBox::rejected, this, &SmtpConfigDialog::reject);
38}
39
40SmtpConfigDialog::~SmtpConfigDialog() = default;
41
42void SmtpConfigDialog::okClicked()
43{
44 mConfigWidget->apply();
45 mTransport->save();
46}
47
48void SmtpConfigDialog::slotTextChanged(const QString &text)
49{
50 mOkButton->setEnabled(!text.isEmpty());
51}
52
53#include "moc_smtpconfigdialog.cpp"
Represents the settings of a specific mail transport.
Definition transport.h:33
void clicked(bool checked)
bool isEmpty() const const
Key_Return
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
void setEnabled(bool)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:12:37 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.