blob: d6fbb5a5b9347d1990c60a86922c805892a0082a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#include <QtGui>
#include "rootpwd.h"
#include "../listdelegate.h"
#include "../listitem.h"
wpRootPwd::wpRootPwd(QWidget *parent) : QWizardPage(parent)
{
setupUi(this);
connect(password, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
connect(retypePassword, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
backend = Backend::instance();
updateStatus();
}
void wpRootPwd::initializePage()
{
}
void wpRootPwd::updateStatus()
{
QString pw1 = password->text();
QString pw2 = retypePassword->text();
passwordStatus->setPixmap(QPixmap());
retypePasswordStatus->setPixmap(QPixmap());
complete = true;
if(!pw1.length())
{
passwordStatus->setToolTip(tr("Please enter a password!"));
passwordStatus->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(24,24));
complete = false;
}
else if(pw1.length() < 6)
{
passwordStatus->setToolTip(tr("Password must have at least 6 characters!"));
passwordStatus->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(24,24));
complete = false;
}
else
{
passwordStatus->setToolTip(tr("Password OK"));
passwordStatus->setPixmap(QIcon::fromTheme("dialog-ok").pixmap(24,24));
if(pw1 != pw2)
{
retypePasswordStatus->setToolTip(tr("Passwords don't match!"));
retypePasswordStatus->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(24,24));
complete = false;
}
else
{
retypePasswordStatus->setToolTip(tr("Password OK"));
retypePasswordStatus->setPixmap(QIcon::fromTheme("dialog-ok").pixmap(24,24));
}
}
emit completeChanged();
}
bool wpRootPwd::isComplete() const
{
return complete;
}
bool wpRootPwd::validatePage()
{
if(!complete) return false;
backend->cfg("rootpwd", backend->encryptPassword(password->text()));
return true;
}
|