From ae069aa892b29a96a923e49254cc89e65d0393eb Mon Sep 17 00:00:00 2001 From: ulf69 Date: Thu, 23 Sep 2004 19:35:13 +0000 Subject: added implementation of dialogs to fit on embedded devices screens --- (limited to 'pwmanager') diff --git a/pwmanager/pwmanager/addentrywnd_emb.cpp b/pwmanager/pwmanager/addentrywnd_emb.cpp new file mode 100644 index 0000000..3a40cfc --- a/dev/null +++ b/pwmanager/pwmanager/addentrywnd_emb.cpp @@ -0,0 +1,213 @@ +/* + 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 "addentrywnd_emb.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * 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::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 ); + + QGridLayout *layout = new QGridLayout( tab1, 3, 1 ); + layout->setMargin( KDialogBase::marginHint() ); + layout->setSpacing( KDialogBase::spacingHint() ); + + + + int i = 0; + descLineEdit = new KLineEdit( tab1, "descLineEdit" ); + QLabel* label = new QLabel( descLineEdit, i18n("Description:"), tab1 ); + layout->addWidget( label, i, 0 ); + layout->addWidget( descLineEdit, i, 1 ); + i++; + + categoryComboBox = new KComboBox( tab1 ); + label = new QLabel( categoryComboBox, i18n("Category:"), tab1 ); + layout->addWidget( label, i, 0 ); + layout->addWidget( categoryComboBox, i, 1 ); + i++; + categoryComboBox->setEditable( TRUE ); + categoryComboBox->setSizeLimit( 100 ); + categoryComboBox->setAutoCompletion( TRUE ); + categoryComboBox->setDuplicatesEnabled( FALSE ); + + usernameLineEdit = new KLineEdit( tab1, "usernameLineEdit" ); + label = new QLabel( usernameLineEdit, i18n("Username:"), tab1 ); + layout->addWidget( label, i, 0 ); + layout->addWidget( usernameLineEdit, i, 1 ); + i++; + + pwLineEdit = new KLineEdit( tab1, "pwLineEdit" ); + pwLineEdit->setEchoMode( QLineEdit::Password ); + label = new QLabel( pwLineEdit, i18n("Password:"), tab1 ); + layout->addWidget( label, i, 0 ); + layout->addWidget( pwLineEdit, i, 1 ); + i++; + + revealButton = new QPushButton( i18n("&Reveal"), tab1, "revealButton" ); + revealButton->setToggleButton( TRUE ); + layout->addWidget( revealButton, i, 0 ); + + generateButton = new QPushButton( i18n("&Generate"), tab1, "generateButton" ); + layout->addWidget( generateButton, i, 1 ); + i++; + + urlLineEdit = new KLineEdit( tab1, "urlLineEdit" ); + label = new QLabel( urlLineEdit, i18n("URL:"), tab1 ); + layout->addWidget( label, i, 0 ); + layout->addWidget( urlLineEdit, i, 1 ); + i++; + + mTabWidget->addTab( tab1, i18n( "&Password" ) ); + + + //////////////////////////////////////////////////////////////////// + // This is the Comment tab + QWidget *tab2 = new QWidget( mTabWidget ); + + layout = new QGridLayout( tab2, 3, 1 ); + layout->setMargin( KDialogBase::marginHintSmall() ); + layout->setSpacing( KDialogBase::spacingHintSmall() ); + i = 0; + + + + groupBox1 = new QGroupBox( tab2, "groupBox1" ); + commentDummy = new QLabel( groupBox1, "commentDummy" ); + commentDummy->setText( QString::null ); + + groupBox1->setTitle( i18n( "Comment:" ) ); + + layout->addMultiCellWidget( groupBox1, i, i, 0, 1 ); + i++; + + + advancedCommentButton = new QPushButton( i18n("advanced comment"), groupBox1, "advancedCommentButton" ); + advancedCommentButton->setToggleButton( FALSE ); + layout->addMultiCellWidget( advancedCommentButton, i, i, 0, 1 ); + i++; + + + mTabWidget->addTab( tab2, i18n( "&Comments" ) ); + + + //////////////////////////////////////////////////////////////////// + // This is the Launcher tab + QWidget *tab3 = new QWidget( mTabWidget ); + + layout = new QGridLayout( tab3, 3, 1 ); + layout->setMargin( KDialogBase::marginHintSmall() ); + layout->setSpacing( KDialogBase::spacingHintSmall() ); + i = 0; + + launcherLineEdit = new KLineEdit( tab3, "launcherLineEdit" ); + label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); + + QLabel* label1 = new QLabel( launcherLineEdit, i18n("$d = Description"), tab3 ); + QLabel* label2 = new QLabel( launcherLineEdit, i18n("$n = Username"), tab3 ); + QLabel* label3 = new QLabel( launcherLineEdit, i18n("$c = Comment"), tab3 ); + QLabel* label4 = new QLabel( launcherLineEdit, i18n("$u = URL"), tab3 ); + QLabel* label5 = new QLabel( launcherLineEdit, i18n("$p = Password"), tab3 ); + + label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); + + layout->addWidget( label1, i, 0 ); + layout->addWidget( label2, i, 1 ); + i++; + layout->addWidget( label3, i, 0 ); + layout->addWidget( label4, i, 1 ); + i++; + layout->addWidget( label5, i, 0 ); + i++; + + layout->addWidget( label, i, 0 ); + layout->addWidget( launcherLineEdit, i, 1 ); + i++; + + + mTabWidget->addTab( tab3, i18n( "&Launcher" ) ); + + // signals and slots connections + connect( generateButton, SIGNAL( clicked() ), this, SLOT( generateButton_slot() ) ); + connect( revealButton, SIGNAL( toggled(bool) ), this, SLOT( revealButton_slot() ) ); + connect( advancedCommentButton, SIGNAL( toggled(bool) ), this, SLOT( advancedCommentButton_slot(bool) ) ); + +} + +/* + * Destroys the object and frees any allocated resources + */ +addEntryWnd::~addEntryWnd() +{ + // no need to delete child widgets, Qt does it all for us +} + +void addEntryWnd::slotOk() +{ + qWarning( "addEntryWnd::slotOk(): Not implemented yet" ); +} + +void addEntryWnd::revealButton_slot() +{ + qWarning( "addEntryWnd::revealButton_slot(): Not implemented yet" ); +} + +void addEntryWnd::generateButton_slot() +{ + qWarning( "addEntryWnd::generateButton_slot(): Not implemented yet" ); +} + +void addEntryWnd::advancedCommentButton_slot(bool) +{ + qWarning( "addEntryWnd::advancedCommentButton_slot(bool): Not implemented yet" ); +} + + diff --git a/pwmanager/pwmanager/addentrywnd_emb.h b/pwmanager/pwmanager/addentrywnd_emb.h new file mode 100644 index 0000000..e368721 --- a/dev/null +++ b/pwmanager/pwmanager/addentrywnd_emb.h @@ -0,0 +1,73 @@ +/* + 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 ADDENTRYWND_EMB_H +#define ADDENTRYWND_EMB_H + +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QSpacerItem; +class KLineEdit; +class QPushButton; +class KComboBox; +class QLabel; +class QGroupBox; + +class addEntryWnd : public KDialogBase +{ + Q_OBJECT + +public: + addEntryWnd( QWidget* parent = 0, const char* name = 0); + ~addEntryWnd(); + + KLineEdit* launcherLineEdit; + QPushButton* generateButton; + KLineEdit* descLineEdit; + KComboBox* categoryComboBox; + KLineEdit* usernameLineEdit; + KLineEdit* pwLineEdit; + KLineEdit* urlLineEdit; + + QPushButton* revealButton; + QGroupBox* groupBox1; + QLabel* commentDummy; + QPushButton* advancedCommentButton; + +public slots: + virtual void revealButton_slot(); + virtual void generateButton_slot(); + virtual void advancedCommentButton_slot(bool on); + + protected slots: + virtual void slotOk(); + +}; + +#endif // ADDENTRYWND_H diff --git a/pwmanager/pwmanager/pwgenwnd_emb.cpp b/pwmanager/pwmanager/pwgenwnd_emb.cpp new file mode 100644 index 0000000..9655e9f --- a/dev/null +++ b/pwmanager/pwmanager/pwgenwnd_emb.cpp @@ -0,0 +1,137 @@ +/* + 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 "pwgenwnd_emb.h" + +#include +#include +#include +#include +#include +#include +#include + +#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" ); + int_charLowerCheckBox->setChecked( TRUE ); + groupBox1Layout->addWidget( int_charLowerCheckBox ); + + int_charUpperCheckBox = new QCheckBox( i18n("Uppercase (ABC)"), groupBox1, "int_charUpperCheckBox" ); + int_charUpperCheckBox->setChecked( TRUE ); + groupBox1Layout->addWidget( int_charUpperCheckBox ); + + + int_charNumCheckBox = new QCheckBox( i18n("Numbers (123)"), groupBox1, "int_charNumCheckBox" ); + int_charNumCheckBox->setChecked( TRUE ); + groupBox1Layout->addWidget( int_charNumCheckBox ); + + int_charSpecCheckBox = new QCheckBox( i18n("Special characters:"), groupBox1, "int_charSpecCheckBox" ); + groupBox1Layout->addWidget( int_charSpecCheckBox ); + + QLabel* textLabel7 = new QLabel( groupBox1, "textLabel7" ); + QString st("\x21\x22\xc2\xa7\x24\x25\x26\x2f\x28\x29\x3d\x3f\x2c\x2e\x2d\x3b\x3a\x5f\x2b"); + textLabel7->setText( st.utf8() ); + groupBox1Layout->addWidget( textLabel7 ); + + int_charBlankCheckBox = new QCheckBox( i18n( "Spaces (blank characters)"), groupBox1, "int_charBlankCheckBox" ); + groupBox1Layout->addWidget( int_charBlankCheckBox ); + + QHBoxLayout* layout7 = new QHBoxLayout( 0, 0, 6, "layout7"); + + int_charUserCheckBox = new QCheckBox( i18n("User defined:"), groupBox1, "int_charUserCheckBox" ); + layout7->addWidget( int_charUserCheckBox ); + + int_userDefLineEdit = new QLineEdit( groupBox1, "int_userDefLineEdit" ); + int_userDefLineEdit->setEnabled( FALSE ); + layout7->addWidget( int_userDefLineEdit ); + groupBox1Layout->addLayout( layout7 ); + pwGenWndLayout->addWidget( groupBox1 ); + + + QHBoxLayout* layout8 = new QHBoxLayout( 0, 0, 6, "layout8"); + + int_lenSpinBox = new QSpinBox( page, "int_lenSpinBox" ); + QLabel* textLabel2 = new QLabel( int_lenSpinBox, i18n("Password Length:"), page, "textLabel2" ); + layout8->addWidget( textLabel2 ); + + int_lenSpinBox->setMaxValue( 9999 ); + int_lenSpinBox->setMinValue( 1 ); + int_lenSpinBox->setValue( 8 ); + layout8->addWidget( int_lenSpinBox ); + pwGenWndLayout->addLayout( layout8 ); + + int_filterCheckBox = new QCheckBox( i18n( "Enable Filtering to get better passwords" ), page, "int_filterCheckBox" ); + int_filterCheckBox->setChecked( TRUE ); + pwGenWndLayout->addWidget( int_filterCheckBox ); + + setButtonText( KDialogBase::Ok, "&Generate now" ); + + // signals and slots connections + connect( int_charUserCheckBox, SIGNAL( toggled(bool) ), int_userDefLineEdit, SLOT( setEnabled(bool) ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +pwGenWnd::~pwGenWnd() +{ + // no need to delete child widgets, Qt does it all for us +} + +void pwGenWnd::cancelButton_slot() +{ + qWarning( "pwGenWnd::cancelButton_slot(): Not implemented yet" ); +} + +void pwGenWnd::genButton_slot() +{ + qWarning( "pwGenWnd::genButton_slot(): Not implemented yet" ); +} + diff --git a/pwmanager/pwmanager/pwgenwnd_emb.h b/pwmanager/pwmanager/pwgenwnd_emb.h new file mode 100644 index 0000000..dcc1787 --- a/dev/null +++ b/pwmanager/pwmanager/pwgenwnd_emb.h @@ -0,0 +1,59 @@ +/* + 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 PWGENWND_EMB_H +#define PWGENWND_EMB_H + +#include + +class QLineEdit; +class QSpinBox; +class QCheckBox; + +class pwGenWnd : public KDialogBase +{ + Q_OBJECT + +public: + pwGenWnd( QWidget* parent = 0, const char* name = 0); + ~pwGenWnd(); + + QCheckBox* int_charLowerCheckBox; + QCheckBox* int_charUpperCheckBox; + QCheckBox* int_charNumCheckBox; + QCheckBox* int_charSpecCheckBox; + QCheckBox* int_charBlankCheckBox; + QCheckBox* int_charUserCheckBox; + QLineEdit* int_userDefLineEdit; + QSpinBox* int_lenSpinBox; + QCheckBox* int_filterCheckBox; + +public slots: + virtual void cancelButton_slot(); + virtual void genButton_slot(); + +}; + +#endif // PWGENWND_H -- cgit v0.9.0.2