mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-23 16:51:22 -04:00
Refactor database extraction (#2698)
Previously, extracting the XML from a database was done with the `saveXml` attribute in the `KeePass2Reader` class. This had several unfortunate consequences: * The `KdbxReader` class had to import the `KdbxXmlWriter` class in order to perform the export (bad separation of concerns); * The CLI database unlocking logic had to be duplicated only for the `Extract` command; * The `xmlData` had to be stored in the `KeePass2Reader` as a temporary result. * Lots of `setSaveXml` functions were implemented only to trickle down this functionality. Also, the naming of the `saveXml` variable was not really helpful to understand it's role. Overall, this change will make it easier to maintain and expand the CLI database unlocking logic (for example, adding a `--no-password` option as requested in https://github.com/keepassxreboot/keepassxc/issues/1873) It also opens to door to other types of extraction/exporting (for example exporting to CSV, as requested in https://github.com/keepassxreboot/keepassxc/issues/2572)
This commit is contained in:
parent
8bfc539234
commit
504904a414
15 changed files with 79 additions and 130 deletions
|
@ -52,6 +52,13 @@ public:
|
|||
*/
|
||||
virtual bool writeDatabase(QIODevice* device, Database* db) = 0;
|
||||
|
||||
/**
|
||||
* Get the database format version for the writer.
|
||||
*/
|
||||
virtual quint32 formatVersion() = 0;
|
||||
|
||||
void extractDatabase(QByteArray& xmlOutput, Database* db);
|
||||
|
||||
bool hasError() const;
|
||||
QString errorString() const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue