summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/addentrywnd_emb.cpp
Side-by-side diff
Diffstat (limited to 'pwmanager/pwmanager/addentrywnd_emb.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/addentrywnd_emb.cpp45
1 files changed, 36 insertions, 9 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
@@ -24,6 +24,7 @@ $Id$
*/
#include "addentrywnd_emb.h"
+#include "pwmdoc.h"
#include <qlayout.h>
#include <qlabel.h>
@@ -42,10 +43,10 @@ $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)
+addEntryWnd::addEntryWnd( PwMDoc* d, QWidget* parent, const char* name)
: KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ),
KDialogBase::Ok | KDialogBase::Cancel,
- KDialogBase::Ok, parent, name, true )
+ KDialogBase::Ok, parent, name, true ), doc(d)
{
QWidget *page = plainPage();
QVBoxLayout *pageLayout = new QVBoxLayout( page );
@@ -65,13 +66,13 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name)
int i = 0;
descLineEdit = new KLineEdit( tab1, "descLineEdit" );
- QLabel* label = new QLabel( descLineEdit, i18n("Description:"), tab1 );
- layout->addWidget( label, i, 0 );
+ descLineLabel = new QLabel( descLineEdit, i18n("Description:"), tab1 );
+ layout->addWidget( descLineLabel, i, 0 );
layout->addWidget( descLineEdit, i, 1 );
i++;
categoryComboBox = new KComboBox( tab1 );
- label = new QLabel( categoryComboBox, i18n("Category:"), tab1 );
+ QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), tab1 );
layout->addWidget( label, i, 0 );
layout->addWidget( categoryComboBox, i, 1 );
i++;
@@ -79,17 +80,19 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name)
categoryComboBox->setSizeLimit( 100 );
categoryComboBox->setAutoCompletion( TRUE );
categoryComboBox->setDuplicatesEnabled( FALSE );
+ connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&)));
+
usernameLineEdit = new KLineEdit( tab1, "usernameLineEdit" );
- label = new QLabel( usernameLineEdit, i18n("Username:"), tab1 );
- layout->addWidget( label, i, 0 );
+ usernameLineLabel = new QLabel( usernameLineEdit, i18n("Username:"), tab1 );
+ layout->addWidget( usernameLineLabel, 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 );
+ pwLineLabel = new QLabel( pwLineEdit, i18n("Password:"), tab1 );
+ layout->addWidget( pwLineLabel, i, 0 );
layout->addWidget( pwLineEdit, i, 1 );
i++;
@@ -196,4 +199,28 @@ void addEntryWnd::advancedCommentButton_slot(bool)
qWarning( "addEntryWnd::advancedCommentButton_slot(bool): Not implemented yet" );
}
+void addEntryWnd::categorySelected ( const QString & string )
+{
+ unsigned int idx;
+ bool found = doc->findCategory(string, &idx);
+
+ if (found == true)
+ {
+ qDebug("addEntryWnd::categorySelected found");
+ PwMCategoryItem* catitem = doc->getCategoryEntry(idx);
+
+ descLineLabel->setText(catitem->desc_text.c_str());
+ usernameLineLabel->setText(catitem->name_text.c_str());
+ pwLineLabel->setText(catitem->pw_text.c_str());
+ return;
+ }
+ else
+ {
+ qDebug("addEntryWnd::categorySelected NOT found");
+ BUG();
+ }
+
+
+}
+