summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/addentrywnd_emb.cpp45
-rw-r--r--pwmanager/pwmanager/addentrywnd_emb.h8
-rw-r--r--pwmanager/pwmanager/addentrywndimpl.cpp7
-rw-r--r--pwmanager/pwmanager/addentrywndimpl.h2
-rw-r--r--pwmanager/pwmanager/pwm.cpp4
5 files changed, 51 insertions, 15 deletions
diff --git a/pwmanager/pwmanager/addentrywnd_emb.cpp b/pwmanager/pwmanager/addentrywnd_emb.cpp
index dd09d13..f065058 100644
--- a/pwmanager/pwmanager/addentrywnd_emb.cpp
+++ b/pwmanager/pwmanager/addentrywnd_emb.cpp
@@ -3,114 +3,117 @@
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22 22
23$Id$ 23$Id$
24*/ 24*/
25 25
26#include "addentrywnd_emb.h" 26#include "addentrywnd_emb.h"
27#include "pwmdoc.h"
27 28
28#include <qlayout.h> 29#include <qlayout.h>
29#include <qlabel.h> 30#include <qlabel.h>
30#include <qtabwidget.h> 31#include <qtabwidget.h>
31#include <qgroupbox.h> 32#include <qgroupbox.h>
32#include <klocale.h> 33#include <klocale.h>
33#include <kcombobox.h> 34#include <kcombobox.h>
34#include <klineedit.h> 35#include <klineedit.h>
35#include <qpushbutton.h> 36#include <qpushbutton.h>
36#include <qmultilineedit.h> 37#include <qmultilineedit.h>
37 38
38/* 39/*
39 * Constructs a addEntryWnd as a child of 'parent', with the 40 * Constructs a addEntryWnd as a child of 'parent', with the
40 * name 'name' and widget flags set to 'f'. 41 * name 'name' and widget flags set to 'f'.
41 * 42 *
42 * The dialog will by default be modeless, unless you set 'modal' to 43 * The dialog will by default be modeless, unless you set 'modal' to
43 * TRUE to construct a modal dialog. 44 * TRUE to construct a modal dialog.
44 */ 45 */
45addEntryWnd::addEntryWnd( QWidget* parent, const char* name) 46addEntryWnd::addEntryWnd( PwMDoc* d, QWidget* parent, const char* name)
46 : KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ), 47 : KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ),
47 KDialogBase::Ok | KDialogBase::Cancel, 48 KDialogBase::Ok | KDialogBase::Cancel,
48 KDialogBase::Ok, parent, name, true ) 49 KDialogBase::Ok, parent, name, true ), doc(d)
49{ 50{
50 QWidget *page = plainPage(); 51 QWidget *page = plainPage();
51 QVBoxLayout *pageLayout = new QVBoxLayout( page ); 52 QVBoxLayout *pageLayout = new QVBoxLayout( page );
52 53
53 QTabWidget* mTabWidget = new QTabWidget( page ); 54 QTabWidget* mTabWidget = new QTabWidget( page );
54 pageLayout->addWidget( mTabWidget ); 55 pageLayout->addWidget( mTabWidget );
55 56
56 //////////////////////////////////////////////////////////////////// 57 ////////////////////////////////////////////////////////////////////
57 // This is the Password tab 58 // This is the Password tab
58 QWidget *tab1 = new QWidget( mTabWidget ); 59 QWidget *tab1 = new QWidget( mTabWidget );
59 60
60 QGridLayout *layout = new QGridLayout( tab1, 3, 1 ); 61 QGridLayout *layout = new QGridLayout( tab1, 3, 1 );
61 layout->setMargin( KDialogBase::marginHint() ); 62 layout->setMargin( KDialogBase::marginHint() );
62 layout->setSpacing( KDialogBase::spacingHint() ); 63 layout->setSpacing( KDialogBase::spacingHint() );
63 64
64 65
65 66
66 int i = 0; 67 int i = 0;
67 descLineEdit = new KLineEdit( tab1, "descLineEdit" ); 68 descLineEdit = new KLineEdit( tab1, "descLineEdit" );
68 QLabel* label = new QLabel( descLineEdit, i18n("Description:"), tab1 ); 69 descLineLabel = new QLabel( descLineEdit, i18n("Description:"), tab1 );
69 layout->addWidget( label, i, 0 ); 70 layout->addWidget( descLineLabel, i, 0 );
70 layout->addWidget( descLineEdit, i, 1 ); 71 layout->addWidget( descLineEdit, i, 1 );
71 i++; 72 i++;
72 73
73 categoryComboBox = new KComboBox( tab1 ); 74 categoryComboBox = new KComboBox( tab1 );
74 label = new QLabel( categoryComboBox, i18n("Category:"), tab1 ); 75 QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), tab1 );
75 layout->addWidget( label, i, 0 ); 76 layout->addWidget( label, i, 0 );
76 layout->addWidget( categoryComboBox, i, 1 ); 77 layout->addWidget( categoryComboBox, i, 1 );
77 i++; 78 i++;
78 categoryComboBox->setEditable( TRUE ); 79 categoryComboBox->setEditable( TRUE );
79 categoryComboBox->setSizeLimit( 100 ); 80 categoryComboBox->setSizeLimit( 100 );
80 categoryComboBox->setAutoCompletion( TRUE ); 81 categoryComboBox->setAutoCompletion( TRUE );
81 categoryComboBox->setDuplicatesEnabled( FALSE ); 82 categoryComboBox->setDuplicatesEnabled( FALSE );
83 connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&)));
84
82 85
83 usernameLineEdit = new KLineEdit( tab1, "usernameLineEdit" ); 86 usernameLineEdit = new KLineEdit( tab1, "usernameLineEdit" );
84 label = new QLabel( usernameLineEdit, i18n("Username:"), tab1 ); 87 usernameLineLabel = new QLabel( usernameLineEdit, i18n("Username:"), tab1 );
85 layout->addWidget( label, i, 0 ); 88 layout->addWidget( usernameLineLabel, i, 0 );
86 layout->addWidget( usernameLineEdit, i, 1 ); 89 layout->addWidget( usernameLineEdit, i, 1 );
87 i++; 90 i++;
88 91
89 pwLineEdit = new KLineEdit( tab1, "pwLineEdit" ); 92 pwLineEdit = new KLineEdit( tab1, "pwLineEdit" );
90 pwLineEdit->setEchoMode( QLineEdit::Password ); 93 pwLineEdit->setEchoMode( QLineEdit::Password );
91 label = new QLabel( pwLineEdit, i18n("Password:"), tab1 ); 94 pwLineLabel = new QLabel( pwLineEdit, i18n("Password:"), tab1 );
92 layout->addWidget( label, i, 0 ); 95 layout->addWidget( pwLineLabel, i, 0 );
93 layout->addWidget( pwLineEdit, i, 1 ); 96 layout->addWidget( pwLineEdit, i, 1 );
94 i++; 97 i++;
95 98
96 revealButton = new QPushButton( i18n("&Reveal"), tab1, "revealButton" ); 99 revealButton = new QPushButton( i18n("&Reveal"), tab1, "revealButton" );
97 revealButton->setToggleButton( TRUE ); 100 revealButton->setToggleButton( TRUE );
98 layout->addWidget( revealButton, i, 0 ); 101 layout->addWidget( revealButton, i, 0 );
99 102
100 generateButton = new QPushButton( i18n("&Generate"), tab1, "generateButton" ); 103 generateButton = new QPushButton( i18n("&Generate"), tab1, "generateButton" );
101 layout->addWidget( generateButton, i, 1 ); 104 layout->addWidget( generateButton, i, 1 );
102 i++; 105 i++;
103 106
104 urlLineEdit = new KLineEdit( tab1, "urlLineEdit" ); 107 urlLineEdit = new KLineEdit( tab1, "urlLineEdit" );
105 label = new QLabel( urlLineEdit, i18n("URL:"), tab1 ); 108 label = new QLabel( urlLineEdit, i18n("URL:"), tab1 );
106 layout->addWidget( label, i, 0 ); 109 layout->addWidget( label, i, 0 );
107 layout->addWidget( urlLineEdit, i, 1 ); 110 layout->addWidget( urlLineEdit, i, 1 );
108 i++; 111 i++;
109 112
110 mTabWidget->addTab( tab1, i18n( "&Password" ) ); 113 mTabWidget->addTab( tab1, i18n( "&Password" ) );
111 114
112 115
113 //////////////////////////////////////////////////////////////////// 116 ////////////////////////////////////////////////////////////////////
114 // This is the Comment tab 117 // This is the Comment tab
115 QWidget *tab2 = new QWidget( mTabWidget ); 118 QWidget *tab2 = new QWidget( mTabWidget );
116 119
@@ -175,25 +178,49 @@ addEntryWnd::~addEntryWnd()
175{ 178{
176 // no need to delete child widgets, Qt does it all for us 179 // no need to delete child widgets, Qt does it all for us
177} 180}
178 181
179void addEntryWnd::slotOk() 182void addEntryWnd::slotOk()
180{ 183{
181 qWarning( "addEntryWnd::slotOk(): Not implemented yet" ); 184 qWarning( "addEntryWnd::slotOk(): Not implemented yet" );
182} 185}
183 186
184void addEntryWnd::revealButton_slot() 187void addEntryWnd::revealButton_slot()
185{ 188{
186 qWarning( "addEntryWnd::revealButton_slot(): Not implemented yet" ); 189 qWarning( "addEntryWnd::revealButton_slot(): Not implemented yet" );
187} 190}
188 191
189void addEntryWnd::generateButton_slot() 192void addEntryWnd::generateButton_slot()
190{ 193{
191 qWarning( "addEntryWnd::generateButton_slot(): Not implemented yet" ); 194 qWarning( "addEntryWnd::generateButton_slot(): Not implemented yet" );
192} 195}
193 196
194void addEntryWnd::advancedCommentButton_slot(bool) 197void addEntryWnd::advancedCommentButton_slot(bool)
195{ 198{
196 qWarning( "addEntryWnd::advancedCommentButton_slot(bool): Not implemented yet" ); 199 qWarning( "addEntryWnd::advancedCommentButton_slot(bool): Not implemented yet" );
197} 200}
198 201
202void addEntryWnd::categorySelected ( const QString & string )
203{
204 unsigned int idx;
205 bool found = doc->findCategory(string, &idx);
206
207 if (found == true)
208 {
209 qDebug("addEntryWnd::categorySelected found");
210 PwMCategoryItem* catitem = doc->getCategoryEntry(idx);
211
212 descLineLabel->setText(catitem->desc_text.c_str());
213 usernameLineLabel->setText(catitem->name_text.c_str());
214 pwLineLabel->setText(catitem->pw_text.c_str());
215 return;
216 }
217 else
218 {
219 qDebug("addEntryWnd::categorySelected NOT found");
220 BUG();
221 }
222
223
224}
225
199 226
diff --git a/pwmanager/pwmanager/addentrywnd_emb.h b/pwmanager/pwmanager/addentrywnd_emb.h
index 83761dc..966d9d2 100644
--- a/pwmanager/pwmanager/addentrywnd_emb.h
+++ b/pwmanager/pwmanager/addentrywnd_emb.h
@@ -18,55 +18,61 @@
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22 22
23$Id$ 23$Id$
24*/ 24*/
25 25
26#ifndef ADDENTRYWND_EMB_H 26#ifndef ADDENTRYWND_EMB_H
27#define ADDENTRYWND_EMB_H 27#define ADDENTRYWND_EMB_H
28 28
29#include <qvariant.h> 29#include <qvariant.h>
30#include <kdialogbase.h> 30#include <kdialogbase.h>
31 31
32class QVBoxLayout; 32class QVBoxLayout;
33class QHBoxLayout; 33class QHBoxLayout;
34class QGridLayout; 34class QGridLayout;
35class QSpacerItem; 35class QSpacerItem;
36class KLineEdit; 36class KLineEdit;
37class QPushButton; 37class QPushButton;
38class KComboBox; 38class KComboBox;
39class QLabel; 39class QLabel;
40class QGroupBox; 40class QGroupBox;
41class QMultiLineEdit; 41class QMultiLineEdit;
42class PwMDoc;
42 43
43class addEntryWnd : public KDialogBase 44class addEntryWnd : public KDialogBase
44{ 45{
45 Q_OBJECT 46 Q_OBJECT
46 47
47public: 48public:
48 addEntryWnd( QWidget* parent = 0, const char* name = 0); 49 addEntryWnd( PwMDoc* doc, QWidget* parent = 0, const char* name = 0);
49 ~addEntryWnd(); 50 ~addEntryWnd();
50 51
51 KLineEdit* launcherLineEdit; 52 KLineEdit* launcherLineEdit;
52 QPushButton* generateButton; 53 QPushButton* generateButton;
53 KLineEdit* descLineEdit; 54 KLineEdit* descLineEdit;
54 KComboBox* categoryComboBox; 55 KComboBox* categoryComboBox;
55 KLineEdit* usernameLineEdit; 56 KLineEdit* usernameLineEdit;
56 KLineEdit* pwLineEdit; 57 KLineEdit* pwLineEdit;
57 KLineEdit* urlLineEdit; 58 KLineEdit* urlLineEdit;
59 QLabel* descLineLabel;
60 QLabel* usernameLineLabel;
61 QLabel* pwLineLabel;
58 62
59 QPushButton* revealButton; 63 QPushButton* revealButton;
60 QMultiLineEdit* commentTextEdit; 64 QMultiLineEdit* commentTextEdit;
65 PwMDoc* doc;
61 66
62public slots: 67public slots:
63 virtual void revealButton_slot(); 68 virtual void revealButton_slot();
64 virtual void generateButton_slot(); 69 virtual void generateButton_slot();
65 virtual void advancedCommentButton_slot(bool on); 70 virtual void advancedCommentButton_slot(bool on);
66 71
67 protected slots: 72 protected slots:
68 virtual void slotOk(); 73 virtual void slotOk();
74 virtual void categorySelected ( const QString & string );
69 75
70}; 76};
71 77
72#endif // ADDENTRYWND_H 78#endif // ADDENTRYWND_H
diff --git a/pwmanager/pwmanager/addentrywndimpl.cpp b/pwmanager/pwmanager/addentrywndimpl.cpp
index d47f32c..fa6b6c0 100644
--- a/pwmanager/pwmanager/addentrywndimpl.cpp
+++ b/pwmanager/pwmanager/addentrywndimpl.cpp
@@ -19,50 +19,50 @@
19 * 19 *
20 * $Id$ 20 * $Id$
21 **************************************************************************/ 21 **************************************************************************/
22 22
23#include "addentrywndimpl.h" 23#include "addentrywndimpl.h"
24#include "pwmexception.h" 24#include "pwmexception.h"
25#include "pwgenwndimpl.h" 25#include "pwgenwndimpl.h"
26#ifndef PWM_EMBEDDED 26#ifndef PWM_EMBEDDED
27#include "advcommeditimpl.h" 27#include "advcommeditimpl.h"
28#endif 28#endif
29#include "htmlgen.h" 29#include "htmlgen.h"
30 30
31#include <kmessagebox.h> 31#include <kmessagebox.h>
32#include <klocale.h> 32#include <klocale.h>
33 33
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlayout.h> 36#include <qlayout.h>
37 37
38 38
39#ifndef PWM_EMBEDDED 39#ifndef PWM_EMBEDDED
40AddEntryWndImpl::AddEntryWndImpl() 40AddEntryWndImpl::AddEntryWndImpl()
41 : addEntryWnd( 0, "AddEntryWndImpl", TRUE) 41 : addEntryWnd( 0, "AddEntryWndImpl", TRUE)
42#else 42#else
43AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name) 43AddEntryWndImpl::AddEntryWndImpl( PwMDoc* doc, QWidget* parent, const char* name)
44 : addEntryWnd( parent, name) 44 : addEntryWnd( doc, parent, name)
45#endif 45#endif
46{ 46{
47#ifndef PWM_EMBEDDED 47#ifndef PWM_EMBEDDED
48 editAdvCommentButton = 0; 48 editAdvCommentButton = 0;
49 commentTextEdit = 0; 49 commentTextEdit = 0;
50#endif 50#endif
51 switchComment(false); 51 switchComment(false);
52 pwGen = new PwGenWndImpl(this); 52 pwGen = new PwGenWndImpl(this);
53} 53}
54 54
55AddEntryWndImpl::~AddEntryWndImpl() 55AddEntryWndImpl::~AddEntryWndImpl()
56{ 56{
57#ifndef PWM_EMBEDDED 57#ifndef PWM_EMBEDDED
58 delete_ifnot_null(editAdvCommentButton); 58 delete_ifnot_null(editAdvCommentButton);
59 delete_ifnot_null(commentTextEdit); 59 delete_ifnot_null(commentTextEdit);
60#endif 60#endif
61 delete pwGen; 61 delete pwGen;
62} 62}
63 63
64#ifdef PWM_EMBEDDED 64#ifdef PWM_EMBEDDED
65void AddEntryWndImpl::slotOk() 65void AddEntryWndImpl::slotOk()
66{ 66{
67 slotApply(); 67 slotApply();
68 68
@@ -94,48 +94,51 @@ void AddEntryWndImpl::okButton_slot()
94 } 94 }
95 if (descLineEdit->text().isEmpty()) { 95 if (descLineEdit->text().isEmpty()) {
96 KMessageBox::error(this, 96 KMessageBox::error(this,
97 i18n 97 i18n
98 ("You haven't set a \"Description\"."), 98 ("You haven't set a \"Description\"."),
99 i18n("Description not set")); 99 i18n("Description not set"));
100 return; 100 return;
101 } 101 }
102 done(1); 102 done(1);
103} 103}
104 104
105void AddEntryWndImpl::cancelButton_slot() 105void AddEntryWndImpl::cancelButton_slot()
106{ 106{
107 done(2); 107 done(2);
108} 108}
109#endif 109#endif
110 110
111void AddEntryWndImpl::setCurrCategory(const QString &cat) 111void AddEntryWndImpl::setCurrCategory(const QString &cat)
112{ 112{
113 int i, count = categoryComboBox->count(); 113 int i, count = categoryComboBox->count();
114 114
115 for (i = 0; i < count; ++i) { 115 for (i = 0; i < count; ++i) {
116 if (categoryComboBox->text(i) == cat) { 116 if (categoryComboBox->text(i) == cat) {
117 categoryComboBox->setCurrentItem(i); 117 categoryComboBox->setCurrentItem(i);
118#ifdef PWM_EMBEDDED
119 categorySelected(cat);
120#endif
118 return; 121 return;
119 } 122 }
120 } 123 }
121 BUG(); 124 BUG();
122} 125}
123 126
124void AddEntryWndImpl::revealButton_slot() 127void AddEntryWndImpl::revealButton_slot()
125{ 128{
126 if (revealButton->isOn()) { 129 if (revealButton->isOn()) {
127 pwLineEdit->setEchoMode(QLineEdit::Normal); 130 pwLineEdit->setEchoMode(QLineEdit::Normal);
128 } else { 131 } else {
129 pwLineEdit->setEchoMode(QLineEdit::Password); 132 pwLineEdit->setEchoMode(QLineEdit::Password);
130 } 133 }
131} 134}
132 135
133void AddEntryWndImpl::generateButton_slot() 136void AddEntryWndImpl::generateButton_slot()
134{ 137{
135 if (!pwGen->exec()) 138 if (!pwGen->exec())
136 return; 139 return;
137 setPassword(pwGen->getPassword()); 140 setPassword(pwGen->getPassword());
138} 141}
139 142
140QString AddEntryWndImpl::getComment() 143QString AddEntryWndImpl::getComment()
141{ 144{
diff --git a/pwmanager/pwmanager/addentrywndimpl.h b/pwmanager/pwmanager/addentrywndimpl.h
index ce9a594..e13eb54 100644
--- a/pwmanager/pwmanager/addentrywndimpl.h
+++ b/pwmanager/pwmanager/addentrywndimpl.h
@@ -24,49 +24,49 @@
24#ifndef PWM_EMBEDDED 24#ifndef PWM_EMBEDDED
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qtextedit.h> 26#include <qtextedit.h>
27#include <qcombobox.h> 27#include <qcombobox.h>
28#include "addentrywnd.h" 28#include "addentrywnd.h"
29#else 29#else
30#include <klineedit.h> 30#include <klineedit.h>
31#include <kcombobox.h> 31#include <kcombobox.h>
32#include <qmultilineedit.h> 32#include <qmultilineedit.h>
33#include "addentrywnd_emb.h" 33#include "addentrywnd_emb.h"
34#endif 34#endif
35 35
36#include <qpushbutton.h> 36#include <qpushbutton.h>
37 37
38class PwGenWndImpl; 38class PwGenWndImpl;
39 39
40/** "add/edit" Window */ 40/** "add/edit" Window */
41class AddEntryWndImpl : public addEntryWnd 41class AddEntryWndImpl : public addEntryWnd
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44public: 44public:
45#ifndef PWM_EMBEDDED 45#ifndef PWM_EMBEDDED
46 AddEntryWndImpl(); 46 AddEntryWndImpl();
47#else 47#else
48 AddEntryWndImpl( QWidget* parent = 0, const char* name = 0); 48 AddEntryWndImpl( PwMDoc* doc, QWidget* parent = 0, const char* name = 0);
49#endif 49#endif
50 ~AddEntryWndImpl(); 50 ~AddEntryWndImpl();
51 51
52 /* get... functions */ 52 /* get... functions */
53 QString getDescription() 53 QString getDescription()
54 { return descLineEdit->text(); } 54 { return descLineEdit->text(); }
55 QString getCategory() 55 QString getCategory()
56 { return categoryComboBox->currentText(); } 56 { return categoryComboBox->currentText(); }
57 QString getUsername() 57 QString getUsername()
58 { return usernameLineEdit->text(); } 58 { return usernameLineEdit->text(); }
59 QString getPassword() 59 QString getPassword()
60 { return pwLineEdit->text(); } 60 { return pwLineEdit->text(); }
61 QString getUrl() 61 QString getUrl()
62 { return urlLineEdit->text(); } 62 { return urlLineEdit->text(); }
63 QString getLauncher() 63 QString getLauncher()
64 { return launcherLineEdit->text(); } 64 { return launcherLineEdit->text(); }
65 QString getComment(); 65 QString getComment();
66 66
67 /* set... functions */ 67 /* set... functions */
68 void setDescription(const QString &desc) 68 void setDescription(const QString &desc)
69 { descLineEdit->setText(desc); } 69 { descLineEdit->setText(desc); }
70 void setCurrCategory(const QString &cat); 70 void setCurrCategory(const QString &cat);
71 void addCategory(const QString &cat) 71 void addCategory(const QString &cat)
72 { categoryComboBox->insertItem(cat); } 72 { categoryComboBox->insertItem(cat); }
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index bd98d72..9642a43 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -612,49 +612,49 @@ bool PwM::saveAs()
612 showStatMsg(i18n("Successfully saved data.")); 612 showStatMsg(i18n("Successfully saved data."));
613 updateCaption(); 613 updateCaption();
614 return true; 614 return true;
615} 615}
616 616
617//US ENH : changed code to run with older MOC 617//US ENH : changed code to run with older MOC
618void PwM::addPwd_slot() 618void PwM::addPwd_slot()
619{ 619{
620 addPwd_slot1(0, 0); 620 addPwd_slot1(0, 0);
621} 621}
622 622
623void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc) 623void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc)
624{ 624{
625 PwMDoc *doc; 625 PwMDoc *doc;
626 if (_doc) { 626 if (_doc) {
627 doc = _doc; 627 doc = _doc;
628 } else { 628 } else {
629 doc = curDoc(); 629 doc = curDoc();
630 } 630 }
631 PWM_ASSERT(doc); 631 PWM_ASSERT(doc);
632 doc->timer()->getLock(DocTimer::id_autoLockTimer); 632 doc->timer()->getLock(DocTimer::id_autoLockTimer);
633#ifndef PWM_EMBEDDED 633#ifndef PWM_EMBEDDED
634 AddEntryWndImpl w; 634 AddEntryWndImpl w;
635#else 635#else
636 AddEntryWndImpl w(this, "addentrywndimpl"); 636 AddEntryWndImpl w(doc, this, "addentrywndimpl");
637#endif 637#endif
638 638
639 vector<string> catList; 639 vector<string> catList;
640 doc->getCategoryList(&catList); 640 doc->getCategoryList(&catList);
641 unsigned i, size = catList.size(); 641 unsigned i, size = catList.size();
642 for (i = 0; i < size; ++i) { 642 for (i = 0; i < size; ++i) {
643 w.addCategory(catList[i].c_str()); 643 w.addCategory(catList[i].c_str());
644 } 644 }
645 w.setCurrCategory(view->getCurrentCategory()); 645 w.setCurrCategory(view->getCurrentCategory());
646 if (pw) 646 if (pw)
647 w.pwLineEdit->setText(*pw); 647 w.pwLineEdit->setText(*pw);
648 648
649 tryAgain: 649 tryAgain:
650 if (w.exec() == 1) 650 if (w.exec() == 1)
651 { 651 {
652 PwMDataItem d; 652 PwMDataItem d;
653 653
654 //US BUG: to initialize all values of curEntr with meaningfulldata, 654 //US BUG: to initialize all values of curEntr with meaningfulldata,
655 // we call clear on it. Reason: Metadata will be uninitialized otherwise. 655 // we call clear on it. Reason: Metadata will be uninitialized otherwise.
656 // another option would be to create a constructor for PwMDataItem 656 // another option would be to create a constructor for PwMDataItem
657 d.clear(true); 657 d.clear(true);
658 658
659 d.desc = w.getDescription().latin1(); 659 d.desc = w.getDescription().latin1();
660 d.name = w.getUsername().latin1(); 660 d.name = w.getUsername().latin1();
@@ -711,49 +711,49 @@ void PwM::editPwd_slot3(const QString *category, const int *index,
711 doc->timer()->getLock(DocTimer::id_autoLockTimer); 711 doc->timer()->getLock(DocTimer::id_autoLockTimer);
712 unsigned int curEntryIndex; 712 unsigned int curEntryIndex;
713 if (index) { 713 if (index) {
714 curEntryIndex = *index; 714 curEntryIndex = *index;
715 } else { 715 } else {
716 if (!(view->getCurEntryIndex(&curEntryIndex))) { 716 if (!(view->getCurEntryIndex(&curEntryIndex))) {
717 printDebug("couldn't get index. Maybe we have a binary entry here."); 717 printDebug("couldn't get index. Maybe we have a binary entry here.");
718 doc->timer()->putLock(DocTimer::id_autoLockTimer); 718 doc->timer()->putLock(DocTimer::id_autoLockTimer);
719 return; 719 return;
720 } 720 }
721 } 721 }
722 QString curCategory; 722 QString curCategory;
723 if (category) { 723 if (category) {
724 curCategory = *category; 724 curCategory = *category;
725 } else { 725 } else {
726 curCategory = view->getCurrentCategory(); 726 curCategory = view->getCurrentCategory();
727 } 727 }
728 PwMDataItem currItem; 728 PwMDataItem currItem;
729 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { 729 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) {
730 doc->timer()->putLock(DocTimer::id_autoLockTimer); 730 doc->timer()->putLock(DocTimer::id_autoLockTimer);
731 return; 731 return;
732 } 732 }
733 BUG_ON(currItem.binary); 733 BUG_ON(currItem.binary);
734 734
735 AddEntryWndImpl w; 735 AddEntryWndImpl w(doc);
736 vector<string> catList; 736 vector<string> catList;
737 doc->getCategoryList(&catList); 737 doc->getCategoryList(&catList);
738 unsigned i, size = catList.size(); 738 unsigned i, size = catList.size();
739 for (i = 0; i < size; ++i) { 739 for (i = 0; i < size; ++i) {
740 w.addCategory(catList[i].c_str()); 740 w.addCategory(catList[i].c_str());
741 } 741 }
742 w.setCurrCategory(curCategory); 742 w.setCurrCategory(curCategory);
743 w.setDescription(currItem.desc.c_str()); 743 w.setDescription(currItem.desc.c_str());
744 w.setUsername(currItem.name.c_str()); 744 w.setUsername(currItem.name.c_str());
745 w.setPassword(currItem.pw.c_str()); 745 w.setPassword(currItem.pw.c_str());
746 w.setUrl(currItem.url.c_str()); 746 w.setUrl(currItem.url.c_str());
747 w.setLauncher(currItem.launcher.c_str()); 747 w.setLauncher(currItem.launcher.c_str());
748 w.setComment(currItem.comment.c_str()); 748 w.setComment(currItem.comment.c_str());
749 if (w.exec() == 1) { 749 if (w.exec() == 1) {
750 currItem.desc = w.getDescription().latin1(); 750 currItem.desc = w.getDescription().latin1();
751 currItem.name = w.getUsername().latin1(); 751 currItem.name = w.getUsername().latin1();
752 currItem.pw = w.getPassword().latin1(); 752 currItem.pw = w.getPassword().latin1();
753 currItem.comment = w.getComment().latin1(); 753 currItem.comment = w.getComment().latin1();
754 currItem.url = w.getUrl().latin1(); 754 currItem.url = w.getUrl().latin1();
755 currItem.launcher = w.getLauncher().latin1(); 755 currItem.launcher = w.getLauncher().latin1();
756 if (!doc->editEntry(curCategory, w.getCategory(), 756 if (!doc->editEntry(curCategory, w.getCategory(),
757 curEntryIndex, &currItem)) { 757 curEntryIndex, &currItem)) {
758 KMessageBox::error(this, 758 KMessageBox::error(this,
759 i18n("Couldn't edit the entry.\n" 759 i18n("Couldn't edit the entry.\n"