summaryrefslogtreecommitdiffabout
path: root/pwmanager
authorzautrix <zautrix>2004-10-21 22:20:39 (UTC)
committer zautrix <zautrix>2004-10-21 22:20:39 (UTC)
commitd6f9bd535e8cabe653bdff329500f9153e5e11fb (patch) (unidiff)
tree6f83c692713c41896a165e399f259a744f125e5c /pwmanager
parentbb235c5a639b914574e1e247d2de6e479517585f (diff)
downloadkdepimpi-d6f9bd535e8cabe653bdff329500f9153e5e11fb.zip
kdepimpi-d6f9bd535e8cabe653bdff329500f9153e5e11fb.tar.gz
kdepimpi-d6f9bd535e8cabe653bdff329500f9153e5e11fb.tar.bz2
small fixes
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/getmasterpwwnd_emb.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
index 8b6dfbc..8404c3e 100644
--- a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
+++ b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
@@ -1,201 +1,208 @@
1/* 1/*
2 This file is part of PwManager/Platform independent. 2 This file is part of PwManager/Platform independent.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22 22
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/*
31#include <qvariant.h> 31#include <qvariant.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qlineedit.h> 34#include <qlineedit.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qtooltip.h> 36#include <qtooltip.h>
37#include <qwhatsthis.h> 37#include <qwhatsthis.h>
38*/ 38*/
39 39
40#include <qwidget.h> 40#include <qwidget.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qlineedit.h> 43#include <qlineedit.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qapplication.h>
45 46
46/* 47/*
47 * Constructs a getMasterPwWnd as a child of 'parent', with the 48 * Constructs a getMasterPwWnd as a child of 'parent', with the
48 * name 'name' 49 * name 'name'
49 */ 50 */
50getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) 51getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name)
51 : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ), 52 : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ),
52 KDialogBase::Ok | KDialogBase::Cancel, 53 KDialogBase::Ok | KDialogBase::Cancel,
53 KDialogBase::Ok, parent, name, true ) 54 KDialogBase::Ok, parent, name, true )
54{ 55{
55 QWidget *page = plainPage(); 56 QWidget *page = plainPage();
56 QVBoxLayout *pageLayout = new QVBoxLayout( page ); 57 QVBoxLayout *pageLayout = new QVBoxLayout( page );
57 58
58 pwLineEdit = new QLineEdit( page, "pwLineEdit" ); 59 pwLineEdit = new QLineEdit( page, "pwLineEdit" );
59 pwLineEdit->setEchoMode( QLineEdit::Password ); 60 pwLineEdit->setEchoMode( QLineEdit::Password );
60 61
61 QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); 62 QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" );
62 textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); 63 textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) );
63 pageLayout->addWidget(textLabel1); 64 pageLayout->addWidget(textLabel1);
64 pageLayout->addWidget(pwLineEdit); 65 pageLayout->addWidget(pwLineEdit);
65 66
66 QWidget* numberBox = new QWidget( page ); 67 QWidget* numberBox = new QWidget( page );
67#ifndef DESKTOP_VERSION 68#ifndef DESKTOP_VERSION
68 numberBox->setFixedHeight(150); 69 if ( QApplication::desktop()->width() > 320 ) {
69 numberBox->setFixedWidth(150); 70 numberBox->setFixedHeight(250);
71 numberBox->setFixedWidth(200);
72 }
73 else{
74 numberBox->setFixedHeight(150);
75 numberBox->setFixedWidth(150);
76 }
70#endif 77#endif
71 78
72 QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 ); 79 QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 );
73 numberLayout->setMargin( 0 ); 80 numberLayout->setMargin( 0 );
74 numberLayout->setSpacing( 0 ); 81 numberLayout->setSpacing( 0 );
75 82
76 QPushButton* p1 = new QPushButton( i18n("1"), numberBox ); 83 QPushButton* p1 = new QPushButton( i18n("1"), numberBox );
77 numberLayout->addWidget( p1, 0, 0 ); 84 numberLayout->addWidget( p1, 0, 0 );
78 QPushButton* p2 = new QPushButton( i18n("2"), numberBox ); 85 QPushButton* p2 = new QPushButton( i18n("2"), numberBox );
79 numberLayout->addWidget( p2, 0, 1 ); 86 numberLayout->addWidget( p2, 0, 1 );
80 QPushButton* p3 = new QPushButton( i18n("3"), numberBox ); 87 QPushButton* p3 = new QPushButton( i18n("3"), numberBox );
81 numberLayout->addWidget( p3, 0, 2 ); 88 numberLayout->addWidget( p3, 0, 2 );
82 QPushButton* p4 = new QPushButton( i18n("4"), numberBox ); 89 QPushButton* p4 = new QPushButton( i18n("4"), numberBox );
83 numberLayout->addWidget( p4, 1, 0 ); 90 numberLayout->addWidget( p4, 1, 0 );
84 QPushButton* p5 = new QPushButton( i18n("5"), numberBox ); 91 QPushButton* p5 = new QPushButton( i18n("5"), numberBox );
85 numberLayout->addWidget( p5, 1, 1 ); 92 numberLayout->addWidget( p5, 1, 1 );
86 QPushButton* p6 = new QPushButton( i18n("6"), numberBox ); 93 QPushButton* p6 = new QPushButton( i18n("6"), numberBox );
87 numberLayout->addWidget( p6, 1, 2 ); 94 numberLayout->addWidget( p6, 1, 2 );
88 QPushButton* p7 = new QPushButton( i18n("7"), numberBox ); 95 QPushButton* p7 = new QPushButton( i18n("7"), numberBox );
89 numberLayout->addWidget( p7, 2, 0 ); 96 numberLayout->addWidget( p7, 2, 0 );
90 QPushButton* p8 = new QPushButton( i18n("8"), numberBox ); 97 QPushButton* p8 = new QPushButton( i18n("8"), numberBox );
91 numberLayout->addWidget( p8, 2, 1 ); 98 numberLayout->addWidget( p8, 2, 1 );
92 QPushButton* p9 = new QPushButton( i18n("9"), numberBox ); 99 QPushButton* p9 = new QPushButton( i18n("9"), numberBox );
93 numberLayout->addWidget( p9, 2, 2 ); 100 numberLayout->addWidget( p9, 2, 2 );
94 QPushButton* clear = new QPushButton( i18n("x"), numberBox ); 101 QPushButton* clear = new QPushButton( i18n("x"), numberBox );
95 numberLayout->addWidget( clear, 3, 0 ); 102 numberLayout->addWidget( clear, 3, 0 );
96 QPushButton* p0 = new QPushButton( i18n("0"), numberBox ); 103 QPushButton* p0 = new QPushButton( i18n("0"), numberBox );
97 numberLayout->addWidget( p0, 3, 1 ); 104 numberLayout->addWidget( p0, 3, 1 );
98 QPushButton* backspace = new QPushButton( i18n("-"), numberBox ); 105 QPushButton* backspace = new QPushButton( i18n("-"), numberBox );
99 numberLayout->addWidget( backspace, 3, 2 ); 106 numberLayout->addWidget( backspace, 3, 2 );
100 107
101 108
102 pageLayout->addWidget(numberBox); 109 pageLayout->addWidget(numberBox);
103#ifdef DESKTOP_VERSION 110#ifdef DESKTOP_VERSION
104 resize( sizeHint() ); 111 resize( sizeHint() );
105#else 112#else
106 resize( 200,sizeHint().height() ); 113 resize( 200,sizeHint().height() );
107#endif 114#endif
108 115
109 connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) ); 116 connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) );
110 connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) ); 117 connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) );
111 connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) ); 118 connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) );
112 connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) ); 119 connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) );
113 connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) ); 120 connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) );
114 connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) ); 121 connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) );
115 connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) ); 122 connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) );
116 connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) ); 123 connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) );
117 connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) ); 124 connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) );
118 connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) ); 125 connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) );
119 connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) ); 126 connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) );
120 connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); 127 connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) );
121 128
122 129
123 130
124} 131}
125 132
126/* 133/*
127 * Destroys the object and frees any allocated resources 134 * Destroys the object and frees any allocated resources
128 */ 135 */
129getMasterPwWnd::~getMasterPwWnd() 136getMasterPwWnd::~getMasterPwWnd()
130{ 137{
131 // no need to delete child widgets, Qt does it all for us 138 // no need to delete child widgets, Qt does it all for us
132} 139}
133 140
134void getMasterPwWnd::okButton_slot() 141void getMasterPwWnd::okButton_slot()
135{ 142{
136 qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" ); 143 qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" );
137} 144}
138 145
139void getMasterPwWnd::cancelButton_slot() 146void getMasterPwWnd::cancelButton_slot()
140{ 147{
141 qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); 148 qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" );
142} 149}
143 150
144void getMasterPwWnd::add0() 151void getMasterPwWnd::add0()
145{ 152{
146 addCharacter("0"); 153 addCharacter("0");
147} 154}
148void getMasterPwWnd::add1() 155void getMasterPwWnd::add1()
149{ 156{
150 addCharacter("1"); 157 addCharacter("1");
151} 158}
152void getMasterPwWnd::add2() 159void getMasterPwWnd::add2()
153{ 160{
154 addCharacter("2"); 161 addCharacter("2");
155} 162}
156void getMasterPwWnd::add3() 163void getMasterPwWnd::add3()
157{ 164{
158 addCharacter("3"); 165 addCharacter("3");
159} 166}
160void getMasterPwWnd::add4() 167void getMasterPwWnd::add4()
161{ 168{
162 addCharacter("4"); 169 addCharacter("4");
163} 170}
164void getMasterPwWnd::add5() 171void getMasterPwWnd::add5()
165{ 172{
166 addCharacter("5"); 173 addCharacter("5");
167} 174}
168void getMasterPwWnd::add6() 175void getMasterPwWnd::add6()
169{ 176{
170 addCharacter("6"); 177 addCharacter("6");
171} 178}
172void getMasterPwWnd::add7() 179void getMasterPwWnd::add7()
173{ 180{
174 addCharacter("7"); 181 addCharacter("7");
175} 182}
176void getMasterPwWnd::add8() 183void getMasterPwWnd::add8()
177{ 184{
178 addCharacter("8"); 185 addCharacter("8");
179} 186}
180void getMasterPwWnd::add9() 187void getMasterPwWnd::add9()
181{ 188{
182 addCharacter("9"); 189 addCharacter("9");
183} 190}
184void getMasterPwWnd::backspace() 191void getMasterPwWnd::backspace()
185{ 192{
186 QString old = pwLineEdit->text(); 193 QString old = pwLineEdit->text();
187 old.truncate(old.length()-1); 194 old.truncate(old.length()-1);
188 pwLineEdit->setText(old); 195 pwLineEdit->setText(old);
189} 196}
190 197
191void getMasterPwWnd::clear() 198void getMasterPwWnd::clear()
192{ 199{
193 pwLineEdit->setText(""); 200 pwLineEdit->setText("");
194} 201}
195 202
196void getMasterPwWnd::addCharacter(const QString& s) 203void getMasterPwWnd::addCharacter(const QString& s)
197{ 204{
198 QString old = pwLineEdit->text(); 205 QString old = pwLineEdit->text();
199 pwLineEdit->setText(old + s); 206 pwLineEdit->setText(old + s);
200} 207}
201 208