mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-19 19:48:36 -04:00
Rename KeePass2{,Xml}{R,W} to Kdbx3{,Xml}{R,W}, and add a redirection class
This class will in future select Kdbx4{R,W} as appropriate.
This commit is contained in:
parent
e5ec585f98
commit
3461cbfb06
20 changed files with 1099 additions and 734 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
|
||||
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -18,33 +18,48 @@
|
|||
#ifndef KEEPASSX_KEEPASS2WRITER_H
|
||||
#define KEEPASSX_KEEPASS2WRITER_H
|
||||
|
||||
#include <QIODevice>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QCoreApplication>
|
||||
#include <QScopedPointer>
|
||||
|
||||
#include "core/Database.h"
|
||||
#include "format/KeePass2.h"
|
||||
#include "keys/CompositeKey.h"
|
||||
|
||||
class Database;
|
||||
class QIODevice;
|
||||
|
||||
class KeePass2Writer
|
||||
class BaseKeePass2Writer
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(KeePass2Writer)
|
||||
|
||||
public:
|
||||
KeePass2Writer();
|
||||
void writeDatabase(QIODevice* device, Database* db);
|
||||
void writeDatabase(const QString& filename, Database* db);
|
||||
bool hasError();
|
||||
QString errorString();
|
||||
BaseKeePass2Writer();
|
||||
|
||||
private:
|
||||
bool writeData(const QByteArray& data);
|
||||
bool writeHeaderField(KeePass2::HeaderFieldID fieldId, const QByteArray& data);
|
||||
virtual bool writeDatabase(QIODevice* device, Database* db) = 0;
|
||||
virtual bool writeDatabase(const QString& filename, Database* db);
|
||||
|
||||
virtual bool hasError();
|
||||
virtual QString errorString();
|
||||
|
||||
virtual ~BaseKeePass2Writer();
|
||||
|
||||
protected:
|
||||
void raiseError(const QString& errorMessage);
|
||||
|
||||
QIODevice* m_device;
|
||||
bool m_error;
|
||||
QString m_errorStr;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_KEEPASS2WRITER_H
|
||||
class KeePass2Writer : public BaseKeePass2Writer
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(KeePass2Writer)
|
||||
|
||||
public:
|
||||
virtual bool writeDatabase(QIODevice* device, Database* db) override;
|
||||
using BaseKeePass2Writer::writeDatabase;
|
||||
|
||||
virtual bool hasError() override;
|
||||
virtual QString errorString() override;
|
||||
|
||||
private:
|
||||
QScopedPointer<BaseKeePass2Writer> m_writer;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_KEEPASS2READER_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue