summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-07-04 07:47:13 +0200
committerMontel Laurent <[email protected]>2017-07-04 07:47:27 +0200
commit8de7bd5749debd305aca706449dfc5e44821c924 (patch)
treef354e1622068f1dd3e5bf0914a3d22ab83691d6d
parent25a6b460cb7711d65bf4fe428b3b6a87427ccf75 (diff)
not necessary to create private class
-rw-r--r--kmailtransport/sendmail/sendmailconfigdialog.cpp77
-rw-r--r--kmailtransport/sendmail/sendmailconfigdialog.h13
2 files changed, 35 insertions, 55 deletions
diff --git a/kmailtransport/sendmail/sendmailconfigdialog.cpp b/kmailtransport/sendmail/sendmailconfigdialog.cpp
index e83f28a..97785c6 100644
--- a/kmailtransport/sendmail/sendmailconfigdialog.cpp
+++ b/kmailtransport/sendmail/sendmailconfigdialog.cpp
@@ -29,70 +29,49 @@
using namespace MailTransport;
-class MailTransport::SendMailConfigDialog::Private
-{
-public:
- Private(SendMailConfigDialog *qq)
- : transport(nullptr)
- , configWidget(nullptr)
- , q(qq)
- , okButton(nullptr)
- {
- }
-
- Transport *transport;
- SendmailConfigWidget *configWidget;
- SendMailConfigDialog *q;
- QPushButton *okButton;
-
- void okClicked();
- void slotTextChanged(const QString &text);
- void slotEnabledOkButton(bool);
-};
-
-void SendMailConfigDialog::Private::slotEnabledOkButton(bool b)
-{
- okButton->setEnabled(b);
-}
-
-void SendMailConfigDialog::Private::okClicked()
-{
- configWidget->apply();
- transport->save();
-}
-
-void SendMailConfigDialog::Private::slotTextChanged(const QString &text)
-{
- okButton->setEnabled(!text.isEmpty());
-}
-
SendMailConfigDialog::SendMailConfigDialog(Transport *transport, QWidget *parent)
: QDialog(parent)
- , d(new Private(this))
+ , mTransport(transport)
+ , mConfigWidget(nullptr)
+ , mOkButton(nullptr)
{
Q_ASSERT(transport);
- d->transport = transport;
QVBoxLayout *mainLayout = new QVBoxLayout(this);
- d->configWidget = new MailTransport::SendmailConfigWidget(transport, this);
- d->configWidget->setObjectName(QStringLiteral("sendmailconfigwidget"));
- mainLayout->addWidget(d->configWidget);
+ mConfigWidget = new MailTransport::SendmailConfigWidget(transport, this);
+ mConfigWidget->setObjectName(QStringLiteral("sendmailconfigwidget"));
+ mainLayout->addWidget(mConfigWidget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
buttonBox->setObjectName(QStringLiteral("buttonbox"));
- d->okButton = buttonBox->button(QDialogButtonBox::Ok);
- d->okButton->setEnabled(false);
- d->okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ mOkButton = buttonBox->button(QDialogButtonBox::Ok);
+ mOkButton->setEnabled(false);
+ mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
mainLayout->addWidget(buttonBox);
- connect(d->okButton, SIGNAL(clicked()), this, SLOT(okClicked()));
+ connect(mOkButton, &QAbstractButton::clicked, this, &SendMailConfigDialog::okClicked);
connect(buttonBox, &QDialogButtonBox::accepted, this, &SendMailConfigDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &SendMailConfigDialog::reject);
- connect(d->configWidget, SIGNAL(enableButtonOk(bool)), this, SLOT(slotEnabledOkButton(bool)));
- d->slotEnabledOkButton(!d->configWidget->pathIsEmpty());
+ connect(mConfigWidget, &SendmailConfigWidget::enableButtonOk, this, &SendMailConfigDialog::slotEnabledOkButton);
+ slotEnabledOkButton(!mConfigWidget->pathIsEmpty());
}
SendMailConfigDialog::~SendMailConfigDialog()
{
- delete d;
+}
+
+void SendMailConfigDialog::slotEnabledOkButton(bool b)
+{
+ mOkButton->setEnabled(b);
+}
+
+void SendMailConfigDialog::okClicked()
+{
+ mConfigWidget->apply();
+ mTransport->save();
+}
+
+void SendMailConfigDialog::slotTextChanged(const QString &text)
+{
+ mOkButton->setEnabled(!text.isEmpty());
}
#include "moc_sendmailconfigdialog.cpp"
diff --git a/kmailtransport/sendmail/sendmailconfigdialog.h b/kmailtransport/sendmail/sendmailconfigdialog.h
index abb9354..ad8a98a 100644
--- a/kmailtransport/sendmail/sendmailconfigdialog.h
+++ b/kmailtransport/sendmail/sendmailconfigdialog.h
@@ -21,9 +21,9 @@
#define MAILTRANSPORT_SENDMAILTRANSPORTCONFIGDIALOG_H
#include <QDialog>
-
namespace MailTransport {
class Transport;
+class SendmailConfigWidget;
class SendMailConfigDialog : public QDialog
{
@@ -33,12 +33,13 @@ public:
virtual ~SendMailConfigDialog();
private:
- class Private;
- Private *const d;
+ void okClicked();
+ void slotTextChanged(const QString &text);
+ void slotEnabledOkButton(bool);
- Q_PRIVATE_SLOT(d, void okClicked())
- Q_PRIVATE_SLOT(d, void slotTextChanged(const QString &))
- Q_PRIVATE_SLOT(d, void slotEnabledOkButton(bool))
+ Transport *mTransport;
+ MailTransport::SendmailConfigWidget *mConfigWidget;
+ QPushButton *mOkButton;
};
} // namespace MailTransport