* added option to ignore duplicate uuids
* fixed issue with clearing entered passwords when leaving PasswordActivity (passwords were cleared when opening FS-Setup-Activity or NfcOtpActivity as well)
This commit is contained in:
@@ -100,6 +100,6 @@ namespace keepass2android
|
||||
|
||||
RemoteCertificateValidationCallback CertificateValidationCallback { get; }
|
||||
|
||||
|
||||
bool CheckForDuplicateUuids { get; }
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,7 @@ namespace keepass2android
|
||||
FileIsReadOnly,
|
||||
FileIsReadOnlyOnKitkat,
|
||||
CopyFileRequiredForEditing,
|
||||
DuplicateUuidsError
|
||||
DuplicateUuidsError,
|
||||
DuplicateUuidsErrorAdditional
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,8 +174,7 @@ namespace keepass2android
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void PopulateGlobals (PwGroup currentGroup)
|
||||
private void PopulateGlobals(PwGroup currentGroup, bool checkForDuplicateUuids )
|
||||
{
|
||||
|
||||
var childGroups = currentGroup.Groups;
|
||||
@@ -183,22 +182,34 @@ namespace keepass2android
|
||||
|
||||
foreach (PwEntry e in childEntries)
|
||||
{
|
||||
if (Entries.ContainsKey(e.Uuid))
|
||||
if (checkForDuplicateUuids)
|
||||
{
|
||||
throw new DuplicateUuidsException();
|
||||
if (Entries.ContainsKey(e.Uuid))
|
||||
{
|
||||
throw new DuplicateUuidsException();
|
||||
}
|
||||
|
||||
}
|
||||
Entries [e.Uuid] = e;
|
||||
}
|
||||
foreach (PwGroup g in childGroups)
|
||||
{
|
||||
if (Groups.ContainsKey(g.Uuid))
|
||||
if (checkForDuplicateUuids)
|
||||
{
|
||||
throw new DuplicateUuidsException();
|
||||
|
||||
if (Groups.ContainsKey(g.Uuid))
|
||||
{
|
||||
throw new DuplicateUuidsException();
|
||||
}
|
||||
}
|
||||
Groups[g.Uuid] = g;
|
||||
PopulateGlobals(g);
|
||||
}
|
||||
}
|
||||
private void PopulateGlobals (PwGroup currentGroup)
|
||||
{
|
||||
PopulateGlobals(currentGroup, _app.CheckForDuplicateUuids);
|
||||
}
|
||||
|
||||
public void Clear() {
|
||||
Groups.Clear();
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace keepass2android
|
||||
catch (DuplicateUuidsException e)
|
||||
{
|
||||
Kp2aLog.Log("Exception: " + e);
|
||||
Finish(false, _app.GetResourceString(UiStringKey.DuplicateUuidsError));
|
||||
Finish(false, _app.GetResourceString(UiStringKey.DuplicateUuidsError)+" " + _app.GetResourceString(UiStringKey.DuplicateUuidsErrorAdditional));
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user