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 @@ -41,9 +41,9 @@ $Id$ * 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(); 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 @@ -107,11 +107,24 @@ void FindWndImpl::findButton_slot() 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() { 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 @@ -19,9 +19,13 @@ #ifndef FINDWNDIMPL_H #define FINDWNDIMPL_H +#ifndef PWM_EMBEDDED #include "findwnd.h" +#else +#include "findwnd_emb.h" +#endif class PwMView; /** "add" Window */ @@ -42,8 +46,12 @@ public slots: 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 */ 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 @@ -31,16 +31,30 @@ 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 @@ -19,9 +19,13 @@ #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 { @@ -34,7 +38,10 @@ 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 @@ -24,8 +24,11 @@ #include <qpixmap.h> #include <kiconloader.h> +#ifdef PWM_EMBEDDED +#include <kglobal.h> +#endif ListViewPwM::ListViewPwM(QWidget *parent, const char *name) : KListView(parent, name) { @@ -47,12 +50,20 @@ 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; } } 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 @@ -21,8 +21,9 @@ #include <kcmdlineargs.h> #include <kaboutdata.h> #else #include <qdir.h> +#include <kpimglobalprefs.h> #endif #include <klocale.h> #include <kstandarddirs.h> @@ -184,8 +185,9 @@ int main(int argc, char *argv[]) QApplication::addLibraryPath ( qApp->applicationDirPath () ); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); + KPimGlobalPrefs::instance()->setGlobalConfig(); a.newInstance(); //US KAddressBookMain m ; 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 @@ -44,11 +44,8 @@ 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" ); 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 @@ -356,15 +356,20 @@ void PwM::initToolbar() #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), @@ -724,10 +729,10 @@ void PwM::deletePwd_slot() } 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); @@ -1281,23 +1286,19 @@ void PwM::createAboutData_slot() #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" ); } 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 @@ -47,13 +47,13 @@ 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 \ @@ -79,9 +79,9 @@ pwmviewstyle.h \ randomizer.h \ rc2.h \ rencatwnd.h \ serializer.h \ -setmasterpwwnd.h \ +setmasterpwwnd_emb.h \ setmasterpwwndimpl.h \ sha1.h \ subtbledit.h \ subtbleditimpl.h \ @@ -110,13 +110,13 @@ 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 \ @@ -140,9 +140,9 @@ pwmviewstyle.cpp \ randomizer.cpp \ rc2.cpp \ rencatwnd.cpp \ serializer.cpp \ -setmasterpwwnd.cpp \ +setmasterpwwnd_emb.cpp \ setmasterpwwndimpl.cpp \ sha1.cpp \ subtbledit.cpp \ subtbleditimpl.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 @@ -78,11 +78,13 @@ QString PwMDocUi::requestMpw(bool chipcard) #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(); @@ -95,15 +97,15 @@ 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(); @@ -136,9 +138,9 @@ void PwMDocUi::wrongMpwMsgBox(bool chipcard, QString prefix, QString postfix) } 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."); @@ -162,9 +164,9 @@ void PwMDocUi::noMpwMsgBox(bool chipcard, QString prefix, QString postfix) } 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!"); } @@ -359,8 +361,9 @@ bool PwMDocUi::openDocUi(PwMDoc *doc, 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!") 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 @@ -24,9 +24,13 @@ #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) { @@ -36,8 +40,12 @@ PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name) } 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); } @@ -78,8 +86,12 @@ void PwMViewStyle::initStyle(style_t style) 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(); 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 @@ -26,9 +26,9 @@ #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 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 @@ -45,10 +45,11 @@ SetMasterPwWndImpl::SetMasterPwWndImpl(QWidget * parent, const char *name) #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; } @@ -57,8 +58,9 @@ 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()) { @@ -87,15 +89,54 @@ void SetMasterPwWndImpl::okButton_slot() 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); 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 @@ -20,9 +20,13 @@ #ifndef SETMASTERPWWNDIMPL_H #define SETMASTERPWWNDIMPL_H +#ifndef PWM_EMBEDDED #include "setmasterpwwnd.h" +#else +#include "setmasterpwwnd_emb.h" +#endif #include <klocale.h> #include <stdint.h> @@ -57,8 +61,12 @@ public slots: 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); |