2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2013-06-10 00:57:54 +03:00
|
|
|
|
|
|
|
|
#include "authenticationdialog.h"
|
|
|
|
|
|
2022-10-06 13:08:30 +02:00
|
|
|
#include "mercurialtr.h"
|
|
|
|
|
|
2022-10-04 10:10:58 +02:00
|
|
|
#include <utils/layoutbuilder.h>
|
2013-06-10 00:57:54 +03:00
|
|
|
|
2022-10-04 10:10:58 +02:00
|
|
|
#include <QDialogButtonBox>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
|
|
|
|
|
namespace Mercurial::Internal {
|
2013-06-10 00:57:54 +03:00
|
|
|
|
2022-10-04 10:10:58 +02:00
|
|
|
AuthenticationDialog::AuthenticationDialog(const QString &username, const QString &password, QWidget *parent)
|
|
|
|
|
: QDialog(parent)
|
2013-06-10 00:57:54 +03:00
|
|
|
{
|
2022-10-04 10:10:58 +02:00
|
|
|
resize(312, 116);
|
|
|
|
|
|
|
|
|
|
m_username = new QLineEdit(username);
|
|
|
|
|
|
|
|
|
|
m_password = new QLineEdit(password);
|
|
|
|
|
m_password->setEchoMode(QLineEdit::Password);
|
|
|
|
|
|
|
|
|
|
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
|
|
|
|
|
|
|
|
|
using namespace Utils::Layouting;
|
|
|
|
|
|
|
|
|
|
Column {
|
|
|
|
|
Form {
|
2022-10-06 13:08:30 +02:00
|
|
|
Tr::tr("Username:"), m_username, br,
|
|
|
|
|
Tr::tr("Password:"), m_password
|
2022-10-04 10:10:58 +02:00
|
|
|
},
|
|
|
|
|
buttonBox
|
|
|
|
|
}.attachTo(this);
|
|
|
|
|
|
|
|
|
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
|
|
|
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
2013-06-10 00:57:54 +03:00
|
|
|
}
|
|
|
|
|
|
2022-10-04 10:10:58 +02:00
|
|
|
AuthenticationDialog::~AuthenticationDialog() = default;
|
|
|
|
|
|
2013-06-10 00:57:54 +03:00
|
|
|
void AuthenticationDialog::setPasswordEnabled(bool enabled)
|
|
|
|
|
{
|
2022-10-04 10:10:58 +02:00
|
|
|
m_password->setEnabled(enabled);
|
2013-06-10 00:57:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AuthenticationDialog::getUserName()
|
|
|
|
|
{
|
2022-10-04 10:10:58 +02:00
|
|
|
return m_username->text();
|
2013-06-10 00:57:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AuthenticationDialog::getPassword()
|
|
|
|
|
{
|
2022-10-04 10:10:58 +02:00
|
|
|
return m_password->text();
|
2013-06-10 00:57:54 +03:00
|
|
|
}
|
2014-11-04 22:12:40 +02:00
|
|
|
|
2022-10-04 10:10:58 +02:00
|
|
|
} // Mercurial::Internal
|