#include "passwordindlg.h"
#include "base/changepasswordform.h"
#include "gutil/qgui.h"
#include <QLabel>
#include <QPushButton>

PasswordInChDlg::PasswordInChDlg(QWidget *parent) : QDialog(parent) {
    resize(240, 150);

    auto vBox = new VBox(this);
    vBox->addStretch();

    auto hBox = new HBox(vBox);
    hBox->addWidget(new QLabel(tr("Input password")));

    fdPassword = new QLineEdit();
    fdPassword->setEchoMode(QLineEdit::Password);
    fdPassword->setFocus();
    hBox->addWidget(fdPassword);

    btnChangePassword = new QPushButton(tr("Change Password"));
    vBox->addWidget(btnChangePassword, 0, Qt::AlignRight);
    connect(btnChangePassword, &QPushButton::clicked, this, [this]() {
        ChangePasswordForm dlg(this);
        dlg.exec();
    });
    vBox->addStretch();

    btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    connect(btnBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
    vBox->addWidget(btnBox);
}
