mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 09:03:40 +02:00
2021-06-10 Fred Gleason <fredg@paravelsystems.com>
* Refactored the 'Set Password' dialog so as to pass the password value in the 'RDPasswd::exec()' method. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
#include "rdpasswd.h"
|
||||
#include "rdtextvalidator.h"
|
||||
|
||||
RDPasswd::RDPasswd(QString *password,QWidget *parent)
|
||||
RDPasswd::RDPasswd(const QString &caption,QWidget *parent)
|
||||
: RDDialog(parent)
|
||||
{
|
||||
//
|
||||
@@ -32,8 +32,7 @@ RDPasswd::RDPasswd(QString *password,QWidget *parent)
|
||||
setMinimumSize(sizeHint());
|
||||
setMaximumSize(sizeHint());
|
||||
|
||||
passwd_password=password;
|
||||
setWindowTitle(tr("Change Password"));
|
||||
setWindowTitle(caption+" - "+tr("Change Password"));
|
||||
|
||||
//
|
||||
// Text Validator
|
||||
@@ -48,7 +47,7 @@ RDPasswd::RDPasswd(QString *password,QWidget *parent)
|
||||
passwd_password_1_edit->setEchoMode(QLineEdit::Password);
|
||||
passwd_password_1_edit->setFocus();
|
||||
passwd_password_1_edit->setValidator(validator);
|
||||
passwd_password_1_label=new QLabel(tr("&Password:"),this);
|
||||
passwd_password_1_label=new QLabel(tr("Password:"),this);
|
||||
passwd_password_1_label->setFont(labelFont());
|
||||
passwd_password_1_label->setAlignment(Qt::AlignRight);
|
||||
|
||||
@@ -59,7 +58,7 @@ RDPasswd::RDPasswd(QString *password,QWidget *parent)
|
||||
passwd_password_2_edit->setMaxLength(RD_MAX_PASSWORD_LENGTH);
|
||||
passwd_password_2_edit->setEchoMode(QLineEdit::Password);
|
||||
passwd_password_2_edit->setValidator(validator);
|
||||
passwd_password_2_label=new QLabel(tr("C&onfirm:"),this);
|
||||
passwd_password_2_label=new QLabel(tr("Confirm:"),this);
|
||||
passwd_password_2_label->setFont(labelFont());
|
||||
passwd_password_2_label->setAlignment(Qt::AlignRight);
|
||||
|
||||
@@ -68,7 +67,7 @@ RDPasswd::RDPasswd(QString *password,QWidget *parent)
|
||||
//
|
||||
passwd_ok_button=new QPushButton(this);
|
||||
passwd_ok_button->setFont(buttonFont());
|
||||
passwd_ok_button->setText(tr("&OK"));
|
||||
passwd_ok_button->setText(tr("OK"));
|
||||
passwd_ok_button->setDefault(true);
|
||||
connect(passwd_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
|
||||
|
||||
@@ -77,7 +76,7 @@ RDPasswd::RDPasswd(QString *password,QWidget *parent)
|
||||
//
|
||||
passwd_cancel_button=new QPushButton(this);
|
||||
passwd_cancel_button->setFont(buttonFont());
|
||||
passwd_cancel_button->setText(tr("&Cancel"));
|
||||
passwd_cancel_button->setText(tr("Cancel"));
|
||||
connect(passwd_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
||||
}
|
||||
|
||||
@@ -101,6 +100,14 @@ QSizePolicy RDPasswd::sizePolicy() const
|
||||
}
|
||||
|
||||
|
||||
int RDPasswd::exec(QString *passwd)
|
||||
{
|
||||
passwd_password=passwd;
|
||||
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
|
||||
void RDPasswd::okData()
|
||||
{
|
||||
if(passwd_password_1_edit->text()==passwd_password_2_edit->text()) {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Set Password Widget for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -25,17 +25,21 @@
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <rddialog.h>
|
||||
#include "rddialog.h"
|
||||
|
||||
class RDPasswd : public RDDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT;
|
||||
public:
|
||||
RDPasswd(QString *password,QWidget *parent=0);
|
||||
RDPasswd(const QString &caption,QWidget *parent=0);
|
||||
// RDPasswd(QString *password,QWidget *parent=0);
|
||||
~RDPasswd();
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
|
||||
public slots:
|
||||
int exec(QString *passwd);
|
||||
|
||||
private slots:
|
||||
void okData();
|
||||
void cancelData();
|
||||
|
Reference in New Issue
Block a user