From 779bc6fb934d34c8c539b06786fa4bb15619ca16 Mon Sep 17 00:00:00 2001 From: tariq Date: Thu, 16 Feb 2006 19:49:16 +0000 Subject: [PATCH] implementation of ShowToolbar & ShowEntryDetails git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@45 b624d157-de02-0410-bad0-e51aec6abb33 --- src/mainwindow.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++-- src/mainwindow.h | 3 +++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 23c436a..620399e 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -98,6 +98,8 @@ void KeepassMainWindow::setupConnections(){ connect(EditSearchAction, SIGNAL(triggered()), this, SLOT(OnEditSearch())); connect(EditGroupSearchAction, SIGNAL(triggered()), this, SLOT(OnEditGroupSearch())); + connect(ViewShowToolbarAction,SIGNAL(toggled(bool)),this,SLOT(OnViewShowToolbar(bool))); + connect(ViewShowEntryDetailsAction,SIGNAL(toggled(bool)),this,SLOT(OnViewShowEntryDetails(bool))); connect(ViewHidePasswordsAction,SIGNAL(toggled(bool)), this, SLOT(OnUsernPasswVisibilityChanged(bool))); connect(ViewHideUsernamesAction,SIGNAL(toggled(bool)), this, SLOT(OnUsernPasswVisibilityChanged(bool))); connect(ViewColumnsTitleAction,SIGNAL(toggled(bool)), this, SLOT(OnColumnVisibilityChanged(bool))); @@ -183,6 +185,8 @@ void KeepassMainWindow::setupMenus(){ EntryView->ContextMenu->addAction(EditCloneEntryAction); EntryView->ContextMenu->addAction(EditDeleteEntryAction); + ViewShowToolbarAction->setChecked(config.Toolbar); + ViewShowEntryDetailsAction->setChecked(config.EntryDetails); ViewHidePasswordsAction->setChecked(config.ListView_HidePasswords); ViewHideUsernamesAction->setChecked(config.ListView_HideUsernames); ViewColumnsTitleAction->setChecked(config.Columns[0]); @@ -319,6 +323,7 @@ FileChangeKeyAction->setEnabled(IsOpen); EditSearchAction->setEnabled(IsOpen); GroupView->setEnabled(IsOpen); EntryView->setEnabled(IsOpen); +DetailView->setEnabled(IsOpen); QuickSearchEdit->setEnabled(IsOpen); if(!IsOpen){ EditNewGroupAction->setEnabled(false); @@ -384,6 +389,33 @@ default: Q_ASSERT(false); } } +void KeepassMainWindow::updateDetailView(){ +if(EntryView->selectedItems().size()!=1){ + DetailView->setText(""); + return;} + +CEntry& entry=*((EntryViewItem*)(EntryView->selectedItems()[0]))->pEntry; +QString str=trUtf8("Gruppe: %1 Titel: %2 Benutzername: %3 URL: %4 Passwort: %5 Erstellt: %6 letzte Änderung: %7 letzter Zugriff: %8 gültig bis: %9"); +str=str.arg(currentGroup()->Name).arg(entry.Title); + +if(!config.ListView_HideUsernames) str=str.arg(entry.UserName); +else str=str.arg("****"); + +str=str.arg(entry.URL); + +if(!config.ListView_HidePasswords) str=str.arg(entry.Password.getString()); +else str=str.arg("****"); + +str=str.arg(entry.Creation.toString(Qt::LocalDate)) + .arg(entry.LastMod.toString(Qt::LocalDate)) + .arg(entry.LastAccess.toString(Qt::LocalDate)) + .arg(entry.Expire.toString(Qt::LocalDate)); +DetailView->setHtml(str); +entry.Password.delRef(); + +} + + void KeepassMainWindow::setStateEntrySelected(SelectionState s){ EntrySelection=s; if(GroupSelection == NONE || GroupSelection == SINGLE) @@ -520,13 +552,13 @@ editEntry(static_cast(item)->pEntry); } void KeepassMainWindow::OnEntrySelectionChanged(){ +updateDetailView(); if(EntryView->selectedItems().size()==0) setStateEntrySelected(NONE); if(EntryView->selectedItems().size()==1) setStateEntrySelected(SINGLE); if(EntryView->selectedItems().size()>1) setStateEntrySelected(MULTIPLE); - } void KeepassMainWindow::OnGroupSelectionChanged(){ @@ -711,7 +743,7 @@ config.Columns[7]=ViewColumnsLastChangeAction->isChecked(); config.Columns[8]=ViewColumnsLastAccessAction->isChecked(); config.Columns[9]=ViewColumnsAttachmentAction->isChecked(); EntryView->updateColumns(); -EntryView->updateItems(); +if(FileOpen) EntryView->updateItems(); } void KeepassMainWindow::OnUsernPasswVisibilityChanged(bool value){ @@ -742,4 +774,12 @@ dlg.exec(); } +void KeepassMainWindow::OnViewShowToolbar(bool show){ +config.Toolbar=show; +toolBar->setVisible(config.Toolbar); +} +void KeepassMainWindow::OnViewShowEntryDetails(bool show){ +config.EntryDetails=show; +DetailView->setVisible(config.EntryDetails); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 8d10027..d35af5e 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -75,6 +75,8 @@ private slots: void OnEditOpenUrl(); void OnEditSearch(); void OnEditGroupSearch(); + void OnViewShowToolbar(bool); + void OnViewShowEntryDetails(bool); void OnCurrentGroupChanged(QTreeWidgetItem*,QTreeWidgetItem*); void OnEntryItemDoubleClicked(QTreeWidgetItem* item,int column); void OnEntrySelectionChanged(); @@ -107,6 +109,7 @@ private: void search(CGroup* pGroup); void editEntry(CEntry* pEntry); void removeFromSearchResults(int sID); + void updateDetailView(); inline CGroup* currentGroup(); inline CEntry* currentEntry(); QLineEdit* QuickSearchEdit;