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
This commit is contained in:
parent
1a1d1ecb23
commit
4603009ae2
|
@ -372,16 +372,23 @@ void KeepassEntryView::editEntry(EntryViewItem* item){
|
||||||
|
|
||||||
|
|
||||||
void KeepassEntryView::OnNewEntry(){
|
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 (!CurrentGroup){ // We must be viewing search results. Add the new entry to the first group.
|
||||||
if (db->groups().size() > 0)
|
if (db->groups().size() > 0)
|
||||||
NewEntry=db->newEntry(db->sortedGroups()[0]);
|
ParentGroup = db->sortedGroups()[0];
|
||||||
|
|
||||||
else{
|
else{
|
||||||
QMessageBox::critical(NULL,tr("Error"),tr("At least one group must exist before adding an entry."),tr("OK"));
|
QMessageBox::critical(NULL,tr("Error"),tr("At least one group must exist before adding an entry."),tr("OK"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
NewEntry=db->newEntry(CurrentGroup);
|
ParentGroup = CurrentGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
IEntryHandle* NewEntry = db->newEntry(ParentGroup);
|
||||||
|
NewEntry->setImage(ParentGroup->image());
|
||||||
|
|
||||||
CEditEntryDlg dlg(db,NewEntry,this,true);
|
CEditEntryDlg dlg(db,NewEntry,this,true);
|
||||||
if(!dlg.exec()){
|
if(!dlg.exec()){
|
||||||
db->deleteLastEntry();
|
db->deleteLastEntry();
|
||||||
|
|
Loading…
Reference in New Issue