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"
8using namespace Qt::Literals::StringLiterals;
9
10#include "smtpconfigwidget.h"
11#include "transport.h"
12#include "transportmanager.h"
13#include "transporttype.h"
14
15#include <QDialogButtonBox>
16#include <QPushButton>
17#include <QVBoxLayout>
18
19using namespace MailTransport;
20
21SmtpConfigDialog::SmtpConfigDialog(Transport *transport, QWidget *parent)
22 : QDialog(parent)
23{
24 Q_ASSERT(transport);
25 mTransport = transport;
26 auto mainLayout = new QVBoxLayout(this);
27 mConfigWidget = new SMTPConfigWidget(transport, this);
28 mConfigWidget->setObjectName("smtpconfigwidget"_L1);
29 mainLayout->addWidget(mConfigWidget);
31 buttonBox->setObjectName("buttons"_L1);
32 mOkButton = buttonBox->button(QDialogButtonBox::Ok);
33 mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
34 mainLayout->addWidget(buttonBox);
35
36 connect(mOkButton, &QAbstractButton::clicked, this, &SmtpConfigDialog::okClicked);
37 connect(buttonBox, &QDialogButtonBox::accepted, this, &SmtpConfigDialog::accept);
38 connect(buttonBox, &QDialogButtonBox::rejected, this, &SmtpConfigDialog::reject);
39}
40
41SmtpConfigDialog::~SmtpConfigDialog() = default;
42
43void SmtpConfigDialog::okClicked()
44{
45 mConfigWidget->apply();
46 mTransport->save();
47}
48
49void SmtpConfigDialog::slotTextChanged(const QString &text)
50{
51 mOkButton->setEnabled(!text.isEmpty());
52}
53
54#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 Fri Jul 26 2024 11:56:31 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.