2014-02-27 16:18:42 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 by Daniel Molkentin <danimo@owncloud.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2016-10-25 12:00:07 +03:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2014-02-27 16:18:42 +04:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "authenticationdialog.h"
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QFormLayout>
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
namespace OCC {
|
2014-02-27 16:18:42 +04:00
|
|
|
|
|
|
|
AuthenticationDialog::AuthenticationDialog(const QString &realm, const QString &domain, QWidget *parent)
|
|
|
|
: QDialog(parent)
|
|
|
|
, _user(new QLineEdit)
|
|
|
|
, _password(new QLineEdit)
|
|
|
|
{
|
|
|
|
setWindowTitle(tr("Authentication Required"));
|
2020-05-18 21:54:23 +03:00
|
|
|
auto *lay = new QVBoxLayout(this);
|
2021-07-28 22:35:13 +03:00
|
|
|
auto *label = new QLabel(tr("Enter username and password for \"%1\" at %2.").arg(realm, domain));
|
2017-02-23 16:54:17 +03:00
|
|
|
label->setTextFormat(Qt::PlainText);
|
2014-02-27 16:18:42 +04:00
|
|
|
lay->addWidget(label);
|
|
|
|
|
2020-05-18 21:54:23 +03:00
|
|
|
auto *form = new QFormLayout;
|
2022-06-23 12:13:18 +03:00
|
|
|
form->addRow(tr("&Username:"), _user);
|
2014-02-27 16:18:42 +04:00
|
|
|
form->addRow(tr("&Password:"), _password);
|
|
|
|
lay->addLayout(form);
|
2014-02-27 16:31:42 +04:00
|
|
|
_password->setEchoMode(QLineEdit::Password);
|
|
|
|
|
2020-05-18 21:54:23 +03:00
|
|
|
auto *box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
|
2017-09-20 11:14:48 +03:00
|
|
|
connect(box, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
|
|
|
connect(box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
2014-02-27 16:18:42 +04:00
|
|
|
lay->addWidget(box);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AuthenticationDialog::user() const
|
|
|
|
{
|
|
|
|
return _user->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AuthenticationDialog::password() const
|
|
|
|
{
|
|
|
|
return _password->text();
|
|
|
|
}
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
} // namespace OCC
|