summaryrefslogtreecommitdiffabout
path: root/pwmanager
authorulf69 <ulf69>2004-09-25 01:22:55 (UTC)
committer ulf69 <ulf69>2004-09-25 01:22:55 (UTC)
commit57c00cdf5002e90603e0e1cfb5ac5c2c8bf19fe7 (patch) (unidiff)
tree4c20dcb83f6f107e3d2458ec9d25d2df2ca01110 /pwmanager
parent1a3db02f855f800898f617e3318f98c8c65d6dbb (diff)
downloadkdepimpi-57c00cdf5002e90603e0e1cfb5ac5c2c8bf19fe7.zip
kdepimpi-57c00cdf5002e90603e0e1cfb5ac5c2c8bf19fe7.tar.gz
kdepimpi-57c00cdf5002e90603e0e1cfb5ac5c2c8bf19fe7.tar.bz2
*** empty log message ***
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/getmasterpwwnd_emb.cpp112
-rw-r--r--pwmanager/pwmanager/getmasterpwwnd_emb.h16
-rw-r--r--pwmanager/pwmanager/listviewpwm.cpp17
3 files changed, 143 insertions, 2 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
@@ -17,70 +17,180 @@
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#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>
35#include <qtooltip.h> 36#include <qtooltip.h>
36#include <qwhatsthis.h> 37#include <qwhatsthis.h>
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 */
48getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) 50getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name)
49 : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ), 51 : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ),
50 KDialogBase::Ok | KDialogBase::Cancel, 52 KDialogBase::Ok | KDialogBase::Cancel,
51 KDialogBase::Ok, parent, name, true ) 53 KDialogBase::Ok, parent, name, true )
52{ 54{
53 QWidget *page = plainPage(); 55 QWidget *page = plainPage();
54 QVBoxLayout *pageLayout = new QVBoxLayout( page ); 56 QVBoxLayout *pageLayout = new QVBoxLayout( page );
55 57
56 pwLineEdit = new QLineEdit( page, "pwLineEdit" ); 58 pwLineEdit = new QLineEdit( page, "pwLineEdit" );
57 pwLineEdit->setEchoMode( QLineEdit::Password ); 59 pwLineEdit->setEchoMode( QLineEdit::Password );
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 */
72getMasterPwWnd::~getMasterPwWnd() 124getMasterPwWnd::~getMasterPwWnd()
73{ 125{
74 // no need to delete child widgets, Qt does it all for us 126 // no need to delete child widgets, Qt does it all for us
75} 127}
76 128
77void getMasterPwWnd::okButton_slot() 129void getMasterPwWnd::okButton_slot()
78{ 130{
79 qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" ); 131 qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" );
80} 132}
81 133
82void getMasterPwWnd::cancelButton_slot() 134void 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
139void getMasterPwWnd::add0()
140{
141 addCharacter("0");
142}
143void getMasterPwWnd::add1()
144{
145 addCharacter("1");
146}
147void getMasterPwWnd::add2()
148{
149 addCharacter("2");
150}
151void getMasterPwWnd::add3()
152{
153 addCharacter("3");
154}
155void getMasterPwWnd::add4()
156{
157 addCharacter("4");
158}
159void getMasterPwWnd::add5()
160{
161 addCharacter("5");
162}
163void getMasterPwWnd::add6()
164{
165 addCharacter("6");
166}
167void getMasterPwWnd::add7()
168{
169 addCharacter("7");
170}
171void getMasterPwWnd::add8()
172{
173 addCharacter("8");
174}
175void getMasterPwWnd::add9()
176{
177 addCharacter("9");
178}
179void getMasterPwWnd::backspace()
180{
181 QString old = pwLineEdit->text();
182 old.truncate(old.length()-1);
183 pwLineEdit->setText(old);
184}
185
186void getMasterPwWnd::clear()
187{
188 pwLineEdit->setText("");
189}
190
191void getMasterPwWnd::addCharacter(const QString& s)
192{
193 QString old = pwLineEdit->text();
194 pwLineEdit->setText(old + s);
195}
196
diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.h b/pwmanager/pwmanager/getmasterpwwnd_emb.h
index 64121c4..90204d3 100644
--- a/pwmanager/pwmanager/getmasterpwwnd_emb.h
+++ b/pwmanager/pwmanager/getmasterpwwnd_emb.h
@@ -34,15 +34,31 @@ class getMasterPwWnd : public KDialogBase
34{ 34{
35 Q_OBJECT 35 Q_OBJECT
36 36
37public: 37public:
38 getMasterPwWnd( QWidget* parent = 0, const char* name = 0); 38 getMasterPwWnd( QWidget* parent = 0, const char* name = 0);
39 ~getMasterPwWnd(); 39 ~getMasterPwWnd();
40 40
41 QLineEdit* pwLineEdit; 41 QLineEdit* pwLineEdit;
42 42
43public slots: 43public slots:
44 virtual void okButton_slot(); 44 virtual void okButton_slot();
45 virtual void cancelButton_slot(); 45 virtual void cancelButton_slot();
46
47 void add0();
48 void add1();
49 void add2();
50 void add3();
51 void add4();
52 void add5();
53 void add6();
54 void add7();
55 void add8();
56 void add9();
57 void backspace();
58 void clear();
59
60 private:
61 void addCharacter(const QString &s);
46}; 62};
47 63
48#endif // GETMASTERPWWND_H 64#endif // GETMASTERPWWND_H
diff --git a/pwmanager/pwmanager/listviewpwm.cpp b/pwmanager/pwmanager/listviewpwm.cpp
index c53cfd7..9f351d6 100644
--- a/pwmanager/pwmanager/listviewpwm.cpp
+++ b/pwmanager/pwmanager/listviewpwm.cpp
@@ -10,24 +10,25 @@
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "listviewpwm.h" 20#include "listviewpwm.h"
21#include "pwmexception.h" 21#include "pwmexception.h"
22#include "pwmview.h"
22 23
23#include <qpainter.h> 24#include <qpainter.h>
24#include <qpixmap.h> 25#include <qpixmap.h>
25 26
26#include <kiconloader.h> 27#include <kiconloader.h>
27 28
28#ifdef PWM_EMBEDDED 29#ifdef PWM_EMBEDDED
29#include <kglobal.h> 30#include <kglobal.h>
30#endif 31#endif
31 32
32ListViewPwM::ListViewPwM(QWidget *parent, const char *name) 33ListViewPwM::ListViewPwM(QWidget *parent, const char *name)
33 : KListView(parent, name) 34 : KListView(parent, name)
@@ -51,47 +52,61 @@ ListViewItemPwM::ListViewItemPwM(QListView *parent)
51{ 52{
52 if (!onPix) { 53 if (!onPix) {
53 PWM_ASSERT(!offPix); 54 PWM_ASSERT(!offPix);
54 KIconLoader* picons; 55 KIconLoader* picons;
55#ifndef PWM_EMBEDDED 56#ifndef PWM_EMBEDDED
56 KIconLoader il; 57 KIconLoader il;
57 picons = &il; 58 picons = &il;
58#else 59#else
59 picons = KGlobal::iconLoader(); 60 picons = KGlobal::iconLoader();
60#endif 61#endif
61 62
62 KIconLoader il; 63 KIconLoader il;
64#ifndef PWM_EMBEDDED
63 static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small)); 65 static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small));
66#else
67 static QPixmap onP(picons->loadIcon("decrypted", KIcon::Small));
68#endif
64 onPix = &onP; 69 onPix = &onP;
65 static QPixmap offP(picons->loadIcon("encrypted", KIcon::Small)); 70 static QPixmap offP(picons->loadIcon("encrypted", KIcon::Small));
66 offPix = &offP; 71 offPix = &offP;
67 } 72 }
68} 73}
69 74
70void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg, 75void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg,
71 int column, int width, int align) 76 int column, int width, int align)
72{ 77{
78 // qDebug("ListViewItemPwM::paintCell column=%i", column);
73 if (!p) 79 if (!p)
74 return; 80 return;
75 if (column != 0) { 81 //US BUG:
82 if (column != COLUMN_DESC) {
76 QCheckListItem::paintCell(p, cg, column, width, align); 83 QCheckListItem::paintCell(p, cg, column, width, align);
77 return; 84 return;
78 } 85 }
79 QPixmap *curPix = isOn() ? onPix : offPix; 86 QPixmap *curPix = isOn() ? onPix : offPix;
80 int pixSpace = curPix->width(); 87 int pixSpace = curPix->width();
81 pixSpace += 4; 88 pixSpace += 4;
82#ifndef PWM_EMBEDDED 89#ifndef PWM_EMBEDDED
83 QRect window(p->viewport()); 90 QRect window(p->viewport());
84 // clear the rectangle (we have to clear it first. see QT doc) 91 // clear the rectangle (we have to clear it first. see QT doc)
85 p->eraseRect(0, 0, pixSpace, window.height()); 92 p->eraseRect(0, 0, pixSpace, window.height());
86 // now draw the pixmap 93 // now draw the pixmap
87 int y = (height() - curPix->height()) / 2; 94 int y = (height() - curPix->height()) / 2;
88 p->drawPixmap(1, y, *curPix); 95 p->drawPixmap(1, y, *curPix);
89 window.moveLeft(pixSpace); 96 window.moveLeft(pixSpace);
90 p->setViewport(window); 97 p->setViewport(window);
98#else
99 p->eraseRect(0, 0, pixSpace, height());
100 // now draw the pixmap
101 int y = (height() - curPix->height()) / 2;
102 p->drawPixmap(1, y, *curPix);
103 p->translate( pixSpace, 0 );
104
91#endif 105#endif
92 QListViewItem::paintCell(p, cg, column, width - pixSpace, align); 106 QListViewItem::paintCell(p, cg, column, width - pixSpace, align);
107
93} 108}
94 109
95#ifndef PWM_EMBEDDED 110#ifndef PWM_EMBEDDED
96#include "listviewpwm.moc" 111#include "listviewpwm.moc"
97#endif 112#endif