added UI for kdb support

fixed issue with not keeping "meta stream entries" (database color, default username) and num encryption rounds
fixed issues with recycle bin (wasn't updating group list correctly, couldn't access newly created recycle bin group)
This commit is contained in:
Philipp Crocoll
2015-02-09 20:24:57 +01:00
parent bc235b3ba5
commit 8de5588cff
12 changed files with 255 additions and 61 deletions

View File

@@ -36,7 +36,7 @@ namespace keepass2android
{
get
{
return CanRecycleGroup(_entry.ParentGroup);
return App.GetDb().DatabaseFormat.CanRecycle && CanRecycleGroup(_entry.ParentGroup);
}
}
@@ -62,7 +62,8 @@ namespace keepass2android
if(pgParent != null)
{
pgParent.Entries.Remove(pe);
//TODO check if RecycleBin is deleted
//TODO no recycle bin in KDB
if ((DeletePermanently) || (!CanRecycle))
{
@@ -85,7 +86,7 @@ namespace keepass2android
}
else // Recycle
{
EnsureRecycleBin(ref pgRecycleBin, ref bUpdateGroupList);
EnsureRecycleBinExists(ref pgRecycleBin, ref bUpdateGroupList);
pgRecycleBin.AddEntry(pe, true, true);
pe.Touch(false);
@@ -97,6 +98,9 @@ namespace keepass2android
Db.Dirty.Add(pgParent);
// Mark new parent dirty
Db.Dirty.Add(pgRecycleBin);
// mark root dirty if recycle bin was created
if (bUpdateGroupList)
Db.Dirty.Add(Db.Root);
} else {
// Let's not bother recovering from a failure to save a deleted entry. It is too much work.
App.LockDatabase(false);

View File

@@ -56,7 +56,7 @@ namespace keepass2android
{
get
{
return CanRecycleGroup(_group);
return App.GetDb().DatabaseFormat.CanRecycle && CanRecycleGroup(_group);
}
}
@@ -91,8 +91,8 @@ namespace keepass2android
}
else // Recycle
{
bool bDummy = false;
EnsureRecycleBin(ref pgRecycleBin, ref bDummy);
bool groupListUpdateRequired = false;
EnsureRecycleBinExists(ref pgRecycleBin, ref groupListUpdateRequired);
pgRecycleBin.AddGroup(pg, true, true);
pg.Touch(false);
@@ -106,6 +106,10 @@ namespace keepass2android
}
//Mark old parent dirty:
Db.Dirty.Add(pgParent);
// mark root dirty if recycle bin was created
if (groupListUpdateRequired)
Db.Dirty.Add(Db.Root);
} else {
// Let's not bother recovering from a failure to save a deleted group. It is too much work.
App.LockDatabase(false);

View File

@@ -66,7 +66,7 @@ namespace keepass2android
}
protected void EnsureRecycleBin(ref PwGroup pgRecycleBin,
protected void EnsureRecycleBinExists(ref PwGroup pgRecycleBin,
ref bool bGroupListUpdateRequired)
{
if ((Db == null) || (Db.KpDatabase == null)) { return; }
@@ -87,7 +87,7 @@ namespace keepass2android
};
Db.KpDatabase.RootGroup.AddGroup(pgRecycleBin, true);
Db.Groups[pgRecycleBin.Uuid] = pgRecycleBin;
Db.KpDatabase.RecycleBinUuid = pgRecycleBin.Uuid;
bGroupListUpdateRequired = true;