21 files changed, 699 insertions, 38 deletions
diff --git a/pwmanager/pwmanager/addentrywnd_emb.cpp b/pwmanager/pwmanager/addentrywnd_emb.cpp index 3a40cfc..ed02e6d 100644 --- a/pwmanager/pwmanager/addentrywnd_emb.cpp +++ b/pwmanager/pwmanager/addentrywnd_emb.cpp @@ -33,25 +33,25 @@ $Id$ #include <kcombobox.h> #include <klineedit.h> #include <qpushbutton.h> /* * Constructs a addEntryWnd as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ addEntryWnd::addEntryWnd( QWidget* parent, const char* name) - : KDialogBase( KDialogBase::Plain, i18n( "Edit Password" ), + : KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent, name, true ) { QWidget *page = plainPage(); QVBoxLayout *pageLayout = new QVBoxLayout( page ); QTabWidget* mTabWidget = new QTabWidget( page ); pageLayout->addWidget( mTabWidget ); //////////////////////////////////////////////////////////////////// // This is the Password tab QWidget *tab1 = new QWidget( mTabWidget ); diff --git a/pwmanager/pwmanager/findwnd_emb.cpp b/pwmanager/pwmanager/findwnd_emb.cpp new file mode 100644 index 0000000..6db2684 --- a/dev/null +++ b/pwmanager/pwmanager/findwnd_emb.cpp @@ -0,0 +1,123 @@ +/* + 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 "findwnd_emb.h" + +#include <klocale.h> + +#include <qcheckbox.h> +#include <qbuttongroup.h> +#include <qradiobutton.h> +#include <qlayout.h> +#include <klineedit.h> +#include <qlabel.h> + +/* +#include <qvariant.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qpushbutton.h> +#include <qcheckbox.h> +#include <qbuttongroup.h> +#include <qradiobutton.h> +#include <qlayout.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +*/ + +/* + * Constructs a findWnd as a child of 'parent', with the + * name 'name'. + */ +findWnd::findWnd( QWidget* parent, const char* name ) + : KDialogBase( KDialogBase::Plain, i18n( "Find" ), + KDialogBase::Ok | KDialogBase::Cancel, + KDialogBase::Ok, parent, name, true ) +{ + QWidget *page = plainPage(); + QVBoxLayout *layout = new QVBoxLayout( page ); + layout->setMargin( KDialogBase::marginHint() ); + layout->setSpacing( KDialogBase::spacingHint() ); + + exactCheckBox = new QCheckBox( i18n( "&Exact match" ), page ); + layout->addWidget( exactCheckBox ); + + caseSensCheckBox = new QCheckBox( i18n( "&Case sensitive" ), page ); + layout->addWidget( caseSensCheckBox ); + + + QButtonGroup* buttonGroup1 = new QButtonGroup(1, Qt::Horizontal, i18n( "Search in Column" ), page ); + layout->addWidget( buttonGroup1 ); + + descRadioButton = new QRadioButton( i18n( "&Description" ), buttonGroup1 ); + pwRadioButton = new QRadioButton( i18n( "&Password" ), buttonGroup1 ); + commentRadioButton = new QRadioButton( i18n( "C&omment" ), buttonGroup1 ); + nameRadioButton = new QRadioButton( i18n( "&Username" ), buttonGroup1 ); + urlRadioButton = new QRadioButton( i18n( "U&RL" ), buttonGroup1 ); + launcherRadioButton = new QRadioButton( i18n( "&Launcher" ), buttonGroup1 ); + descRadioButton->setChecked( TRUE ); + + findLineEdit = new KLineEdit( page ); + QLabel* label = new QLabel( findLineEdit, i18n( "Find:" ), page ); + layout->addWidget( label ); + layout->addWidget( findLineEdit ); + + setButtonText( KDialogBase::Ok, "&Find" ); + setButtonText( KDialogBase::Cancel, "&Close" ); + + + // resize( QSize(200, 150) ); + + + connect( buttonGroup1, SIGNAL( clicked(int) ), this, SLOT( selectionChanged_slot() ) ); + connect( findLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( selectionChanged_slot() ) ); + connect( caseSensCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( selectionChanged_slot() ) ); + connect( exactCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( selectionChanged_slot() ) ); + +} + +/* + * Destroys the object and frees any allocated resources + */ +findWnd::~findWnd() +{ + // no need to delete child widgets, Qt does it all for us +} + +void findWnd::findButton_slot() +{ + qWarning( "findWnd::findButton_slot(): Not implemented yet" ); +} + +void findWnd::selectionChanged_slot() +{ + qWarning( "findWnd::selectionChanged_slot(): Not implemented yet" ); +} + +void findWnd::closeButton_slot() +{ + qWarning( "findWnd::closeButton_slot(): Not implemented yet" ); +} + diff --git a/pwmanager/pwmanager/findwnd_emb.h b/pwmanager/pwmanager/findwnd_emb.h new file mode 100644 index 0000000..9ad5a73 --- a/dev/null +++ b/pwmanager/pwmanager/findwnd_emb.h @@ -0,0 +1,62 @@ +/* + 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 FINDWND_EMB_H +#define FINDWND_EMB_H + +#include <kdialogbase.h> + + +class QLineEdit; +class QCheckBox; +class QRadioButton; + + +class findWnd : public KDialogBase +{ + Q_OBJECT + +public: + findWnd( QWidget* parent = 0, const char* name = 0 ); + ~findWnd(); + + QLineEdit* findLineEdit; + QCheckBox* exactCheckBox; + QCheckBox* caseSensCheckBox; + QRadioButton* descRadioButton; + QRadioButton* pwRadioButton; + QRadioButton* commentRadioButton; + QRadioButton* nameRadioButton; + QRadioButton* urlRadioButton; + QRadioButton* launcherRadioButton; + +public slots: + virtual void findButton_slot(); + virtual void selectionChanged_slot(); + virtual void closeButton_slot(); +}; + +#endif // FINDWND_H diff --git a/pwmanager/pwmanager/findwndimpl.cpp b/pwmanager/pwmanager/findwndimpl.cpp index fec1a6a..059219f 100644 --- a/pwmanager/pwmanager/findwndimpl.cpp +++ b/pwmanager/pwmanager/findwndimpl.cpp @@ -99,27 +99,40 @@ void FindWndImpl::findButton_slot() } currFoundPos = 0; } int lvp = doc->getListViewPos(parent->getCurrentCategory(), foundPositions[currFoundPos++]); emit foundAt(numEntries - 1 - lvp); if (currFoundPos + 1 > static_cast<int>(foundPositions.size())) currFoundPos = 0; } + +#ifdef PWM_EMBEDDED +void FindWndImpl::slotOk() +{ + findButton_slot(); + + //do not call KDialogBase::slotOk() here + // user should press the close button instead +} +#endif + void FindWndImpl::closeButton_slot() { +#ifndef PWM_EMBEDDED done(0); +#endif } void FindWndImpl::selectionChanged_slot() { fAt = 0; refVal = 0; currFoundPos = -1; } #ifndef PWM_EMBEDDED #include "findwndimpl.moc" #endif diff --git a/pwmanager/pwmanager/findwndimpl.h b/pwmanager/pwmanager/findwndimpl.h index d8cb65d..b601390 100644 --- a/pwmanager/pwmanager/findwndimpl.h +++ b/pwmanager/pwmanager/findwndimpl.h @@ -11,47 +11,55 @@ /*************************************************************************** * 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$ **************************************************************************/ #ifndef FINDWNDIMPL_H #define FINDWNDIMPL_H +#ifndef PWM_EMBEDDED #include "findwnd.h" +#else +#include "findwnd_emb.h" +#endif class PwMView; /** "add" Window */ class FindWndImpl : public findWnd { Q_OBJECT public: FindWndImpl(PwMView *_parent); ~FindWndImpl(); signals: void foundAt(int index); public slots: /** find button pressed */ void findButton_slot(); /** close button pressed */ void closeButton_slot(); /** selection of one of the radio buttons changed */ void selectionChanged_slot(); +#ifdef PWM_EMBEDDED + virtual void slotOk(); +#endif + protected: /** parent view */ PwMView *parent; /** entry found at */ unsigned int fAt; /** reference value */ unsigned int refVal; /** current position in the found-items-vector */ int currFoundPos; /** the number of entries in the current category */ unsigned int numEntries; /** index number of the current category */ diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp new file mode 100644 index 0000000..3519de8 --- a/dev/null +++ b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp @@ -0,0 +1,86 @@ +/* + 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> + +/* + * 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); + + + 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" ); +} + diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.h b/pwmanager/pwmanager/getmasterpwwnd_emb.h new file mode 100644 index 0000000..64121c4 --- a/dev/null +++ b/pwmanager/pwmanager/getmasterpwwnd_emb.h @@ -0,0 +1,48 @@ +/* + 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(); +}; + +#endif // GETMASTERPWWND_H diff --git a/pwmanager/pwmanager/getmasterpwwndimpl.cpp b/pwmanager/pwmanager/getmasterpwwndimpl.cpp index db0223e..6be9618 100644 --- a/pwmanager/pwmanager/getmasterpwwndimpl.cpp +++ b/pwmanager/pwmanager/getmasterpwwndimpl.cpp @@ -23,24 +23,38 @@ GetMasterPwWndImpl::GetMasterPwWndImpl(QWidget * parent, const char *name) : getMasterPwWnd(parent, name) { } GetMasterPwWndImpl::~GetMasterPwWndImpl() { } void GetMasterPwWndImpl::okButton_slot() { +#ifndef PWM_EMBEDDED if (pwLineEdit->text() != "") done(1); +#endif } void GetMasterPwWndImpl::cancelButton_slot() { +#ifndef PWM_EMBEDDED done(2); +#endif } +#ifdef PWM_EMBEDDED +void GetMasterPwWndImpl::slotOk() +{ + if (pwLineEdit->text() != "") + getMasterPwWnd::slotOk(); + else + return; +} +#endif + #ifndef PWM_EMBEDDED #include "getmasterpwwndimpl.moc" #endif diff --git a/pwmanager/pwmanager/getmasterpwwndimpl.h b/pwmanager/pwmanager/getmasterpwwndimpl.h index 28aa427..8a4c03e 100644 --- a/pwmanager/pwmanager/getmasterpwwndimpl.h +++ b/pwmanager/pwmanager/getmasterpwwndimpl.h @@ -11,30 +11,37 @@ /*************************************************************************** * 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$ **************************************************************************/ #ifndef GETMASTERPWWNDIMPL_H #define GETMASTERPWWNDIMPL_H +#ifndef PWM_EMBEDDED #include "getmasterpwwnd.h" +#else +#include "getmasterpwwnd_emb.h" +#endif /** set master pw wnd */ class GetMasterPwWndImpl : public getMasterPwWnd { Q_OBJECT public: GetMasterPwWndImpl(QWidget* parent = 0, const char *name = 0); ~GetMasterPwWndImpl(); public slots: /** ok button pressed */ void okButton_slot(); /** cancel button pressed */ void cancelButton_slot(); +#ifdef PWM_EMBEDDED + virtual void slotOk(); +#endif }; #endif diff --git a/pwmanager/pwmanager/listviewpwm.cpp b/pwmanager/pwmanager/listviewpwm.cpp index b987c9e..c53cfd7 100644 --- a/pwmanager/pwmanager/listviewpwm.cpp +++ b/pwmanager/pwmanager/listviewpwm.cpp @@ -16,51 +16,62 @@ * * $Id$ **************************************************************************/ #include "listviewpwm.h" #include "pwmexception.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; - static QPixmap onP(il.loadIcon("button_ok", KIcon::Small)); + static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small)); onPix = &onP; - static QPixmap offP(il.loadIcon("encrypted", KIcon::Small)); + static QPixmap offP(picons->loadIcon("encrypted", KIcon::Small)); offPix = &offP; } } void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align) { if (!p) return; if (column != 0) { QCheckListItem::paintCell(p, cg, column, width, align); return; diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp index d720e1f..3ae4d55 100644 --- a/pwmanager/pwmanager/main.cpp +++ b/pwmanager/pwmanager/main.cpp @@ -13,24 +13,25 @@ * 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$ **************************************************************************/ #ifndef PWM_EMBEDDED #include <kcmdlineargs.h> #include <kaboutdata.h> #else #include <qdir.h> +#include <kpimglobalprefs.h> #endif #include <klocale.h> #include <kstandarddirs.h> #include "pwmexception.h" #include "pwminit.h" #define LICENSE_FILE (::locate("data", "pwmanager/pwmanager_license_text")) int PwMApplication::newInstance() { @@ -176,24 +177,25 @@ int main(int argc, char *argv[]) //US if ( QApplication::desktop()->width() > 320 ) //US KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/"); //US else KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/"); #else QString fileName ; fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); QApplication::addLibraryPath ( qApp->applicationDirPath () ); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); + KPimGlobalPrefs::instance()->setGlobalConfig(); a.newInstance(); //US KAddressBookMain m ; //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); /*US #ifndef DESKTOP_VERSION a.showMainWidget( &m ); #else a.setMainWidget( &m ); m.resize (640, 480 ); diff --git a/pwmanager/pwmanager/pwgenwnd_emb.cpp b/pwmanager/pwmanager/pwgenwnd_emb.cpp index 9655e9f..429904c 100644 --- a/pwmanager/pwmanager/pwgenwnd_emb.cpp +++ b/pwmanager/pwmanager/pwgenwnd_emb.cpp @@ -36,27 +36,24 @@ $Id$ #include "klocale.h" /* * Constructs a pwGenWnd as a child of 'parent', with the * name 'name'. * */ pwGenWnd::pwGenWnd( QWidget* parent, const char* name) : KDialogBase( KDialogBase::Plain, i18n( "Password generator" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent, name, true ) { - if ( !name ) - setName( "pwGenWnd" ); - QWidget *page = plainPage(); QVBoxLayout* pwGenWndLayout = new QVBoxLayout( page, 11, 6, "pwGenWndLayout"); QGroupBox* groupBox1 = new QGroupBox( page, "groupBox1" ); groupBox1->setTitle( i18n( "Character set:" ) ); groupBox1->setColumnLayout(0, Qt::Vertical ); groupBox1->layout()->setSpacing( 6 ); groupBox1->layout()->setMargin( 11 ); QVBoxLayout* groupBox1Layout = new QVBoxLayout( groupBox1->layout() ); groupBox1Layout->setAlignment( Qt::AlignTop ); int_charLowerCheckBox = new QCheckBox( i18n("Lowercase (abc)"), groupBox1, "int_charLowerCheckBox" ); diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index 107e845..bd07c80 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp @@ -348,31 +348,36 @@ void PwM::initMenubar() } void PwM::initToolbar() { KIconLoader* picons; #ifndef PWM_EMBEDDED KIconLoader icons; picons = &icons; #else picons = KGlobal::iconLoader(); #endif +#ifdef PWM_EMBEDDED + if ( QApplication::desktop()->width() > 320 ) +#endif + { toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, SLOT(new_slot()), true, i18n("New")); toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, SLOT(open_slot()), true, i18n("Open")); toolBar()->insertSeparator(); + } toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, SLOT(save_slot()), true, i18n("Save")); toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, SLOT(saveAs_slot()), true, i18n("Save as")); toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, SLOT(print_slot()), true, i18n("Print...")); toolBar()->insertSeparator(); toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, @@ -716,26 +721,26 @@ void PwM::deletePwd_slot() } PwMDataItem currItem; QString curCategory = view->getCurrentCategory(); if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { printDebug("couldn't get entry"); curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); return; } if (KMessageBox:: questionYesNo(this, i18n - ("Do you really want to delete the selected entry") + - " \"" + QString(currItem.desc.c_str()) + ("Do you really want to delete\nthe selected entry") + + " \n\"" + QString(currItem.desc.c_str()) + "\" ?", i18n("delete?")) == KMessageBox::Yes) { curDoc()->delEntry(curCategory, curEntryIndex); } curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); } void PwM::changeMasterPwd_slot() { PWM_ASSERT(curDoc()); curDoc()->changeCurrentPw(); @@ -1273,37 +1278,33 @@ void PwM::createAboutData_slot() QMessageBox::about( this, "About PwManager/Pi", "PwManager/Platform-independent\n" "(PWM/Pi) " +version + " - " + #ifdef DESKTOP_VERSION "Desktop Edition\n" #else "PDA-Edition\n" "for: Zaurus 5500 / 7x0 / 8x0\n" #endif "(c) 2004 Ulf Schenk\n" "(c) 2004 Lutz Rogowski\n" - "(c) 1997-2003, The KDE PIM Team\n" - - "Michael Buesch - main programming and current maintainer\nmbuesch@freenet.de\n" - "Matt Scifo - original implementaion of \n" - "\"categories\" and the password-tree \n" - "in the system-tray. Original implementations of \n" - "numerous view-improvements.\n" - "mscifo@o1.com\n" - "Elias Probst - Gentoo ebuild maintainer.\nelias.probst@gmx.de\n" - "George Staikos - KWallet\nstaikos@kde.org\n" - "Matthew Palmer - rc2 code\nmjp16@uow.edu.au\n" - "Olivier Sessink - gpasman\ngpasman@nl.linux.org\n" - "The libgcrypt developers - Blowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" - "Troy Engel - kpasman\n tengel@sonic.net\n" - "Wickey - graphics-design in older versions\nwickey@gmx.at\n" + "(c) 1997-2004, The KDE PIM Team\n" + + "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" + "Matt Scifo - mscifo@o1.com\n" + "Elias Probst - elias.probst@gmx.de\n" + "George Staikos - staikos@kde.org\n" + "Matthew Palmer - mjp16@uow.edu.au\n" + "Olivier Sessink - gpasman@nl.linux.org\n" + "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" + "Troy Engel - tengel@sonic.net\n" + "Wickey - wickey@gmx.at\n" "Ian MacGregor - original documentation author.\n" ); } #endif #ifndef PWM_EMBEDDED #include "pwm.moc" #endif diff --git a/pwmanager/pwmanager/pwmanagerE.pro b/pwmanager/pwmanager/pwmanagerE.pro index 87142b7..b0c9236 100644 --- a/pwmanager/pwmanager/pwmanagerE.pro +++ b/pwmanager/pwmanager/pwmanagerE.pro @@ -39,29 +39,29 @@ LIBS += $(QTOPIALIB) #selftest.h HEADERS = \ addentrywnd_emb.h \ addentrywndimpl.h \ base64.h \ binentrygen.h \ blowfish.h \ commentbox.h \ compiler.h \ compressbzip2.h \ compressgzip.h \ -findwnd.h \ +findwnd_emb.h \ findwndimpl.h \ genpasswd.h \ getkeycardwnd.h \ -getmasterpwwnd.h \ +getmasterpwwnd_emb.h \ getmasterpwwndimpl.h \ globalstuff.h \ gpasmanfile.h \ htmlgen.h \ htmlparse.h \ ipc.h \ listobjselectwnd.h \ listviewpwm.h \ printtext.h \ pwgenwnd_emb.h \ pwgenwndimpl.h \ pwmdoc.h \ @@ -71,25 +71,25 @@ pwm.h \ pwminit.h \ pwmprefs.h \ pwmprint.h \ pwmtray.h \ pwmview.h \ pwmviewstyle_0.h \ pwmviewstyle_1.h \ pwmviewstyle.h \ randomizer.h \ rc2.h \ rencatwnd.h \ serializer.h \ -setmasterpwwnd.h \ +setmasterpwwnd_emb.h \ setmasterpwwndimpl.h \ sha1.h \ subtbledit.h \ subtbleditimpl.h \ waitwnd.h \ kcmconfigs/kcmpwmconfig.h \ kcmconfigs/pwmconfigwidget.h \ #sources that need not be build #SOURCES = \ #advcommeditimpl.cpp \ #configuration.cpp \ @@ -102,29 +102,29 @@ kcmconfigs/pwmconfigwidget.h \ #pwmprint.cpp \ #spinforsignal.cpp SOURCES = \ addentrywnd_emb.cpp \ addentrywndimpl.cpp \ base64.cpp \ binentrygen.cpp \ blowfish.cpp \ commentbox.cpp \ compressbzip2.cpp \ compressgzip.cpp \ -findwnd.cpp \ +findwnd_emb.cpp \ findwndimpl.cpp \ genpasswd.cpp \ getkeycardwnd.cpp \ -getmasterpwwnd.cpp \ +getmasterpwwnd_emb.cpp \ getmasterpwwndimpl.cpp \ globalstuff.cpp \ gpasmanfile.cpp \ htmlgen.cpp \ ipc.cpp \ listobjselectwnd.cpp \ listviewpwm.cpp \ main.cpp \ pwgenwnd_emb.cpp \ pwgenwndimpl.cpp \ pwm.cpp \ pwmdoc.cpp \ @@ -132,22 +132,22 @@ pwmdocui.cpp \ pwmexception.cpp \ pwminit.cpp \ pwmprefs.cpp \ pwmtray.cpp \ pwmview.cpp \ pwmviewstyle_0.cpp \ pwmviewstyle_1.cpp \ pwmviewstyle.cpp \ randomizer.cpp \ rc2.cpp \ rencatwnd.cpp \ serializer.cpp \ -setmasterpwwnd.cpp \ +setmasterpwwnd_emb.cpp \ setmasterpwwndimpl.cpp \ sha1.cpp \ subtbledit.cpp \ subtbleditimpl.cpp \ waitwnd.cpp \ kcmconfigs/kcmpwmconfig.cpp \ kcmconfigs/pwmconfigwidget.cpp \ diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp index 3993fa8..e42dd9d 100644 --- a/pwmanager/pwmanager/pwmdocui.cpp +++ b/pwmanager/pwmanager/pwmdocui.cpp @@ -70,48 +70,50 @@ QString PwMDocUi::requestMpw(bool chipcard) spinner, SLOT(u32_str_slot(uint32_t, const string &))); keyCard->getKey(); spinner->spin(&id, &ret); disconnect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), spinner, SLOT(u32_str_slot(uint32_t, const string &))); if (ret == "") return ""; pw = ret.c_str(); #else // CONFIG_KEYCARD no_keycard_support_msg_box(currentView); #endif // CONFIG_KEYCARD } else { - GetMasterPwWndImpl pwWnd; #ifndef PWM_EMBEDDED + GetMasterPwWndImpl pwWnd; KWin::setState(pwWnd.winId(), NET::StaysOnTop); +#else + GetMasterPwWndImpl pwWnd; #endif if (pwWnd.exec() != 1) return ""; pw = pwWnd.pwLineEdit->text(); } return pw; } QString PwMDocUi::requestNewMpw(bool *chipcard) { QString pw; SetMasterPwWndImpl pwWnd(currentView); pwWnd.setPwMKeyCard(keyCard); -#ifndef PWM_EMBEDDED if (!chipcard) { +#ifndef PWM_EMBEDDED pwWnd.mainTab->removePage(pwWnd.mainTab->page(1)); - } #else - qDebug("PwMDocUi::requestNewMpw must be implemented"); + pwWnd.mainTab->removePage(pwWnd.tab_2); #endif + } if (pwWnd.exec() != 1) return ""; pw = pwWnd.getPw(chipcard).c_str(); return pw; } QString PwMDocUi::requestMpwChange(const QString *currentPw, bool *chipcard) { QString pw(requestMpw(*chipcard)); if (pw == "") @@ -128,25 +130,25 @@ QString PwMDocUi::requestMpwChange(const QString *currentPw, bool *chipcard) } void PwMDocUi::wrongMpwMsgBox(bool chipcard, QString prefix, QString postfix) { QString msg; if (prefix != "") { msg += prefix; msg += "\n"; } if (chipcard) { msg += i18n("Wrong key-card!\n" - "Please try again with the " + "Please try again with the\n" "correct key-card."); } else { msg += i18n("Wrong master-password!\n" "Please try again."); } if (postfix != "") { msg += "\n"; msg += postfix; } KMessageBox::error(currentView, msg, (chipcard) ? (i18n("wrong chipcard")) @@ -154,25 +156,25 @@ void PwMDocUi::wrongMpwMsgBox(bool chipcard, QString prefix, QString postfix) } void PwMDocUi::noMpwMsgBox(bool chipcard, QString prefix, QString postfix) { QString msg; if (prefix != "") { msg += prefix; msg += "\n"; } if (chipcard) { msg += i18n("No key-card found!\n" - "Please insert the " + "Please insert the\n" "correct key-card."); } else { msg += i18n("No master-password given!"); } if (postfix != "") { msg += "\n"; msg += postfix; } KMessageBox::error(currentView, msg, (chipcard) ? (i18n("no chipcard")) : (i18n("password error"))); @@ -351,24 +353,25 @@ bool PwMDocUi::openDocUi(PwMDoc *doc, while (true) { int lockStat = -1; if (openDeepLocked) { lockStat = 2; } else { if (conf()->confGlobUnlockOnOpen()) { lockStat = 0; } else { lockStat = 1; } } ret = doc->openDoc(&filename, lockStat); + qDebug("pwmdocui::OpenDocui %i", ret); if (ret != e_success) { if (ret == e_readFile || ret == e_openFile) { KMessageBox::error(getCurrentView(), i18n("Could not read file!") + "\n" + filename, i18n("file error")); goto cancelOpen; } if (ret == e_alreadyOpen) { KMessageBox::error(getCurrentView(), i18n("This file is already open."), diff --git a/pwmanager/pwmanager/pwmviewstyle.cpp b/pwmanager/pwmanager/pwmviewstyle.cpp index 67b5197..51d8f6c 100644 --- a/pwmanager/pwmanager/pwmviewstyle.cpp +++ b/pwmanager/pwmanager/pwmviewstyle.cpp @@ -16,36 +16,44 @@ * and was modified to run on embedded devices that run microkde * * $Id$ **************************************************************************/ #include "pwmviewstyle.h" #include "pwmexception.h" #include "pwmviewstyle_0.h" #include "pwmviewstyle_1.h" #include "listviewpwm.h" #include "pwmview.h" #include "commentbox.h" - +#ifndef PWM_EMBEDDED +#include "configuration.h" +#else +#include "pwmprefs.h" +#endif PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name) : QWidget(parent, name) { curStyle = style_notset; s0 = 0; s1 = 0; } PwMViewStyle::~PwMViewStyle() { + //US ENH : load and store the size of the listviewcolumns + lv->saveLayout(conf()->getConfig(), "listview"); + conf()->getConfig()->sync(); + delete_ifnot_null(s0); delete_ifnot_null(s1); } void PwMViewStyle::initStyle(style_t style) { printDebug(string("initializing style ") + tostr(style)); bool wasMaximized = v->isMaximized(); if (v->isVisible()) v->hide(); switch (style) { case style_0: @@ -70,24 +78,28 @@ void PwMViewStyle::initStyle(style_t style) connect(lv, SIGNAL(pressed(QListViewItem *)), v, SLOT(handleToggle(QListViewItem *))); connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int))); connect(lv, SIGNAL(clicked(QListViewItem *)), v, SLOT(refreshCommentTextEdit(QListViewItem *))); lv->addColumn(i18n("Description"), 180); lv->addColumn(i18n("Username"), 150); lv->addColumn(i18n("Password"), 150); lv->addColumn(i18n("URL"), 180); lv->addColumn(i18n("Launcher"), 120); v->tmpReEnableSort(); + + //US ENH : load and store the size of the listviewcolumns + lv->restoreLayout(conf()->getConfig(), "listview"); + resizeView(v->size()); v->updateView(); if (wasMaximized) { v->showMaximized(); } else { v->show(); } connect(lv, SIGNAL(layoutChanged()), v, SLOT(reorgLp())); } void PwMViewStyle::resizeView(const QSize &size) diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp index f29ef6c..2810b48 100644 --- a/pwmanager/pwmanager/serializer.cpp +++ b/pwmanager/pwmanager/serializer.cpp @@ -18,25 +18,25 @@ * $Id$ **************************************************************************/ #include "serializer.h" #include "pwmexception.h" #ifdef PWM_EMBEDDED #include <kglobal.h> #include <klocale.h> #endif /* enable/disable serializer debugging (0/1) */ -#define SERIALIZER_DEBUG 0 +#define SERIALIZER_DEBUG 1 /* use the old xml tags for writing (0/1) */ #define USE_OLD_TAGS 0 /* write a CDATA section (0/1) */ #define WRITE_CDATA_SEC 0 #define META_CREATE_DATE "c" #define META_VALID_DATE "v" #define META_EXPIRE_DATE "e" #define META_UPDATE_DATE "u" #define META_UPDATE_INT "i" //US ENH : uniqueid diff --git a/pwmanager/pwmanager/setmasterpwwnd_emb.cpp b/pwmanager/pwmanager/setmasterpwwnd_emb.cpp new file mode 100644 index 0000000..e6471e6 --- a/dev/null +++ b/pwmanager/pwmanager/setmasterpwwnd_emb.cpp @@ -0,0 +1,163 @@ +/* + 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 "setmasterpwwnd_emb.h" + +#include <qpushbutton.h> +#include <qtabwidget.h> +#include <qwidget.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qlayout.h> + +#include <klocale.h> + +/*US +#include <qvariant.h> +#include <qpushbutton.h> +#include <qtabwidget.h> +#include <qwidget.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qlayout.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +*/ + +/* + * Constructs a setMasterPwWnd as a child of 'parent', with the + * name 'name' + * + */ +setMasterPwWnd::setMasterPwWnd( QWidget* parent, const char* name ) + : KDialogBase( KDialogBase::Plain, i18n( "Set master-password" ), + KDialogBase::Ok | KDialogBase::Cancel, + KDialogBase::Ok, parent, name, true ) +{ + QWidget *page = plainPage(); + QVBoxLayout *pageLayout = new QVBoxLayout( page ); + + mainTab = new QTabWidget( page ); + pageLayout->addWidget( mainTab ); + + + if ( !name ) + setName( "setMasterPwWnd" ); + + //////////////////////////////////////////////////////////////////// + // This is the Password tab1 + tab = new QWidget( mainTab ); + + QGridLayout *layout = new QGridLayout( tab, 5, 1 ); + layout->setMargin( KDialogBase::marginHint() ); + layout->setSpacing( KDialogBase::spacingHint() ); + + QLabel* label = new QLabel( i18n( "Using a normal password-string to encrypt the data." ), tab ); + label->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); + layout->addWidget(label, 0, 0); + + pwEdit_1 = new QLineEdit( tab, "pwEdit_1" ); + pwEdit_1->setEchoMode( QLineEdit::Password ); + + label = new QLabel( pwEdit_1, i18n( "Please enter the new master-password:" ), tab ); + layout->addWidget(label, 1, 0); + layout->addWidget(pwEdit_1, 2, 0); + + pwEdit_2 = new QLineEdit( tab, "pwEdit_2" ); + pwEdit_2->setEchoMode( QLineEdit::Password ); + + label = new QLabel( pwEdit_2, i18n( "Please enter the password again:" ), tab ); + layout->addWidget(label, 3, 0); + layout->addWidget(pwEdit_2, 4, 0); + + mainTab->insertTab( tab, i18n("Normal password") ); + + + //////////////////////////////////////////////////////////////////// + // This is the Password tab2 + tab_2 = new QWidget( mainTab ); + + layout = new QGridLayout( tab_2, 5, 1 ); + layout->setMargin( KDialogBase::marginHint() ); + layout->setSpacing( KDialogBase::spacingHint() ); + + label = new QLabel( i18n( "Using a PwM key-card to encrypt the data." ), tab_2 ); + label->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); + layout->addWidget(label, 0, 0); + + label = new QLabel( i18n( "selected card:" ), tab_2 ); + label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); + layout->addWidget(label, 1, 0); + + selCardButton = new QPushButton( i18n( "&Select the currently inserted card as key-card" ), tab_2 ); + layout->addWidget(selCardButton, 2, 0); + + genCardButton = new QPushButton( i18n( "&generate new key-card") , tab_2 ); + layout->addWidget(genCardButton, 3, 0); + + curCardIdLabel = new QLabel( QString("") , tab_2 ); + layout->addWidget(curCardIdLabel, 4, 0); + + mainTab->insertTab( tab_2, i18n("Key-card (chipcard)" ) ); + + + // resize( QSize(411, 313).expandedTo(minimumSizeHint()) ); + + // signals and slots connections + // connect( okButton, SIGNAL( clicked() ), this, SLOT( okButton_slot() ) ); + // connect( cancelButton, SIGNAL( clicked() ), this, SLOT( cancelButton_slot() ) ); + connect( genCardButton, SIGNAL( clicked() ), this, SLOT( genCardButton_slot() ) ); + connect( selCardButton, SIGNAL( clicked() ), this, SLOT( selCardButton_slot() ) ); + +} + +/* + * Destroys the object and frees any allocated resources + */ +setMasterPwWnd::~setMasterPwWnd() +{ + // no need to delete child widgets, Qt does it all for us +} + +void setMasterPwWnd::okButton_slot() +{ + qWarning( "setMasterPwWnd::okButton_slot(): Not implemented yet" ); +} + +void setMasterPwWnd::cancelButton_slot() +{ + qWarning( "setMasterPwWnd::cancelButton_slot(): Not implemented yet" ); +} + +void setMasterPwWnd::genCardButton_slot() +{ + qWarning( "setMasterPwWnd::genCardButton_slot(): Not implemented yet" ); +} + +void setMasterPwWnd::selCardButton_slot() +{ + qWarning( "setMasterPwWnd::selCardButton_slot(): Not implemented yet" ); +} + diff --git a/pwmanager/pwmanager/setmasterpwwnd_emb.h b/pwmanager/pwmanager/setmasterpwwnd_emb.h new file mode 100644 index 0000000..c8ddec6 --- a/dev/null +++ b/pwmanager/pwmanager/setmasterpwwnd_emb.h @@ -0,0 +1,62 @@ +/* + 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 SETMASTERPWWND_EMB_H +#define SETMASTERPWWND_EMB_H + +#include <kdialogbase.h> + +class QLineEdit; +class QPushButton; +class QLabel; +class QTabWidget; +class QWidget; + +class setMasterPwWnd : public KDialogBase +{ + Q_OBJECT + +public: + setMasterPwWnd( QWidget* parent = 0, const char* name = 0 ); + ~setMasterPwWnd(); + + QTabWidget* mainTab; + QWidget* tab; + QWidget* tab_2; + QLineEdit* pwEdit_1; + QLineEdit* pwEdit_2; + QPushButton* selCardButton; + QPushButton* genCardButton; + QLabel* curCardIdLabel; + +public slots: + virtual void okButton_slot(); + virtual void cancelButton_slot(); + virtual void genCardButton_slot(); + virtual void selCardButton_slot(); + +}; + +#endif // SETMASTERPWWND_H diff --git a/pwmanager/pwmanager/setmasterpwwndimpl.cpp b/pwmanager/pwmanager/setmasterpwwndimpl.cpp index aac0408..3482643 100644 --- a/pwmanager/pwmanager/setmasterpwwndimpl.cpp +++ b/pwmanager/pwmanager/setmasterpwwndimpl.cpp @@ -37,36 +37,38 @@ #define STRING_CARD_NONE (SetMasterPwWndImpl::string_cardNone()) SetMasterPwWndImpl::SetMasterPwWndImpl(QWidget * parent, const char *name) : setMasterPwWnd(parent, name) { #ifdef CONFIG_KEYCARD curCardIdLabel->setText(STRING_CARD_NONE); #else // CONFIG_KEYCARD #ifndef PWM_EMBEDDED mainTab->removePage(mainTab->page(1)); #else - qDebug("SetMasterPwWndImpl::SetMasterPwWndImpl has to be fixed"); + mainTab->removePage(tab_2); #endif + #endif // CONFIG_KEYCARD keyCard = 0; } SetMasterPwWndImpl::~SetMasterPwWndImpl() { } void SetMasterPwWndImpl::okButton_slot() { +#ifndef PWM_EMBEDDED int index = mainTab->currentPageIndex(); if (index == 0) { // normal password if (pwEdit_1->text() != pwEdit_2->text()) { KMessageBox::error(this, i18n ("The two passwords you have entered don't match.\n" "Please try entering them again."), i18n("Different passwords")); return; } if (pwEdit_1->text() == "") { @@ -79,30 +81,69 @@ void SetMasterPwWndImpl::okButton_slot() } } else { // key-card if (curCardIdLabel->text() == STRING_CARD_NONE) { KMessageBox::error(this, i18n("You didn't select a card as " "PwM-key-card."), i18n("no card")); return; } } done(1); +#endif } void SetMasterPwWndImpl::cancelButton_slot() { +#ifndef PWM_EMBEDDED done(2); +#endif +} + +void SetMasterPwWndImpl::slotOk() +{ + int index = mainTab->currentPageIndex(); + if (index == 0) { + // normal password + if (pwEdit_1->text() != pwEdit_2->text()) { + KMessageBox::error(this, + i18n + ("The two passwords you have entered\ndon't match.\n" + "Please try entering them again."), + i18n("Different passwords")); + return; } + if (pwEdit_1->text() == "") { + KMessageBox::error(this, + i18n("No password entered.\n" + "Please type in a password,\nthat " + "you want to use for\nthe encryption."), + i18n("no password")); + return; + } + } else { + // key-card + if (curCardIdLabel->text() == STRING_CARD_NONE) { + KMessageBox::error(this, + i18n("You didn't select a card as\n" + "PwM-key-card."), + i18n("no card")); + return; + } + } + + setMasterPwWnd::slotOk(); +} + void SetMasterPwWndImpl::genCardButton_slot() { #ifdef CONFIG_KEYCARD PWM_ASSERT(keyCard); keyCard->genNewCard(); #endif // CONFIG_KEYCARD } void SetMasterPwWndImpl::selCardButton_slot() { #ifdef CONFIG_KEYCARD diff --git a/pwmanager/pwmanager/setmasterpwwndimpl.h b/pwmanager/pwmanager/setmasterpwwndimpl.h index 56effc1..3203d4d 100644 --- a/pwmanager/pwmanager/setmasterpwwndimpl.h +++ b/pwmanager/pwmanager/setmasterpwwndimpl.h @@ -12,25 +12,29 @@ /*************************************************************************** * 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$ **************************************************************************/ #ifndef SETMASTERPWWNDIMPL_H #define SETMASTERPWWNDIMPL_H +#ifndef PWM_EMBEDDED #include "setmasterpwwnd.h" +#else +#include "setmasterpwwnd_emb.h" +#endif #include <klocale.h> #include <stdint.h> #include <string> using std::string; class PwMKeyCard; /** set master pw wnd */ class SetMasterPwWndImpl : public setMasterPwWnd { @@ -49,24 +53,28 @@ public: { keyCard = _keyCard; } public slots: /** ok button pressed */ void okButton_slot(); /** cancel button pressed */ void cancelButton_slot(); /** "generate a new card" button pressed */ void genCardButton_slot(); /** "select current card" button pressed */ void selCardButton_slot(); +#ifdef PWM_EMBEDDED + virtual void slotOk(); +#endif + protected slots: /** key from PwMKeyCard is available */ void keyAvailable_slot(uint32_t cardId, const string &key); protected: /** key of currently inserted card */ string curCardKey; /** pointer to the keycard-access object */ PwMKeyCard *keyCard; }; #endif |