2010-08-18 16:57:26 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2010-08-31 10:18:45 -04:00
|
|
|
#ifndef KEEPASSX_KEEPASS2XMLWRITER_H
|
|
|
|
#define KEEPASSX_KEEPASS2XMLWRITER_H
|
2010-08-18 16:57:26 -04:00
|
|
|
|
|
|
|
#include <QtCore/QDateTime>
|
|
|
|
#include <QtCore/QXmlStreamWriter>
|
|
|
|
#include <QtGui/QColor>
|
2010-09-19 15:22:24 -04:00
|
|
|
#include <QtGui/QIcon>
|
2010-08-18 16:57:26 -04:00
|
|
|
|
2010-08-25 07:52:59 -04:00
|
|
|
#include "core/Database.h"
|
2010-08-18 16:57:26 -04:00
|
|
|
#include "core/Entry.h"
|
|
|
|
#include "core/TimeInfo.h"
|
|
|
|
#include "core/Uuid.h"
|
|
|
|
|
|
|
|
class Group;
|
2011-07-06 18:15:52 -04:00
|
|
|
class KeePass2RandomStream;
|
2010-08-18 16:57:26 -04:00
|
|
|
class Metadata;
|
|
|
|
|
2010-09-13 17:24:36 -04:00
|
|
|
class KeePass2XmlWriter
|
2010-08-18 16:57:26 -04:00
|
|
|
{
|
|
|
|
public:
|
2010-08-31 10:18:45 -04:00
|
|
|
KeePass2XmlWriter();
|
2011-07-06 18:15:52 -04:00
|
|
|
void writeDatabase(QIODevice* device, Database* db, KeePass2RandomStream* randomStream = 0);
|
|
|
|
void writeDatabase(const QString& filename, Database* db, KeePass2RandomStream* randomStream = 0);
|
2010-08-31 10:18:45 -04:00
|
|
|
bool error();
|
|
|
|
QString errorString();
|
2010-08-18 16:57:26 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
void writeMetadata();
|
|
|
|
void writeMemoryProtection();
|
|
|
|
void writeCustomIcons();
|
2010-09-19 15:22:24 -04:00
|
|
|
void writeIcon(const Uuid& uuid, const QIcon& icon);
|
2010-08-18 16:57:26 -04:00
|
|
|
void writeCustomData();
|
2010-08-25 18:31:07 -04:00
|
|
|
void writeCustomDataItem(const QString& key, const QString& value);
|
2010-08-18 16:57:26 -04:00
|
|
|
void writeRoot();
|
|
|
|
void writeGroup(const Group* group);
|
|
|
|
void writeTimes(const TimeInfo& ti);
|
2010-08-25 07:52:59 -04:00
|
|
|
void writeDeletedObjects();
|
|
|
|
void writeDeletedObject(const DeletedObject& delObj);
|
2010-08-18 16:57:26 -04:00
|
|
|
void writeEntry(const Entry* entry);
|
|
|
|
void writeAutoType(const Entry* entry);
|
|
|
|
void writeAutoTypeAssoc(const AutoTypeAssociation& assoc);
|
|
|
|
void writeEntryHistory(const Entry* entry);
|
|
|
|
|
|
|
|
void writeString(const QString& qualifiedName, const QString& string);
|
|
|
|
void writeNumber(const QString& qualifiedName, int number);
|
|
|
|
void writeBool(const QString& qualifiedName, bool b);
|
|
|
|
void writeDateTime(const QString& qualifiedName, const QDateTime& dateTime);
|
|
|
|
void writeUuid(const QString& qualifiedName, const Uuid& uuid);
|
|
|
|
void writeUuid(const QString& qualifiedName, const Group* group);
|
|
|
|
void writeUuid(const QString& qualifiedName, const Entry* entry);
|
|
|
|
void writeBinary(const QString& qualifiedName, const QByteArray& ba);
|
|
|
|
void writeColor(const QString& qualifiedName, const QColor& color);
|
|
|
|
QString colorPartToString(int value);
|
|
|
|
|
|
|
|
QXmlStreamWriter m_xml;
|
|
|
|
Database* m_db;
|
|
|
|
Metadata* m_meta;
|
2011-07-06 18:15:52 -04:00
|
|
|
KeePass2RandomStream* m_randomStream;
|
2010-08-18 16:57:26 -04:00
|
|
|
};
|
|
|
|
|
2010-08-31 10:18:45 -04:00
|
|
|
#endif // KEEPASSX_KEEPASS2XMLWRITER_H
|