2010-09-25 12:41:00 +02:00
|
|
|
/*
|
2017-11-13 02:55:03 +08:00
|
|
|
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
|
2010-09-25 12:41:00 +02:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation, either version 2 or (at your option)
|
|
|
|
* version 3 of the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KEEPASSX_KEEPASS2WRITER_H
|
|
|
|
#define KEEPASSX_KEEPASS2WRITER_H
|
|
|
|
|
2018-01-07 04:08:32 +01:00
|
|
|
#include "KdbxWriter.h"
|
|
|
|
|
2017-10-13 12:31:57 +02:00
|
|
|
#include <QCoreApplication>
|
2017-11-13 02:55:03 +08:00
|
|
|
#include <QScopedPointer>
|
2017-10-13 12:31:57 +02:00
|
|
|
|
2018-01-07 04:08:32 +01:00
|
|
|
class QIODevice;
|
|
|
|
class Database;
|
2018-01-06 17:06:51 +01:00
|
|
|
|
2018-01-07 04:08:32 +01:00
|
|
|
class KeePass2Writer
|
2010-09-25 12:41:00 +02:00
|
|
|
{
|
2018-03-31 16:01:30 -04:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(KeePass2Writer)
|
2010-09-25 12:41:00 +02:00
|
|
|
|
2018-01-07 04:08:32 +01:00
|
|
|
public:
|
|
|
|
bool writeDatabase(const QString& filename, Database* db);
|
|
|
|
bool writeDatabase(QIODevice* device, Database* db);
|
2019-02-13 13:24:55 -05:00
|
|
|
void extractDatabase(Database* db, QByteArray& xmlOutput);
|
2017-11-13 02:55:03 +08:00
|
|
|
|
2018-01-07 04:08:32 +01:00
|
|
|
QSharedPointer<KdbxWriter> writer() const;
|
|
|
|
quint32 version() const;
|
2017-11-13 02:55:03 +08:00
|
|
|
|
2018-01-07 04:08:32 +01:00
|
|
|
bool hasError() const;
|
|
|
|
QString errorString() const;
|
2017-11-13 02:55:03 +08:00
|
|
|
|
2018-01-07 04:08:32 +01:00
|
|
|
private:
|
2013-06-30 14:43:02 +02:00
|
|
|
void raiseError(const QString& errorMessage);
|
2018-02-28 23:02:45 +01:00
|
|
|
bool implicitUpgradeNeeded(Database const* db) const;
|
2010-09-25 12:41:00 +02:00
|
|
|
|
2018-01-07 04:08:32 +01:00
|
|
|
bool m_error = false;
|
|
|
|
QString m_errorStr = "";
|
2017-11-13 02:55:03 +08:00
|
|
|
|
2018-01-07 04:08:32 +01:00
|
|
|
QScopedPointer<KdbxWriter> m_writer;
|
|
|
|
quint32 m_version = 0;
|
2017-11-13 02:55:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // KEEPASSX_KEEPASS2READER_H
|