summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (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
@@ -1,86 +1,196 @@
/*
This file is part of PwManager/Platform independent.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#include "getmasterpwwnd_emb.h"
#include "klocale.h"
+
/*
#include <qvariant.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
*/
#include <qwidget.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qlineedit.h>
+#include <qpushbutton.h>
/*
* Constructs a getMasterPwWnd as a child of 'parent', with the
* name 'name'
*/
getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name)
: KDialogBase( KDialogBase::Plain, i18n( "Master-password" ),
KDialogBase::Ok | KDialogBase::Cancel,
KDialogBase::Ok, parent, name, true )
{
QWidget *page = plainPage();
QVBoxLayout *pageLayout = new QVBoxLayout( page );
pwLineEdit = new QLineEdit( page, "pwLineEdit" );
pwLineEdit->setEchoMode( QLineEdit::Password );
QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" );
textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) );
pageLayout->addWidget(textLabel1);
pageLayout->addWidget(pwLineEdit);
+ QWidget* numberBox = new QWidget( page );
+ numberBox->setFixedHeight(100);
+ numberBox->setFixedWidth(100);
+
+ QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 );
+ numberLayout->setMargin( 0 );
+ numberLayout->setSpacing( 0 );
+
+ QPushButton* p1 = new QPushButton( i18n("1"), numberBox );
+ numberLayout->addWidget( p1, 0, 0 );
+ QPushButton* p2 = new QPushButton( i18n("2"), numberBox );
+ numberLayout->addWidget( p2, 0, 1 );
+ QPushButton* p3 = new QPushButton( i18n("3"), numberBox );
+ numberLayout->addWidget( p3, 0, 2 );
+ QPushButton* p4 = new QPushButton( i18n("4"), numberBox );
+ numberLayout->addWidget( p4, 1, 0 );
+ QPushButton* p5 = new QPushButton( i18n("5"), numberBox );
+ numberLayout->addWidget( p5, 1, 1 );
+ QPushButton* p6 = new QPushButton( i18n("6"), numberBox );
+ numberLayout->addWidget( p6, 1, 2 );
+ QPushButton* p7 = new QPushButton( i18n("7"), numberBox );
+ numberLayout->addWidget( p7, 2, 0 );
+ QPushButton* p8 = new QPushButton( i18n("8"), numberBox );
+ numberLayout->addWidget( p8, 2, 1 );
+ QPushButton* p9 = new QPushButton( i18n("9"), numberBox );
+ numberLayout->addWidget( p9, 2, 2 );
+ QPushButton* clear = new QPushButton( i18n("x"), numberBox );
+ numberLayout->addWidget( clear, 3, 0 );
+ QPushButton* p0 = new QPushButton( i18n("0"), numberBox );
+ numberLayout->addWidget( p0, 3, 1 );
+ QPushButton* backspace = new QPushButton( i18n("-"), numberBox );
+ numberLayout->addWidget( backspace, 3, 2 );
+
+
+ pageLayout->addWidget(numberBox);
+
+ resize( QSize(200, 180) );
+
+ connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) );
+ connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) );
+ connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) );
+ connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) );
+ connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) );
+ connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) );
+ connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) );
+ connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) );
+ connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) );
+ connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) );
+ connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) );
+ connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) );
+
- resize( QSize(200, 100) );
}
/*
* Destroys the object and frees any allocated resources
*/
getMasterPwWnd::~getMasterPwWnd()
{
// no need to delete child widgets, Qt does it all for us
}
void getMasterPwWnd::okButton_slot()
{
qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" );
}
void getMasterPwWnd::cancelButton_slot()
{
qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" );
}
+void getMasterPwWnd::add0()
+{
+ addCharacter("0");
+}
+void getMasterPwWnd::add1()
+{
+ addCharacter("1");
+}
+void getMasterPwWnd::add2()
+{
+ addCharacter("2");
+}
+void getMasterPwWnd::add3()
+{
+ addCharacter("3");
+}
+void getMasterPwWnd::add4()
+{
+ addCharacter("4");
+}
+void getMasterPwWnd::add5()
+{
+ addCharacter("5");
+}
+void getMasterPwWnd::add6()
+{
+ addCharacter("6");
+}
+void getMasterPwWnd::add7()
+{
+ addCharacter("7");
+}
+void getMasterPwWnd::add8()
+{
+ addCharacter("8");
+}
+void getMasterPwWnd::add9()
+{
+ addCharacter("9");
+}
+void getMasterPwWnd::backspace()
+{
+ QString old = pwLineEdit->text();
+ old.truncate(old.length()-1);
+ pwLineEdit->setText(old);
+}
+
+void getMasterPwWnd::clear()
+{
+ pwLineEdit->setText("");
+}
+
+void getMasterPwWnd::addCharacter(const QString& s)
+{
+ QString old = pwLineEdit->text();
+ pwLineEdit->setText(old + s);
+}
+
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
@@ -1,48 +1,64 @@
/*
This file is part of PwManager/Platform independent.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#ifndef GETMASTERPWWND_EMB_H
#define GETMASTERPWWND_EMB_H
#include <kdialogbase.h>
class QLineEdit;
class getMasterPwWnd : public KDialogBase
{
Q_OBJECT
public:
getMasterPwWnd( QWidget* parent = 0, const char* name = 0);
~getMasterPwWnd();
QLineEdit* pwLineEdit;
public slots:
virtual void okButton_slot();
virtual void cancelButton_slot();
+
+ void add0();
+ void add1();
+ void add2();
+ void add3();
+ void add4();
+ void add5();
+ void add6();
+ void add7();
+ void add8();
+ void add9();
+ void backspace();
+ void clear();
+
+ private:
+ void addCharacter(const QString &s);
};
#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
@@ -1,97 +1,112 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "listviewpwm.h"
#include "pwmexception.h"
+#include "pwmview.h"
#include <qpainter.h>
#include <qpixmap.h>
#include <kiconloader.h>
#ifdef PWM_EMBEDDED
#include <kglobal.h>
#endif
ListViewPwM::ListViewPwM(QWidget *parent, const char *name)
: KListView(parent, name)
{
// setResizeMode(QListView::AllColumns);
}
bool ListViewPwM::event(QEvent *e)
{
if (e->type() == QEvent::LayoutHint)
emit layoutChanged();
return KListView::event(e);
}
QPixmap * ListViewItemPwM::onPix = 0;
QPixmap * ListViewItemPwM::offPix = 0;
ListViewItemPwM::ListViewItemPwM(QListView *parent)
: QCheckListItem(parent, "", QCheckListItem::CheckBox)
{
if (!onPix) {
PWM_ASSERT(!offPix);
KIconLoader* picons;
#ifndef PWM_EMBEDDED
KIconLoader il;
picons = &il;
#else
picons = KGlobal::iconLoader();
#endif
KIconLoader il;
+#ifndef PWM_EMBEDDED
static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small));
+#else
+ static QPixmap onP(picons->loadIcon("decrypted", KIcon::Small));
+#endif
onPix = &onP;
static QPixmap offP(picons->loadIcon("encrypted", KIcon::Small));
offPix = &offP;
}
}
void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg,
int column, int width, int align)
{
+ // qDebug("ListViewItemPwM::paintCell column=%i", column);
if (!p)
return;
- if (column != 0) {
+ //US BUG:
+ if (column != COLUMN_DESC) {
QCheckListItem::paintCell(p, cg, column, width, align);
return;
}
QPixmap *curPix = isOn() ? onPix : offPix;
int pixSpace = curPix->width();
pixSpace += 4;
#ifndef PWM_EMBEDDED
QRect window(p->viewport());
// clear the rectangle (we have to clear it first. see QT doc)
p->eraseRect(0, 0, pixSpace, window.height());
// now draw the pixmap
int y = (height() - curPix->height()) / 2;
p->drawPixmap(1, y, *curPix);
window.moveLeft(pixSpace);
p->setViewport(window);
+#else
+ p->eraseRect(0, 0, pixSpace, height());
+ // now draw the pixmap
+ int y = (height() - curPix->height()) / 2;
+ p->drawPixmap(1, y, *curPix);
+ p->translate( pixSpace, 0 );
+
#endif
QListViewItem::paintCell(p, cg, column, width - pixSpace, align);
+
}
#ifndef PWM_EMBEDDED
#include "listviewpwm.moc"
#endif