1 /**************************************************************************
2 *   Copyright (C) 2005-2020 by Oleksandr Shneyder                         *
3 *                              <o.shneyder@phoca-gmbh.de>                 *
4 *                                                                         *
5 *   This program is free software; you can redistribute it and/or modify  *
6 *   it under the terms of the GNU General Public License as published by  *
7 *   the Free Software Foundation; either version 2 of the License, or     *
8 *   (at your option) any later version.                                   *
9 *   This program is distributed in the hope that it will be useful,       *
10 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12 *   GNU General Public License for more details.                          *
13 *                                                                         *
14 *   You should have received a copy of the GNU General Public License     *
15 *   along with this program.  If not, see <https://www.gnu.org/licenses/>. *
16 ***************************************************************************/
17 
18 #include "brokerpassdlg.h"
19 #include <QPushButton>
20 
BrokerPassDlg(QWidget * parent,Qt::WindowFlags f)21 BrokerPassDlg::BrokerPassDlg(QWidget* parent, Qt::WindowFlags f): QDialog(parent, f)
22 {
23     setupUi(this);
24     statusLabel->setText(QString::null);
25     buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
26 }
27 
~BrokerPassDlg()28 BrokerPassDlg::~BrokerPassDlg()
29 {
30 
31 }
32 
slotPassChanged()33 void BrokerPassDlg::slotPassChanged()
34 {
35     bool passEq=false;
36     if (lePass1->text()!=lePass2->text())
37     {
38         passEq=false;
39         statusLabel->setText(tr("Passwords do not match"));
40     }
41     else
42     {
43         passEq=true;
44         statusLabel->setText(QString::null);
45     }
46     buttonBox->button(QDialogButtonBox::Ok)->setEnabled(passEq &&
47             lePass1->text().size()>0 &&
48             leOldPas->text().size()>0);
49 }
50 
accept()51 void BrokerPassDlg::accept()
52 {
53     QDialog::accept();
54 }
55 
reject()56 void BrokerPassDlg::reject()
57 {
58     QDialog::reject();
59 }
60 
newPass()61 QString BrokerPassDlg::newPass()
62 {
63     return lePass1->text();
64 }
65 
oldPass()66 QString BrokerPassDlg::oldPass()
67 {
68     return leOldPas->text();
69 }
70