2010-08-07 09:10:44 -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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KEEPASSX_METADATA_H
|
|
|
|
#define KEEPASSX_METADATA_H
|
|
|
|
|
|
|
|
#include <QtCore/QDateTime>
|
|
|
|
#include <QtCore/QHash>
|
2012-01-01 15:52:54 -05:00
|
|
|
#include <QtGui/QImage>
|
2010-08-07 09:10:44 -04:00
|
|
|
|
2011-07-08 08:51:14 -04:00
|
|
|
#include "core/Uuid.h"
|
|
|
|
|
2010-08-13 12:08:06 -04:00
|
|
|
class Database;
|
|
|
|
class Group;
|
2012-04-18 15:59:00 -04:00
|
|
|
class Entry;
|
2010-08-13 12:08:06 -04:00
|
|
|
|
|
|
|
class Metadata : public QObject
|
2010-08-07 09:10:44 -04:00
|
|
|
{
|
2010-08-13 12:08:06 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
2010-08-07 09:10:44 -04:00
|
|
|
public:
|
2010-08-14 06:28:52 -04:00
|
|
|
explicit Metadata(Database* parent);
|
2010-08-07 09:10:44 -04:00
|
|
|
|
|
|
|
QString generator() const;
|
|
|
|
QString name() const;
|
|
|
|
QDateTime nameChanged() const;
|
|
|
|
QString description() const;
|
|
|
|
QDateTime descriptionChanged() const;
|
|
|
|
QString defaultUserName() const;
|
2010-08-12 15:38:59 -04:00
|
|
|
QDateTime defaultUserNameChanged() const;
|
2010-08-07 09:10:44 -04:00
|
|
|
int maintenanceHistoryDays() const;
|
|
|
|
bool protectTitle() const;
|
|
|
|
bool protectUsername() const;
|
|
|
|
bool protectPassword() const;
|
|
|
|
bool protectUrl() const;
|
|
|
|
bool protectNotes() const;
|
|
|
|
bool autoEnableVisualHiding() const;
|
2012-01-01 15:52:54 -05:00
|
|
|
QImage customIcon(const Uuid& uuid) const;
|
|
|
|
QHash<Uuid, QImage> customIcons() const;
|
2010-08-07 09:10:44 -04:00
|
|
|
bool recycleBinEnabled() const;
|
2010-08-13 12:08:06 -04:00
|
|
|
const Group* recycleBin() const;
|
2010-08-07 09:10:44 -04:00
|
|
|
QDateTime recycleBinChanged() const;
|
2010-08-13 12:08:06 -04:00
|
|
|
const Group* entryTemplatesGroup() const;
|
2010-08-07 09:10:44 -04:00
|
|
|
QDateTime entryTemplatesGroupChanged() const;
|
2010-08-13 12:08:06 -04:00
|
|
|
const Group* lastSelectedGroup() const;
|
|
|
|
const Group* lastTopVisibleGroup() const;
|
2010-09-25 06:41:00 -04:00
|
|
|
QDateTime masterKeyChanged() const;
|
|
|
|
int masterKeyChangeRec() const;
|
|
|
|
int masterKeyChangeForce() const;
|
2010-08-07 09:10:44 -04:00
|
|
|
QHash<QString, QString> customFields() const;
|
|
|
|
|
|
|
|
void setGenerator(const QString& value);
|
|
|
|
void setName(const QString& value);
|
|
|
|
void setNameChanged(const QDateTime& value);
|
|
|
|
void setDescription(const QString& value);
|
|
|
|
void setDescriptionChanged(const QDateTime& value);
|
|
|
|
void setDefaultUserName(const QString& value);
|
2010-08-12 15:38:59 -04:00
|
|
|
void setDefaultUserNameChanged(const QDateTime& value);
|
2010-08-07 09:10:44 -04:00
|
|
|
void setMaintenanceHistoryDays(int value);
|
|
|
|
void setProtectTitle(bool value);
|
|
|
|
void setProtectUsername(bool value);
|
|
|
|
void setProtectPassword(bool value);
|
|
|
|
void setProtectUrl(bool value);
|
|
|
|
void setProtectNotes(bool value);
|
|
|
|
void setAutoEnableVisualHiding(bool value);
|
2012-01-01 15:52:54 -05:00
|
|
|
void addCustomIcon(const Uuid& uuid, const QImage& icon);
|
2010-08-07 09:10:44 -04:00
|
|
|
void removeCustomIcon(const Uuid& uuid);
|
|
|
|
void setRecycleBinEnabled(bool value);
|
2010-08-13 12:08:06 -04:00
|
|
|
void setRecycleBin(Group* group);
|
2010-08-07 09:10:44 -04:00
|
|
|
void setRecycleBinChanged(const QDateTime& value);
|
2010-08-13 12:08:06 -04:00
|
|
|
void setEntryTemplatesGroup(Group* group);
|
2010-08-07 09:10:44 -04:00
|
|
|
void setEntryTemplatesGroupChanged(const QDateTime& value);
|
2010-08-13 12:08:06 -04:00
|
|
|
void setLastSelectedGroup(Group* group);
|
|
|
|
void setLastTopVisibleGroup(Group* group);
|
2010-09-25 06:41:00 -04:00
|
|
|
void setMasterKeyChanged(const QDateTime& value);
|
|
|
|
void setMasterKeyChangeRec(int value);
|
|
|
|
void setMasterKeyChangeForce(int value);
|
2010-08-07 09:10:44 -04:00
|
|
|
void addCustomField(const QString& key, const QString& value);
|
|
|
|
void removeCustomField(const QString& key);
|
2012-04-11 09:57:11 -04:00
|
|
|
void setUpdateDatetime(bool value);
|
2010-08-07 09:10:44 -04:00
|
|
|
|
2012-04-18 15:59:00 -04:00
|
|
|
void addEntryToRecycleBin(Entry* entry);
|
|
|
|
|
2011-11-13 08:54:11 -05:00
|
|
|
Q_SIGNALS:
|
|
|
|
void nameTextChanged(Database* db);
|
2012-04-11 09:57:11 -04:00
|
|
|
void modified();
|
2011-11-13 08:54:11 -05:00
|
|
|
|
2010-08-07 09:10:44 -04:00
|
|
|
private:
|
2012-04-11 09:57:11 -04:00
|
|
|
template <class T> inline bool set(T& property, const T& value, QDateTime& dateTime);
|
|
|
|
template <class T> inline bool set(T& property, const T& value);
|
|
|
|
|
2011-11-13 08:54:11 -05:00
|
|
|
Database* m_parent;
|
|
|
|
|
2010-08-07 09:10:44 -04:00
|
|
|
QString m_generator;
|
|
|
|
QString m_name;
|
|
|
|
QDateTime m_nameChanged;
|
|
|
|
QString m_description;
|
|
|
|
QDateTime m_descriptionChanged;
|
|
|
|
QString m_defaultUserName;
|
2010-08-12 15:38:59 -04:00
|
|
|
QDateTime m_defaultUserNameChanged;
|
2010-08-07 09:10:44 -04:00
|
|
|
int m_maintenanceHistoryDays;
|
|
|
|
|
|
|
|
bool m_protectTitle;
|
|
|
|
bool m_protectUsername;
|
|
|
|
bool m_protectPassword;
|
|
|
|
bool m_protectUrl;
|
|
|
|
bool m_protectNotes;
|
|
|
|
bool m_autoEnableVisualHiding;
|
|
|
|
|
2012-01-01 15:52:54 -05:00
|
|
|
QHash<Uuid, QImage> m_customIcons;
|
2010-08-07 09:10:44 -04:00
|
|
|
|
|
|
|
bool m_recycleBinEnabled;
|
2010-08-13 12:08:06 -04:00
|
|
|
Group* m_recycleBin;
|
2010-08-07 09:10:44 -04:00
|
|
|
QDateTime m_recycleBinChanged;
|
2010-08-13 12:08:06 -04:00
|
|
|
Group* m_entryTemplatesGroup;
|
2010-08-07 09:10:44 -04:00
|
|
|
QDateTime m_entryTemplatesGroupChanged;
|
2010-08-13 12:08:06 -04:00
|
|
|
Group* m_lastSelectedGroup;
|
|
|
|
Group* m_lastTopVisibleGroup;
|
2010-08-07 09:10:44 -04:00
|
|
|
|
2010-09-25 06:41:00 -04:00
|
|
|
QDateTime m_masterKeyChanged;
|
|
|
|
int m_masterKeyChangeRec;
|
|
|
|
int m_masterKeyChangeForce;
|
|
|
|
|
2010-08-07 09:10:44 -04:00
|
|
|
QHash<QString, QString> m_customFields;
|
2012-04-11 09:57:11 -04:00
|
|
|
|
|
|
|
bool m_updateDatetime;
|
2010-08-07 09:10:44 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // KEEPASSX_METADATA_H
|