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:
Fred Gleason 2021-06-10 15:32:31 -04:00
parent f7ade0d59e
commit 32a1efbeac
5 changed files with 34 additions and 14 deletions

View File

@ -21871,3 +21871,6 @@
* Fixed a bug in rdadmin(1) that caused the incorrect Login Name * Fixed a bug in rdadmin(1) that caused the incorrect Login Name
to appear in the 'Rivendell User List' dialog immediately after to appear in the 'Rivendell User List' dialog immediately after
adding the user. adding the user.
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.

View File

@ -23,7 +23,7 @@
#include "rdpasswd.h" #include "rdpasswd.h"
#include "rdtextvalidator.h" #include "rdtextvalidator.h"
RDPasswd::RDPasswd(QString *password,QWidget *parent) RDPasswd::RDPasswd(const QString &caption,QWidget *parent)
: RDDialog(parent) : RDDialog(parent)
{ {
// //
@ -32,8 +32,7 @@ RDPasswd::RDPasswd(QString *password,QWidget *parent)
setMinimumSize(sizeHint()); setMinimumSize(sizeHint());
setMaximumSize(sizeHint()); setMaximumSize(sizeHint());
passwd_password=password; setWindowTitle(caption+" - "+tr("Change Password"));
setWindowTitle(tr("Change Password"));
// //
// Text Validator // Text Validator
@ -48,7 +47,7 @@ RDPasswd::RDPasswd(QString *password,QWidget *parent)
passwd_password_1_edit->setEchoMode(QLineEdit::Password); passwd_password_1_edit->setEchoMode(QLineEdit::Password);
passwd_password_1_edit->setFocus(); passwd_password_1_edit->setFocus();
passwd_password_1_edit->setValidator(validator); 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->setFont(labelFont());
passwd_password_1_label->setAlignment(Qt::AlignRight); 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->setMaxLength(RD_MAX_PASSWORD_LENGTH);
passwd_password_2_edit->setEchoMode(QLineEdit::Password); passwd_password_2_edit->setEchoMode(QLineEdit::Password);
passwd_password_2_edit->setValidator(validator); 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->setFont(labelFont());
passwd_password_2_label->setAlignment(Qt::AlignRight); 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=new QPushButton(this);
passwd_ok_button->setFont(buttonFont()); passwd_ok_button->setFont(buttonFont());
passwd_ok_button->setText(tr("&OK")); passwd_ok_button->setText(tr("OK"));
passwd_ok_button->setDefault(true); passwd_ok_button->setDefault(true);
connect(passwd_ok_button,SIGNAL(clicked()),this,SLOT(okData())); 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=new QPushButton(this);
passwd_cancel_button->setFont(buttonFont()); 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())); 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() void RDPasswd::okData()
{ {
if(passwd_password_1_edit->text()==passwd_password_2_edit->text()) { if(passwd_password_1_edit->text()==passwd_password_2_edit->text()) {

View File

@ -2,7 +2,7 @@
// //
// Set Password Widget for Rivendell. // 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 // 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 // it under the terms of the GNU General Public License version 2 as
@ -25,17 +25,21 @@
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
#include <rddialog.h> #include "rddialog.h"
class RDPasswd : public RDDialog class RDPasswd : public RDDialog
{ {
Q_OBJECT Q_OBJECT;
public: public:
RDPasswd(QString *password,QWidget *parent=0); RDPasswd(const QString &caption,QWidget *parent=0);
// RDPasswd(QString *password,QWidget *parent=0);
~RDPasswd(); ~RDPasswd();
QSize sizeHint() const; QSize sizeHint() const;
QSizePolicy sizePolicy() const; QSizePolicy sizePolicy() const;
public slots:
int exec(QString *passwd);
private slots: private slots:
void okData(); void okData();
void cancelData(); void cancelData();

View File

@ -41,6 +41,11 @@ EditUser::EditUser(const QString &user,QWidget *parent)
setWindowTitle("RDAdmin - "+tr("User: ")+user); setWindowTitle("RDAdmin - "+tr("User: ")+user);
user_user=new RDUser(user); user_user=new RDUser(user);
//
// Dialogs
//
user_password_dialog=new RDPasswd("RDAdmin",this);
// //
// Text Validator // Text Validator
// //
@ -470,6 +475,7 @@ EditUser::~EditUser()
delete user_prod_group; delete user_prod_group;
delete user_traffic_group; delete user_traffic_group;
delete user_onair_group; delete user_onair_group;
delete user_password_dialog;
} }
@ -497,11 +503,9 @@ void EditUser::passwordData()
{ {
QString password; QString password;
RDPasswd *passwd=new RDPasswd(&password,this); if(user_password_dialog->exec(&password)==0) {
if(passwd->exec()==0) {
user_user->setPassword(password); user_user->setPassword(password);
} }
delete passwd;
} }

View File

@ -29,6 +29,7 @@
#include <qspinbox.h> #include <qspinbox.h>
#include <rddialog.h> #include <rddialog.h>
#include <rdpasswd.h>
#include <rduser.h> #include <rduser.h>
class EditUser : public RDDialog class EditUser : public RDDialog
@ -53,6 +54,7 @@ class EditUser : public RDDialog
void cancelData(); void cancelData();
private: private:
RDPasswd *user_password_dialog;
QLineEdit *user_name_edit; QLineEdit *user_name_edit;
QLineEdit *user_full_name_edit; QLineEdit *user_full_name_edit;
QLineEdit *user_email_address_edit; QLineEdit *user_email_address_edit;