From 4603009ae2c805c93c86492564551c91a2de4b20 Mon Sep 17 00:00:00 2001 From: sniperbeamer Date: Tue, 2 Mar 2010 21:25:17 +0000 Subject: [PATCH] Use icon of parent group when creating a new entry git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@372 b624d157-de02-0410-bad0-e51aec6abb33 --- src/lib/EntryView.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/EntryView.cpp b/src/lib/EntryView.cpp index 61b39bb..8ab7c94 100644 --- a/src/lib/EntryView.cpp +++ b/src/lib/EntryView.cpp @@ -372,16 +372,23 @@ void KeepassEntryView::editEntry(EntryViewItem* item){ void KeepassEntryView::OnNewEntry(){ - IEntryHandle* NewEntry = NULL; + IGroupHandle* ParentGroup; + if (!CurrentGroup){ // We must be viewing search results. Add the new entry to the first group. if (db->groups().size() > 0) - NewEntry=db->newEntry(db->sortedGroups()[0]); + ParentGroup = db->sortedGroups()[0]; + else{ QMessageBox::critical(NULL,tr("Error"),tr("At least one group must exist before adding an entry."),tr("OK")); } } - else - NewEntry=db->newEntry(CurrentGroup); + else{ + ParentGroup = CurrentGroup; + } + + IEntryHandle* NewEntry = db->newEntry(ParentGroup); + NewEntry->setImage(ParentGroup->image()); + CEditEntryDlg dlg(db,NewEntry,this,true); if(!dlg.exec()){ db->deleteLastEntry();