|
|
@ -32,27 +32,38 @@ extension KdbxDao on KdbxFile { |
|
|
|
return group; |
|
|
|
return group; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns the recycle bin, if it exists, null otherwise. |
|
|
|
KdbxGroup get recycleBin { |
|
|
|
KdbxGroup get recycleBin { |
|
|
|
final uuid = body.meta.recycleBinUUID.get(); |
|
|
|
final uuid = body.meta.recycleBinUUID.get(); |
|
|
|
if (uuid == null) { |
|
|
|
if (uuid?.isNil != false) { |
|
|
|
return _createRecycleBin(); |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
_logger.finer(() { |
|
|
|
try { |
|
|
|
final groupDebug = body.rootGroup |
|
|
|
return findGroupByUuid(uuid); |
|
|
|
.getAllGroups() |
|
|
|
} catch (e, stackTrace) { |
|
|
|
.map((g) => '${g.uuid}: ${g.name}') |
|
|
|
_logger.warning(() { |
|
|
|
.join('\n'); |
|
|
|
final groupDebug = body.rootGroup |
|
|
|
return 'All Groups: $groupDebug'; |
|
|
|
.getAllGroups() |
|
|
|
}); |
|
|
|
.map((g) => '${g.uuid}: ${g.name}') |
|
|
|
return findGroupByUuid(uuid); |
|
|
|
.join('\n'); |
|
|
|
|
|
|
|
return 'All Groups: $groupDebug'; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
_logger.severe('Inconsistency error, uuid $uuid not found in groups.', e, |
|
|
|
|
|
|
|
stackTrace); |
|
|
|
|
|
|
|
rethrow; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KdbxGroup getRecycleBinOrCreate() { |
|
|
|
|
|
|
|
return recycleBin ?? _createRecycleBin(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void deleteGroup(KdbxGroup group) { |
|
|
|
void deleteGroup(KdbxGroup group) { |
|
|
|
move(group, recycleBin); |
|
|
|
move(group, getRecycleBinOrCreate()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void deleteEntry(KdbxEntry entry) { |
|
|
|
void deleteEntry(KdbxEntry entry) { |
|
|
|
move(entry, recycleBin); |
|
|
|
move(entry, getRecycleBinOrCreate()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void move(KdbxObject kdbxObject, KdbxGroup toGroup) { |
|
|
|
void move(KdbxObject kdbxObject, KdbxGroup toGroup) { |
|
|
|