Create default groups when creating new database

Increase and randomize default key transformation number
Better cleanup when loading database fails

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@196 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
sniperbeamer
2008-04-17 22:21:05 +00:00
parent 1905150642
commit 7c34d2010a
7 changed files with 68 additions and 30 deletions

View File

@@ -37,4 +37,4 @@ void AutoTypeTreeWidget::keyPressEvent(QKeyEvent* event){
else {
QTreeWidget::keyPressEvent(event);
}
}
}

View File

@@ -26,4 +26,4 @@ signals:
private:
void mouseMoveEvent(QMouseEvent*);
void keyPressEvent(QKeyEvent*);
};
};

View File

@@ -108,25 +108,47 @@ void KeepassGroupView::OnNewGroup(){
if(parent){
group=db->addGroup(&NewGroup,parent->GroupHandle);
Items.append(new GroupViewItem(parent));
}
}
else{
if(topLevelItemCount()){
if(topLevelItem(topLevelItemCount()-1)==SearchResultItem)
Items.append(new GroupViewItem(this,topLevelItem(topLevelItemCount()-2)));
Items.append(new GroupViewItem(this,topLevelItem(topLevelItemCount()-2)));
else
Items.append(new GroupViewItem(this,topLevelItem(topLevelItemCount()-1)));
Items.append(new GroupViewItem(this,topLevelItem(topLevelItemCount()-1)));
}
else
Items.append(new GroupViewItem(this));
Items.append(new GroupViewItem(this));
group=db->addGroup(&NewGroup,NULL);
}
Items.back()->GroupHandle=group;
Items.back()->setText(0,group->title());
Items.back()->setIcon(0,db->icon(group->image()));
Items.back()->setIcon(0,db->icon(group->image()));
}
emit fileModified();
}
void KeepassGroupView::createGroup(const QString& title, quint32 image){
CGroup NewGroup;
NewGroup.Title = title;
NewGroup.Image = image;
IGroupHandle* group;
if(topLevelItemCount()){
if(topLevelItem(topLevelItemCount()-1)==SearchResultItem)
Items.append(new GroupViewItem(this,topLevelItem(topLevelItemCount()-2)));
else
Items.append(new GroupViewItem(this,topLevelItem(topLevelItemCount()-1)));
}
else
Items.append(new GroupViewItem(this));
group = db->addGroup(&NewGroup,NULL);
Items.back()->GroupHandle = group;
Items.back()->setText(0, group->title());
Items.back()->setIcon(0, db->icon(group->image()));
}
void KeepassGroupView::OnEditGroup(){
GroupViewItem* item=(GroupViewItem*)currentItem();
CEditGroupDialog dlg(db,item->GroupHandle,parentWidget(),true);

View File

@@ -36,6 +36,7 @@ class KeepassGroupView:public QTreeWidget{
void createItems();
void showSearchResults();
void setCurrentGroup(IGroupHandle* group);
void createGroup(const QString& title, quint32 image);
private:
virtual void dragEnterEvent(QDragEnterEvent* event);
@@ -47,7 +48,7 @@ class KeepassGroupView:public QTreeWidget{
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void paintEvent ( QPaintEvent * event );
virtual void contextMenuEvent(QContextMenuEvent *event);
virtual void contextMenuEvent(QContextMenuEvent *event);
void addChilds(GroupViewItem* item);
QPoint DragStartPos;
GroupViewItem* DragItem;