From fad26c93a5ce8ea6caccd3c6c852af3787762a3f Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 25 May 2013 14:02:26 +0200 Subject: [PATCH] Implement authenticate slot in download dialog --- src/Gui/DlgAuthorization.ui | 182 +++++++++++------------------------- src/Gui/DownloadDialog.cpp | 12 +++ 2 files changed, 69 insertions(+), 125 deletions(-) diff --git a/src/Gui/DlgAuthorization.ui b/src/Gui/DlgAuthorization.ui index 35fb1e567..b9e5592a7 100644 --- a/src/Gui/DlgAuthorization.ui +++ b/src/Gui/DlgAuthorization.ui @@ -1,10 +1,8 @@ - - - - + + Gui::Dialog::DlgAuthorization - - + + 0 0 @@ -12,107 +10,46 @@ 189 - + Authorization - + true - - - 11 - - - 6 - - - - - 0 - - - 6 - - - - - &OK - - - - - - true - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 140 - 20 - - - - - - - - &Cancel - - - - - - true - - - - - - - - - QLineEdit::Password + + + + + Username: - - - + + + + + + Password: - - - - - - - User name: + + + + QLineEdit::Password - + - + Qt::Vertical - + QSizePolicy::Expanding - + 21 41 @@ -120,48 +57,43 @@ + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Site: + + + + + + + + 75 + true + + + + %1 at %2 + + + true + + + - + username password - buttonOk - buttonCancel - - - buttonOk - clicked() - Gui::Dialog::DlgAuthorization - accept() - - - 20 - 20 - - - 20 - 20 - - - - - buttonCancel - clicked() - Gui::Dialog::DlgAuthorization - reject() - - - 20 - 20 - - - 20 - 20 - - - - + diff --git a/src/Gui/DownloadDialog.cpp b/src/Gui/DownloadDialog.cpp index 979e092ea..1c20d829d 100644 --- a/src/Gui/DownloadDialog.cpp +++ b/src/Gui/DownloadDialog.cpp @@ -27,7 +27,9 @@ # include #endif +#include #include "DownloadDialog.h" +#include "ui_DlgAuthorization.h" using namespace Gui::Dialog; @@ -202,6 +204,16 @@ void DownloadDialog::updateDataReadProgress(int bytesRead, int totalBytes) void DownloadDialog::slotAuthenticationRequired(const QString &hostName, quint16, QAuthenticator *authenticator) { + QDialog dlg; + Ui_DlgAuthorization ui; + ui.setupUi(&dlg); + dlg.adjustSize(); + ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(hostName)); + + if (dlg.exec() == QDialog::Accepted) { + authenticator->setUser(ui.username->text()); + authenticator->setPassword(ui.password->text()); + } }