more login details
This commit is contained in:
parent
f7b088b6dc
commit
6c872dd62c
|
@ -12,7 +12,11 @@ LoginDialog::LoginDialog(QWidget *parent, DeltachatContext *context)
|
||||||
: QDialog{parent},
|
: QDialog{parent},
|
||||||
m_context{context},
|
m_context{context},
|
||||||
m_email{new QLineEdit},
|
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,
|
connect(m_context, &DeltachatContext::configureProgress, this,
|
||||||
&LoginDialog::configureProgress);
|
&LoginDialog::configureProgress);
|
||||||
|
|
||||||
|
@ -20,9 +24,13 @@ LoginDialog::LoginDialog(QWidget *parent, DeltachatContext *context)
|
||||||
form->addRow(new QLabel{"Email:"}, m_email);
|
form->addRow(new QLabel{"Email:"}, m_email);
|
||||||
form->addRow(new QLabel{"Password:"}, m_password);
|
form->addRow(new QLabel{"Password:"}, m_password);
|
||||||
m_password->setEchoMode(QLineEdit::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 =
|
auto buttons =
|
||||||
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
new QDialogButtonBox{QDialogButtonBox::Ok | QDialogButtonBox::Cancel};
|
||||||
connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
|
|
||||||
|
@ -41,20 +49,27 @@ LoginDialog::LoginDialog(QWidget *parent, DeltachatContext *context)
|
||||||
void LoginDialog::accept() {
|
void LoginDialog::accept() {
|
||||||
m_context->setConfig("addr", m_email->text());
|
m_context->setConfig("addr", m_email->text());
|
||||||
m_context->setConfig("mail_pw", m_password->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_context->configure();
|
||||||
m_progress = new QProgressDialog{"Connecting ...", "Cancel", 0, 1000,
|
m_progress = new QProgressDialog{"Connecting ...", "Cancel", 0, 1000,
|
||||||
static_cast<QWidget *>(parent())};
|
static_cast<QWidget *>(parent())};
|
||||||
|
m_progress->setModal(true);
|
||||||
connect(m_progress, &QProgressDialog::canceled, this,
|
connect(m_progress, &QProgressDialog::canceled, this,
|
||||||
&LoginDialog::configureCanceled);
|
&LoginDialog::configureCanceled);
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginDialog::configureProgress(int permille, QString message) {
|
void LoginDialog::configureProgress(int permille, QString message) {
|
||||||
if (permille) {
|
if (permille && m_progress) {
|
||||||
m_progress->setValue(permille);
|
m_progress->setValue(permille);
|
||||||
m_progress->setLabelText(message);
|
m_progress->setLabelText(message);
|
||||||
} else {
|
} else {
|
||||||
m_progress->close();
|
if (m_progress) {
|
||||||
|
m_progress->close();
|
||||||
|
}
|
||||||
configureCanceled();
|
configureCanceled();
|
||||||
|
|
||||||
QMessageBox messagebox;
|
QMessageBox messagebox;
|
||||||
|
@ -70,7 +85,10 @@ void LoginDialog::configureProgress(int permille, QString message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginDialog::configureCanceled() {
|
void LoginDialog::configureCanceled() {
|
||||||
m_progress->deleteLater();
|
if (m_progress) {
|
||||||
|
m_progress->deleteLater();
|
||||||
|
m_progress = nullptr;
|
||||||
|
}
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,10 @@ class LoginDialog : public QDialog {
|
||||||
DeltachatContext *m_context;
|
DeltachatContext *m_context;
|
||||||
QLineEdit *m_email;
|
QLineEdit *m_email;
|
||||||
QLineEdit *m_password;
|
QLineEdit *m_password;
|
||||||
|
QLineEdit *m_imapuser;
|
||||||
|
QLineEdit *m_imapserver;
|
||||||
|
QLineEdit *m_smtpuser;
|
||||||
|
QLineEdit *m_smtpserver;
|
||||||
QProgressDialog *m_progress;
|
QProgressDialog *m_progress;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue