From 6c872dd62c48449674491d08e77e7a797af782a6 Mon Sep 17 00:00:00 2001 From: Thomas Lindner Date: Wed, 30 Nov 2022 21:53:12 +0100 Subject: [PATCH] more login details --- src/login_dialog.cc | 28 +++++++++++++++++++++++----- src/login_dialog.hh | 4 ++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/login_dialog.cc b/src/login_dialog.cc index bfbf075..20964de 100644 --- a/src/login_dialog.cc +++ b/src/login_dialog.cc @@ -12,7 +12,11 @@ LoginDialog::LoginDialog(QWidget *parent, DeltachatContext *context) : QDialog{parent}, m_context{context}, m_email{new QLineEdit}, - m_password{new QLineEdit} { + m_password{new QLineEdit}, + m_imapuser{new QLineEdit}, + m_imapserver{new QLineEdit}, + m_smtpuser{new QLineEdit}, + m_smtpserver{new QLineEdit} { connect(m_context, &DeltachatContext::configureProgress, this, &LoginDialog::configureProgress); @@ -20,9 +24,13 @@ LoginDialog::LoginDialog(QWidget *parent, DeltachatContext *context) form->addRow(new QLabel{"Email:"}, m_email); form->addRow(new QLabel{"Password:"}, m_password); m_password->setEchoMode(QLineEdit::Password); + form->addRow(new QLabel{"IMAP-user:"}, m_imapuser); + form->addRow(new QLabel{"IMAP-server:"}, m_imapserver); + form->addRow(new QLabel{"SMTP-user:"}, m_smtpuser); + form->addRow(new QLabel{"SMTP-server:"}, m_smtpserver); auto buttons = - new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + new QDialogButtonBox{QDialogButtonBox::Ok | QDialogButtonBox::Cancel}; connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); @@ -41,20 +49,27 @@ LoginDialog::LoginDialog(QWidget *parent, DeltachatContext *context) void LoginDialog::accept() { m_context->setConfig("addr", m_email->text()); m_context->setConfig("mail_pw", m_password->text()); + m_context->setConfig("mail_user", m_imapuser->text()); + m_context->setConfig("mail_server", m_imapserver->text()); + m_context->setConfig("send_user", m_smtpuser->text()); + m_context->setConfig("send_server", m_smtpserver->text()); m_context->configure(); m_progress = new QProgressDialog{"Connecting ...", "Cancel", 0, 1000, static_cast(parent())}; + m_progress->setModal(true); connect(m_progress, &QProgressDialog::canceled, this, &LoginDialog::configureCanceled); QDialog::accept(); } void LoginDialog::configureProgress(int permille, QString message) { - if (permille) { + if (permille && m_progress) { m_progress->setValue(permille); m_progress->setLabelText(message); } else { - m_progress->close(); + if (m_progress) { + m_progress->close(); + } configureCanceled(); QMessageBox messagebox; @@ -70,7 +85,10 @@ void LoginDialog::configureProgress(int permille, QString message) { } void LoginDialog::configureCanceled() { - m_progress->deleteLater(); + if (m_progress) { + m_progress->deleteLater(); + m_progress = nullptr; + } show(); } diff --git a/src/login_dialog.hh b/src/login_dialog.hh index 29338ca..68ea007 100644 --- a/src/login_dialog.hh +++ b/src/login_dialog.hh @@ -22,6 +22,10 @@ class LoginDialog : public QDialog { DeltachatContext *m_context; QLineEdit *m_email; QLineEdit *m_password; + QLineEdit *m_imapuser; + QLineEdit *m_imapserver; + QLineEdit *m_smtpuser; + QLineEdit *m_smtpserver; QProgressDialog *m_progress; };