MailTransport

smtpconfigdialog.cpp
1 /*
2  SPDX-FileCopyrightText: 2017-2023 Laurent Montel <[email protected]>
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 
18 using namespace MailTransport;
19 
20 SmtpConfigDialog::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(QStringLiteral("smtpconfigwidget"));
28  mainLayout->addWidget(mConfigWidget);
30  buttonBox->setObjectName(QStringLiteral("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 
40 SmtpConfigDialog::~SmtpConfigDialog() = default;
41 
42 void SmtpConfigDialog::okClicked()
43 {
44  mConfigWidget->apply();
45  mTransport->save();
46 }
47 
48 void SmtpConfigDialog::slotTextChanged(const QString &text)
49 {
50  mOkButton->setEnabled(!text.isEmpty());
51 }
52 
53 #include "moc_smtpconfigdialog.cpp"
void clicked(bool checked)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool isEmpty() const const
Key_Return
Represents the settings of a specific mail transport.
Definition: transport.h:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Mar 23 2023 04:19:12 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.