-rw-r--r-- | pwmanager/pwmanager/getmasterpwwnd_emb.cpp | 112 | ||||
-rw-r--r-- | pwmanager/pwmanager/getmasterpwwnd_emb.h | 16 | ||||
-rw-r--r-- | pwmanager/pwmanager/listviewpwm.cpp | 17 |
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 | |||
@@ -25,8 +25,9 @@ $Id$ | |||
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> |
@@ -39,8 +40,9 @@ $Id$ | |||
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' |
@@ -60,10 +62,60 @@ getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) | |||
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 | /* |
@@ -83,4 +135,62 @@ 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 | |||
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 | |||
@@ -42,7 +42,23 @@ public: | |||
42 | 42 | ||
43 | public slots: | 43 | public 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 | |||
@@ -18,8 +18,9 @@ | |||
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 | ||
@@ -59,9 +60,13 @@ ListViewItemPwM::ListViewItemPwM(QListView *parent) | |||
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 | } |
@@ -69,11 +74,13 @@ ListViewItemPwM::ListViewItemPwM(QListView *parent) | |||
69 | 74 | ||
70 | void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg, | 75 | void 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; |
@@ -87,10 +94,18 @@ void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg, | |||
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" |