Diffstat (limited to 'pwmanager/pwmanager/getmasterpwwnd_emb.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/getmasterpwwnd_emb.cpp | 112 |
1 files changed, 111 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp index 3519de8..ff4c28a 100644 --- a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp +++ b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp | |||
@@ -23,12 +23,13 @@ | |||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "getmasterpwwnd_emb.h" | 26 | #include "getmasterpwwnd_emb.h" |
27 | 27 | ||
28 | #include "klocale.h" | 28 | #include "klocale.h" |
29 | |||
29 | /* | 30 | /* |
30 | #include <qvariant.h> | 31 | #include <qvariant.h> |
31 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
32 | #include <qlabel.h> | 33 | #include <qlabel.h> |
33 | #include <qlineedit.h> | 34 | #include <qlineedit.h> |
34 | #include <qlayout.h> | 35 | #include <qlayout.h> |
@@ -37,12 +38,13 @@ $Id$ | |||
37 | */ | 38 | */ |
38 | 39 | ||
39 | #include <qwidget.h> | 40 | #include <qwidget.h> |
40 | #include <qlayout.h> | 41 | #include <qlayout.h> |
41 | #include <qlabel.h> | 42 | #include <qlabel.h> |
42 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
44 | #include <qpushbutton.h> | ||
43 | 45 | ||
44 | /* | 46 | /* |
45 | * Constructs a getMasterPwWnd as a child of 'parent', with the | 47 | * Constructs a getMasterPwWnd as a child of 'parent', with the |
46 | * name 'name' | 48 | * name 'name' |
47 | */ | 49 | */ |
48 | getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) | 50 | getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) |
@@ -58,14 +60,64 @@ getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) | |||
58 | 60 | ||
59 | QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); | 61 | QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); |
60 | textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); | 62 | textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); |
61 | pageLayout->addWidget(textLabel1); | 63 | pageLayout->addWidget(textLabel1); |
62 | pageLayout->addWidget(pwLineEdit); | 64 | pageLayout->addWidget(pwLineEdit); |
63 | 65 | ||
66 | QWidget* numberBox = new QWidget( page ); | ||
67 | numberBox->setFixedHeight(100); | ||
68 | numberBox->setFixedWidth(100); | ||
69 | |||
70 | QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 ); | ||
71 | numberLayout->setMargin( 0 ); | ||
72 | numberLayout->setSpacing( 0 ); | ||
73 | |||
74 | QPushButton* p1 = new QPushButton( i18n("1"), numberBox ); | ||
75 | numberLayout->addWidget( p1, 0, 0 ); | ||
76 | QPushButton* p2 = new QPushButton( i18n("2"), numberBox ); | ||
77 | numberLayout->addWidget( p2, 0, 1 ); | ||
78 | QPushButton* p3 = new QPushButton( i18n("3"), numberBox ); | ||
79 | numberLayout->addWidget( p3, 0, 2 ); | ||
80 | QPushButton* p4 = new QPushButton( i18n("4"), numberBox ); | ||
81 | numberLayout->addWidget( p4, 1, 0 ); | ||
82 | QPushButton* p5 = new QPushButton( i18n("5"), numberBox ); | ||
83 | numberLayout->addWidget( p5, 1, 1 ); | ||
84 | QPushButton* p6 = new QPushButton( i18n("6"), numberBox ); | ||
85 | numberLayout->addWidget( p6, 1, 2 ); | ||
86 | QPushButton* p7 = new QPushButton( i18n("7"), numberBox ); | ||
87 | numberLayout->addWidget( p7, 2, 0 ); | ||
88 | QPushButton* p8 = new QPushButton( i18n("8"), numberBox ); | ||
89 | numberLayout->addWidget( p8, 2, 1 ); | ||
90 | QPushButton* p9 = new QPushButton( i18n("9"), numberBox ); | ||
91 | numberLayout->addWidget( p9, 2, 2 ); | ||
92 | QPushButton* clear = new QPushButton( i18n("x"), numberBox ); | ||
93 | numberLayout->addWidget( clear, 3, 0 ); | ||
94 | QPushButton* p0 = new QPushButton( i18n("0"), numberBox ); | ||
95 | numberLayout->addWidget( p0, 3, 1 ); | ||
96 | QPushButton* backspace = new QPushButton( i18n("-"), numberBox ); | ||
97 | numberLayout->addWidget( backspace, 3, 2 ); | ||
98 | |||
99 | |||
100 | pageLayout->addWidget(numberBox); | ||
101 | |||
102 | resize( QSize(200, 180) ); | ||
103 | |||
104 | connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) ); | ||
105 | connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) ); | ||
106 | connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) ); | ||
107 | connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) ); | ||
108 | connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) ); | ||
109 | connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) ); | ||
110 | connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) ); | ||
111 | connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) ); | ||
112 | connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) ); | ||
113 | connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) ); | ||
114 | connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) ); | ||
115 | connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); | ||
116 | |||
64 | 117 | ||
65 | resize( QSize(200, 100) ); | ||
66 | 118 | ||
67 | } | 119 | } |
68 | 120 | ||
69 | /* | 121 | /* |
70 | * Destroys the object and frees any allocated resources | 122 | * Destroys the object and frees any allocated resources |
71 | */ | 123 | */ |
@@ -81,6 +133,64 @@ void getMasterPwWnd::okButton_slot() | |||
81 | 133 | ||
82 | void getMasterPwWnd::cancelButton_slot() | 134 | void getMasterPwWnd::cancelButton_slot() |
83 | { | 135 | { |
84 | qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); | 136 | qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); |
85 | } | 137 | } |
86 | 138 | ||
139 | void getMasterPwWnd::add0() | ||
140 | { | ||
141 | addCharacter("0"); | ||
142 | } | ||
143 | void getMasterPwWnd::add1() | ||
144 | { | ||
145 | addCharacter("1"); | ||
146 | } | ||
147 | void getMasterPwWnd::add2() | ||
148 | { | ||
149 | addCharacter("2"); | ||
150 | } | ||
151 | void getMasterPwWnd::add3() | ||
152 | { | ||
153 | addCharacter("3"); | ||
154 | } | ||
155 | void getMasterPwWnd::add4() | ||
156 | { | ||
157 | addCharacter("4"); | ||
158 | } | ||
159 | void getMasterPwWnd::add5() | ||
160 | { | ||
161 | addCharacter("5"); | ||
162 | } | ||
163 | void getMasterPwWnd::add6() | ||
164 | { | ||
165 | addCharacter("6"); | ||
166 | } | ||
167 | void getMasterPwWnd::add7() | ||
168 | { | ||
169 | addCharacter("7"); | ||
170 | } | ||
171 | void getMasterPwWnd::add8() | ||
172 | { | ||
173 | addCharacter("8"); | ||
174 | } | ||
175 | void getMasterPwWnd::add9() | ||
176 | { | ||
177 | addCharacter("9"); | ||
178 | } | ||
179 | void getMasterPwWnd::backspace() | ||
180 | { | ||
181 | QString old = pwLineEdit->text(); | ||
182 | old.truncate(old.length()-1); | ||
183 | pwLineEdit->setText(old); | ||
184 | } | ||
185 | |||
186 | void getMasterPwWnd::clear() | ||
187 | { | ||
188 | pwLineEdit->setText(""); | ||
189 | } | ||
190 | |||
191 | void getMasterPwWnd::addCharacter(const QString& s) | ||
192 | { | ||
193 | QString old = pwLineEdit->text(); | ||
194 | pwLineEdit->setText(old + s); | ||
195 | } | ||
196 | |||