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 @@ -44,3 +44,3 @@ $Id$ 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, 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 @@ -110,5 +110,18 @@ void FindWndImpl::findButton_slot() + +#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 } 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 @@ -22,3 +22,7 @@ +#ifndef PWM_EMBEDDED #include "findwnd.h" +#else +#include "findwnd_emb.h" +#endif @@ -45,2 +49,6 @@ public slots: +#ifdef PWM_EMBEDDED + virtual void slotOk(); +#endif + protected: 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 @@ -34,4 +34,6 @@ void GetMasterPwWndImpl::okButton_slot() { +#ifndef PWM_EMBEDDED if (pwLineEdit->text() != "") done(1); +#endif } @@ -40,4 +42,16 @@ void GetMasterPwWndImpl::cancelButton_slot() { +#ifndef PWM_EMBEDDED done(2); +#endif +} + +#ifdef PWM_EMBEDDED +void GetMasterPwWndImpl::slotOk() +{ + if (pwLineEdit->text() != "") + getMasterPwWnd::slotOk(); + else + return; } +#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 @@ -22,3 +22,7 @@ +#ifndef PWM_EMBEDDED #include "getmasterpwwnd.h" +#else +#include "getmasterpwwnd_emb.h" +#endif @@ -37,2 +41,5 @@ public slots: void cancelButton_slot(); +#ifdef PWM_EMBEDDED + virtual void slotOk(); +#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 @@ -27,2 +27,5 @@ +#ifdef PWM_EMBEDDED +#include <kglobal.h> +#endif @@ -50,6 +53,14 @@ ListViewItemPwM::ListViewItemPwM(QListView *parent) 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; 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 @@ -24,2 +24,3 @@ #include <qdir.h> +#include <kpimglobalprefs.h> #endif @@ -187,2 +188,3 @@ int main(int argc, char *argv[]) KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); + KPimGlobalPrefs::instance()->setGlobalConfig(); 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 @@ -47,5 +47,2 @@ pwGenWnd::pwGenWnd( QWidget* parent, const char* name) { - if ( !name ) - setName( "pwGenWnd" ); - QWidget *page = plainPage(); 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 @@ -359,2 +359,6 @@ void PwM::initToolbar() +#ifdef PWM_EMBEDDED + if ( QApplication::desktop()->width() > 320 ) +#endif + { toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), @@ -366,2 +370,3 @@ void PwM::initToolbar() toolBar()->insertSeparator(); + } toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), @@ -727,4 +732,4 @@ void PwM::deletePwd_slot() 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?")) @@ -1284,17 +1289,13 @@ void PwM::createAboutData_slot() "(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" 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 @@ -50,3 +50,3 @@ compressbzip2.h \ compressgzip.h \ -findwnd.h \ +findwnd_emb.h \ findwndimpl.h \ @@ -54,3 +54,3 @@ genpasswd.h \ getkeycardwnd.h \ -getmasterpwwnd.h \ +getmasterpwwnd_emb.h \ getmasterpwwndimpl.h \ @@ -82,3 +82,3 @@ rencatwnd.h \ serializer.h \ -setmasterpwwnd.h \ +setmasterpwwnd_emb.h \ setmasterpwwndimpl.h \ @@ -113,3 +113,3 @@ compressbzip2.cpp \ compressgzip.cpp \ -findwnd.cpp \ +findwnd_emb.cpp \ findwndimpl.cpp \ @@ -117,3 +117,3 @@ genpasswd.cpp \ getkeycardwnd.cpp \ -getmasterpwwnd.cpp \ +getmasterpwwnd_emb.cpp \ getmasterpwwndimpl.cpp \ @@ -143,3 +143,3 @@ rencatwnd.cpp \ serializer.cpp \ -setmasterpwwnd.cpp \ +setmasterpwwnd_emb.cpp \ setmasterpwwndimpl.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 @@ -81,5 +81,7 @@ QString PwMDocUi::requestMpw(bool chipcard) } else { - GetMasterPwWndImpl pwWnd; #ifndef PWM_EMBEDDED + GetMasterPwWndImpl pwWnd; KWin::setState(pwWnd.winId(), NET::StaysOnTop); +#else + GetMasterPwWndImpl pwWnd; #endif @@ -98,9 +100,9 @@ QString PwMDocUi::requestNewMpw(bool *chipcard) 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 + } @@ -139,3 +141,3 @@ void PwMDocUi::wrongMpwMsgBox(bool chipcard, QString prefix, QString postfix) msg += i18n("Wrong key-card!\n" - "Please try again with the " + "Please try again with the\n" "correct key-card."); @@ -165,3 +167,3 @@ void PwMDocUi::noMpwMsgBox(bool chipcard, QString prefix, QString postfix) msg += i18n("No key-card found!\n" - "Please insert the " + "Please insert the\n" "correct key-card."); @@ -362,2 +364,3 @@ bool PwMDocUi::openDocUi(PwMDoc *doc, ret = doc->openDoc(&filename, lockStat); + qDebug("pwmdocui::OpenDocui %i", ret); if (ret != e_success) { 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 @@ -27,3 +27,7 @@ #include "commentbox.h" - +#ifndef PWM_EMBEDDED +#include "configuration.h" +#else +#include "pwmprefs.h" +#endif @@ -39,2 +43,6 @@ PwMViewStyle::~PwMViewStyle() { + //US ENH : load and store the size of the listviewcolumns + lv->saveLayout(conf()->getConfig(), "listview"); + conf()->getConfig()->sync(); + delete_ifnot_null(s0); @@ -81,2 +89,6 @@ void PwMViewStyle::initStyle(style_t style) v->tmpReEnableSort(); + + //US ENH : load and store the size of the listviewcolumns + lv->restoreLayout(conf()->getConfig(), "listview"); + resizeView(v->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 @@ -29,3 +29,3 @@ /* enable/disable serializer debugging (0/1) */ -#define SERIALIZER_DEBUG 0 +#define SERIALIZER_DEBUG 1 /* use the old xml tags for writing (0/1) */ 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 @@ -48,4 +48,5 @@ SetMasterPwWndImpl::SetMasterPwWndImpl(QWidget * parent, const char *name) #else - qDebug("SetMasterPwWndImpl::SetMasterPwWndImpl has to be fixed"); + mainTab->removePage(tab_2); #endif + #endif // CONFIG_KEYCARD @@ -60,2 +61,3 @@ void SetMasterPwWndImpl::okButton_slot() { +#ifndef PWM_EMBEDDED int index = mainTab->currentPageIndex(); @@ -90,2 +92,3 @@ void SetMasterPwWndImpl::okButton_slot() done(1); +#endif } @@ -94,5 +97,43 @@ 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() 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 @@ -23,3 +23,7 @@ +#ifndef PWM_EMBEDDED #include "setmasterpwwnd.h" +#else +#include "setmasterpwwnd_emb.h" +#endif @@ -60,2 +64,6 @@ public slots: +#ifdef PWM_EMBEDDED + virtual void slotOk(); +#endif + protected slots: |