author | ulf69 <ulf69> | 2004-10-29 05:20:48 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-29 05:20:48 (UTC) |
commit | 41e3625b8c38ff45e70b59416a519d59a5f4d937 (patch) (side-by-side diff) | |
tree | 587b57d51bc77a699fd63cf10e53bf6f9f72a1b7 | |
parent | 08a4582f8e5184b8abb7d97781c4fc37ee7edf90 (diff) | |
download | kdepimpi-41e3625b8c38ff45e70b59416a519d59a5f4d937.zip kdepimpi-41e3625b8c38ff45e70b59416a519d59a5f4d937.tar.gz kdepimpi-41e3625b8c38ff45e70b59416a519d59a5f4d937.tar.bz2 |
display alternating category text in the add/edit dialogbox
-rw-r--r-- | pwmanager/pwmanager/addentrywnd_emb.cpp | 45 | ||||
-rw-r--r-- | pwmanager/pwmanager/addentrywnd_emb.h | 8 | ||||
-rw-r--r-- | pwmanager/pwmanager/addentrywndimpl.cpp | 7 | ||||
-rw-r--r-- | pwmanager/pwmanager/addentrywndimpl.h | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 4 |
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 @@ -25,4 +25,5 @@ $Id$ #include "addentrywnd_emb.h" +#include "pwmdoc.h" #include <qlayout.h> @@ -43,8 +44,8 @@ $Id$ * 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(); @@ -66,11 +67,11 @@ 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 ); @@ -80,8 +81,10 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name) 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++; @@ -89,6 +92,6 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name) 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++; @@ -197,3 +200,27 @@ void addEntryWnd::advancedCommentButton_slot(bool) } +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(); + } + + +} + 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 @@ -40,4 +40,5 @@ class QLabel; class QGroupBox; class QMultiLineEdit; +class PwMDoc; class addEntryWnd : public KDialogBase @@ -46,5 +47,5 @@ class addEntryWnd : public KDialogBase public: - addEntryWnd( QWidget* parent = 0, const char* name = 0); + addEntryWnd( PwMDoc* doc, QWidget* parent = 0, const char* name = 0); ~addEntryWnd(); @@ -56,7 +57,11 @@ public: KLineEdit* pwLineEdit; KLineEdit* urlLineEdit; + QLabel* descLineLabel; + QLabel* usernameLineLabel; + QLabel* pwLineLabel; QPushButton* revealButton; QMultiLineEdit* commentTextEdit; + PwMDoc* doc; public slots: @@ -67,4 +72,5 @@ public slots: protected slots: virtual void slotOk(); + virtual void categorySelected ( const QString & string ); }; 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 @@ -41,6 +41,6 @@ AddEntryWndImpl::AddEntryWndImpl() : addEntryWnd( 0, "AddEntryWndImpl", TRUE) #else -AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name) - : addEntryWnd( parent, name) +AddEntryWndImpl::AddEntryWndImpl( PwMDoc* doc, QWidget* parent, const char* name) + : addEntryWnd( doc, parent, name) #endif { @@ -116,4 +116,7 @@ void AddEntryWndImpl::setCurrCategory(const QString &cat) if (categoryComboBox->text(i) == cat) { categoryComboBox->setCurrentItem(i); +#ifdef PWM_EMBEDDED + categorySelected(cat); +#endif return; } 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 @@ -46,5 +46,5 @@ public: AddEntryWndImpl(); #else - AddEntryWndImpl( QWidget* parent = 0, const char* name = 0); + AddEntryWndImpl( PwMDoc* doc, QWidget* parent = 0, const char* name = 0); #endif ~AddEntryWndImpl(); 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 @@ -634,5 +634,5 @@ void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc) AddEntryWndImpl w; #else - AddEntryWndImpl w(this, "addentrywndimpl"); + AddEntryWndImpl w(doc, this, "addentrywndimpl"); #endif @@ -733,5 +733,5 @@ void PwM::editPwd_slot3(const QString *category, const int *index, BUG_ON(currItem.binary); - AddEntryWndImpl w; + AddEntryWndImpl w(doc); vector<string> catList; doc->getCategoryList(&catList); |