-rw-r--r-- | pwmanager/pwmanager/addentrywnd_emb.cpp | 7 | ||||
-rw-r--r-- | pwmanager/pwmanager/commentbox.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmview.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle.cpp | 11 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle.h | 11 |
6 files changed, 30 insertions, 3 deletions
diff --git a/pwmanager/pwmanager/addentrywnd_emb.cpp b/pwmanager/pwmanager/addentrywnd_emb.cpp index f065058..c2590f0 100644 --- a/pwmanager/pwmanager/addentrywnd_emb.cpp +++ b/pwmanager/pwmanager/addentrywnd_emb.cpp @@ -160,24 +160,31 @@ addEntryWnd::addEntryWnd( PwMDoc* d, QWidget* parent, const char* name) 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() ) ); + +#if 0 + if ( QApplication::desktop()->width() <= 640 && QApplication::desktop()->width() >= 480 ) { + resize ( 440, 400 ); + } +#endif + } /* * 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() { diff --git a/pwmanager/pwmanager/commentbox.cpp b/pwmanager/pwmanager/commentbox.cpp index e2d2d2b..0f32561 100644 --- a/pwmanager/pwmanager/commentbox.cpp +++ b/pwmanager/pwmanager/commentbox.cpp @@ -223,24 +223,25 @@ QSize CommentBox::size() } //////////////////////////////////////////////////////////////////////// #else CommentBox::CommentBox(QWidget *_parentWidget) : QMultiLineEdit(_parentWidget) { this->setReadOnly(true); + setFocusPolicy( QWidget::ClickFocus ); } CommentBox::~CommentBox() { } void CommentBox::clear() { this->hide(); } diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index fc6837f..aed8ec0 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp @@ -650,24 +650,25 @@ void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc) w.setCaption( i18n ("Add new password") ); vector<string> catList; doc->getCategoryList(&catList); unsigned i, size = catList.size(); for (i = 0; i < size; ++i) { w.addCategory(catList[i].c_str()); } w.setCurrCategory(view->getCurrentCategory()); if (pw) w.pwLineEdit->setText(*pw); tryAgain: + w.descLineEdit->setFocus(); if (w.exec() == 1) { PwMDataItem d; //US BUG: to initialize all values of curEntr with meaningfulldata, // we call clear on it. Reason: Metadata will be uninitialized otherwise. // another option would be to create a constructor for PwMDataItem d.clear(true); d.desc = w.getDescription().latin1(); d.name = w.getUsername().latin1(); d.pw = w.getPassword().latin1(); @@ -750,24 +751,25 @@ void PwM::editPwd_slot3(const QString *category, const int *index, doc->getCategoryList(&catList); unsigned i, size = catList.size(); for (i = 0; i < size; ++i) { w.addCategory(catList[i].c_str()); } w.setCurrCategory(curCategory); w.setDescription(currItem.desc.c_str()); w.setUsername(currItem.name.c_str()); w.setPassword(currItem.pw.c_str()); w.setUrl(currItem.url.c_str()); w.setLauncher(currItem.launcher.c_str()); w.setComment(currItem.comment.c_str()); + w.descLineEdit->setFocus(); if (w.exec() == 1) { currItem.desc = w.getDescription().latin1(); currItem.name = w.getUsername().latin1(); currItem.pw = w.getPassword().latin1(); currItem.comment = w.getComment().latin1(); currItem.url = w.getUrl().latin1(); currItem.launcher = w.getLauncher().latin1(); if (!doc->editEntry(curCategory, w.getCategory(), curEntryIndex, &currItem)) { KMessageBox::error(this, i18n("Couldn't edit the entry.\n" "Maybe you changed the category and\n" diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp index 8c4d9cc..7f7dd6f 100644 --- a/pwmanager/pwmanager/pwmview.cpp +++ b/pwmanager/pwmanager/pwmview.cpp @@ -56,24 +56,25 @@ PwMView::PwMView(PwM *_mainClass, PWM_ASSERT(_mainClass); PWM_ASSERT(parent); PWM_ASSERT(_doc); setView(this); doc = _doc; doc->setListViewPointer(this); mainClass = _mainClass; resize(_mainClass->size()); initStyle(conf()->confWndMainViewStyle()); initCtxMenu(); doc->setCurrentView(this); connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); + connect(this, SIGNAL(editPW()), mainClass, SLOT(editPwd_slot())); } PwMView::~PwMView() { } void PwMView::initCtxMenu() { ctxMenu = new QPopupMenu(this); ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); ctxMenu->insertSeparator(); ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); diff --git a/pwmanager/pwmanager/pwmviewstyle.cpp b/pwmanager/pwmanager/pwmviewstyle.cpp index 0af1473..5f25880 100644 --- a/pwmanager/pwmanager/pwmviewstyle.cpp +++ b/pwmanager/pwmanager/pwmviewstyle.cpp @@ -52,24 +52,30 @@ PwMViewStyle::~PwMViewStyle() break; default: BUG(); } PWMPrefs::instance()->writeConfig(); delete_ifnot_null(s0); delete_ifnot_null(s1); } +void PwMViewStyle::editPassWord( QListViewItem * i ) +{ + if ( !i ) + return; + emit editPW(); +} void PwMViewStyle::initStyle(style_t style) { printDebug(string("initializing style ") + tostr(style)); bool wasMaximized = v->isMaximized(); if (v->isVisible()) v->hide(); switch (style) { case style_0: delete_ifnot_null(s0); delete_ifnot_null(s1); s0 = new PwMViewStyle_0(v); lv = s0->getLv(); @@ -84,24 +90,29 @@ void PwMViewStyle::initStyle(style_t style) break; default: BUG(); return; } curStyle = style; connect(lv, SIGNAL(pressed(QListViewItem *)), v, SLOT(handleToggle(QListViewItem *))); connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int))); connect(lv, SIGNAL(clicked(QListViewItem *)), v, SLOT(refreshCommentTextEdit(QListViewItem *))); + connect(lv, SIGNAL(returnPressed(QListViewItem *)), + this, SLOT(editPassWord(QListViewItem *))); + connect(lv, SIGNAL(doubleClicked(QListViewItem *)), + this, SLOT(editPassWord(QListViewItem *))); + lv->addColumn(i18n("Description"), 180); lv->addColumn(i18n("Username"), 150); lv->addColumn(i18n("Password"), 150); lv->addColumn(i18n("URL"), 180); lv->addColumn(i18n("Launcher"), 120); v->tmpReEnableSort(); //US ENH : load the size of the listviewcolumns switch (curStyle) { case style_0: s0->restoreSettings(PWMPrefs::instance()); diff --git a/pwmanager/pwmanager/pwmviewstyle.h b/pwmanager/pwmanager/pwmviewstyle.h index bf5ce91..5656cbc 100644 --- a/pwmanager/pwmanager/pwmviewstyle.h +++ b/pwmanager/pwmanager/pwmviewstyle.h @@ -33,24 +33,25 @@ #include <qmultilineedit.h> #endif #include <qlabel.h> #include <qlistbox.h> #include <qcombobox.h> #include <qsize.h> class ListViewPwM; class PwMViewStyle_0; class PwMViewStyle_1; class PwMView; +class QListViewItem; class CommentBox; class PwMViewStyle : public QWidget { Q_OBJECT public: enum style_t { style_notset = -1, style_0 = 0, style_1 = 1 @@ -80,29 +81,33 @@ protected: void delCategory(const QString &cat); /** delete all categories from view */ void delAllCategories(); /** select the specified category */ void selectCategory(const QString &cat); /** returns the number of categories in this view. * This value dosn't say anything about the number of * categories in the document. */ int numCategories(); /** resize the view */ void resizeView(const QSize &size); + ListViewPwM *lv; + CommentBox *commentBox; + +protected slots: + void editPassWord( QListViewItem * ); private: /** which style has the view? * KListBox on the left, * or QComboBox on the top? */ style_t curStyle; PwMViewStyle_0 *s0; PwMViewStyle_1 *s1; PwMView *v; + signals: + void editPW(); -protected: - ListViewPwM *lv; - CommentBox *commentBox; }; #endif |