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_ENTRY_H
|
|
|
|
#define KEEPASSX_ENTRY_H
|
|
|
|
|
2012-04-09 16:20:11 -04:00
|
|
|
#include <QtCore/QMap>
|
2011-07-09 15:54:01 -04:00
|
|
|
#include <QtCore/QPointer>
|
2011-01-13 16:31:17 -05:00
|
|
|
#include <QtCore/QSet>
|
2010-08-12 15:38:59 -04:00
|
|
|
#include <QtCore/QUrl>
|
|
|
|
#include <QtGui/QColor>
|
2012-01-01 15:52:54 -05:00
|
|
|
#include <QtGui/QImage>
|
|
|
|
#include <QtGui/QPixmap>
|
|
|
|
#include <QtGui/QPixmapCache>
|
2010-08-12 15:38:59 -04:00
|
|
|
|
2011-07-08 08:51:14 -04:00
|
|
|
#include "core/TimeInfo.h"
|
|
|
|
#include "core/Uuid.h"
|
2010-08-07 09:10:44 -04:00
|
|
|
|
2010-08-14 06:24:35 -04:00
|
|
|
class Database;
|
2010-08-12 15:38:59 -04:00
|
|
|
class Group;
|
|
|
|
|
|
|
|
struct AutoTypeAssociation
|
|
|
|
{
|
|
|
|
QString window;
|
|
|
|
QString sequence;
|
|
|
|
};
|
2010-08-07 09:10:44 -04:00
|
|
|
|
2010-08-12 15:38:59 -04:00
|
|
|
class Entry : public QObject
|
2010-08-07 09:10:44 -04:00
|
|
|
{
|
2010-08-12 15:38:59 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
2010-08-07 09:10:44 -04:00
|
|
|
public:
|
|
|
|
Entry();
|
2010-08-18 10:22:48 -04:00
|
|
|
~Entry();
|
2010-08-12 15:38:59 -04:00
|
|
|
Uuid uuid() const;
|
2012-01-01 15:52:54 -05:00
|
|
|
QImage icon() const;
|
|
|
|
QPixmap iconPixmap() const;
|
2010-08-18 16:57:26 -04:00
|
|
|
int iconNumber() const;
|
|
|
|
Uuid iconUuid() const;
|
2010-08-12 15:38:59 -04:00
|
|
|
QColor foregroundColor() const;
|
|
|
|
QColor backgroundColor() const;
|
|
|
|
QString overrideUrl() const;
|
2010-09-25 06:41:00 -04:00
|
|
|
QString tags() const;
|
2010-08-12 15:38:59 -04:00
|
|
|
TimeInfo timeInfo() const;
|
|
|
|
bool autoTypeEnabled() const;
|
|
|
|
int autoTypeObfuscation() const;
|
|
|
|
QString defaultAutoTypeSequence() const;
|
|
|
|
const QList<AutoTypeAssociation>& autoTypeAssociations() const;
|
2012-04-09 16:20:11 -04:00
|
|
|
const QList<QString> attributes() const;
|
2012-04-06 13:33:29 -04:00
|
|
|
QString attributeValue(const QString& key) const;
|
2012-04-09 16:20:11 -04:00
|
|
|
const QList<QString> attachments() const;
|
2012-04-06 13:33:29 -04:00
|
|
|
QByteArray attachmentValue(const QString& key) const;
|
2011-01-13 16:31:17 -05:00
|
|
|
bool isAttributeProtected(const QString& key) const;
|
|
|
|
bool isAttachmentProtected(const QString& key) const;
|
2010-08-18 09:08:17 -04:00
|
|
|
QString title() const;
|
|
|
|
QString url() const;
|
|
|
|
QString username() const;
|
|
|
|
QString password() const;
|
|
|
|
QString notes() const;
|
2010-08-12 15:38:59 -04:00
|
|
|
|
|
|
|
void setUuid(const Uuid& uuid);
|
|
|
|
void setIcon(int iconNumber);
|
|
|
|
void setIcon(const Uuid& uuid);
|
|
|
|
void setForegroundColor(const QColor& color);
|
|
|
|
void setBackgroundColor(const QColor& color);
|
|
|
|
void setOverrideUrl(const QString& url);
|
2010-09-25 06:41:00 -04:00
|
|
|
void setTags(const QString& tags);
|
2010-08-12 15:38:59 -04:00
|
|
|
void setTimeInfo(const TimeInfo& timeInfo);
|
|
|
|
void setAutoTypeEnabled(bool enable);
|
|
|
|
void setAutoTypeObfuscation(int obfuscation);
|
|
|
|
void setDefaultAutoTypeSequence(const QString& sequence);
|
|
|
|
void addAutoTypeAssociation(const AutoTypeAssociation& assoc);
|
2012-01-07 10:22:11 -05:00
|
|
|
void setAttribute(const QString& key, const QString& value, bool protect = false);
|
2011-01-13 16:31:17 -05:00
|
|
|
void removeAttribute(const QString& key);
|
2012-01-07 10:22:11 -05:00
|
|
|
void setAttachment(const QString& key, const QByteArray& value, bool protect = false);
|
2011-01-13 16:31:17 -05:00
|
|
|
void removeAttachment(const QString& key);
|
2010-08-18 09:08:17 -04:00
|
|
|
void setTitle(const QString& title);
|
|
|
|
void setUrl(const QString& url);
|
|
|
|
void setUsername(const QString& username);
|
|
|
|
void setPassword(const QString& password);
|
|
|
|
void setNotes(const QString& notes);
|
2010-08-12 15:38:59 -04:00
|
|
|
|
2010-08-25 07:52:59 -04:00
|
|
|
QList<Entry*> historyItems();
|
|
|
|
const QList<Entry*>& historyItems() const;
|
|
|
|
void addHistoryItem(Entry* entry);
|
|
|
|
|
2010-10-06 16:54:07 -04:00
|
|
|
Group* group();
|
2010-08-12 15:38:59 -04:00
|
|
|
void setGroup(Group* group);
|
2010-08-07 09:10:44 -04:00
|
|
|
|
2012-01-07 11:18:48 -05:00
|
|
|
static bool isDefaultAttribute(const QString& key);
|
2010-08-25 07:52:59 -04:00
|
|
|
|
2010-08-18 10:22:48 -04:00
|
|
|
Q_SIGNALS:
|
2011-07-08 07:57:02 -04:00
|
|
|
/**
|
|
|
|
* Emitted when a default attribute has been changed.
|
|
|
|
*/
|
2010-08-23 15:30:20 -04:00
|
|
|
void dataChanged(Entry* entry);
|
2010-08-18 10:22:48 -04:00
|
|
|
|
2012-04-09 17:52:06 -04:00
|
|
|
void attributeChanged(QString key);
|
|
|
|
void attributeAboutToBeAdded(QString key);
|
|
|
|
void attributeAdded(QString key);
|
|
|
|
void attributeAboutToBeRemoved(QString key);
|
|
|
|
void attributeRemoved(QString key);
|
|
|
|
|
|
|
|
void attachmentChanged(QString key);
|
|
|
|
void attachmentAboutToBeAdded(QString key);
|
|
|
|
void attachmentAdded(QString key);
|
|
|
|
void attachmentAboutToBeRemoved(QString key);
|
|
|
|
void attachmentRemoved(QString key);
|
|
|
|
|
2010-08-07 09:10:44 -04:00
|
|
|
private:
|
|
|
|
Uuid m_uuid;
|
2010-08-12 15:38:59 -04:00
|
|
|
int m_iconNumber;
|
2010-08-07 09:10:44 -04:00
|
|
|
Uuid m_customIcon;
|
2010-08-12 15:38:59 -04:00
|
|
|
QColor m_foregroundColor;
|
|
|
|
QColor m_backgroundColor;
|
|
|
|
QString m_overrideUrl;
|
2010-09-25 06:41:00 -04:00
|
|
|
QString m_tags;
|
2010-08-12 15:38:59 -04:00
|
|
|
TimeInfo m_timeInfo;
|
|
|
|
bool m_autoTypeEnabled;
|
|
|
|
int m_autoTypeObfuscation;
|
|
|
|
QString m_defaultAutoTypeSequence;
|
|
|
|
QList<AutoTypeAssociation> m_autoTypeAssociations;
|
2012-04-09 16:20:11 -04:00
|
|
|
QMap<QString, QString> m_attributes;
|
|
|
|
QMap<QString, QByteArray> m_binaries;
|
2011-01-13 16:31:17 -05:00
|
|
|
QSet<QString> m_protectedAttributes;
|
|
|
|
QSet<QString> m_protectedAttachments;
|
2010-08-12 15:38:59 -04:00
|
|
|
|
2010-08-25 07:52:59 -04:00
|
|
|
QList<Entry*> m_history;
|
2011-07-09 15:54:01 -04:00
|
|
|
QPointer<Group> m_group;
|
2010-08-14 06:24:35 -04:00
|
|
|
const Database* m_db;
|
2012-01-01 15:52:54 -05:00
|
|
|
QPixmapCache::Key m_pixmapCacheKey;
|
2011-07-07 06:42:08 -04:00
|
|
|
const static QStringList m_defaultAttibutes;
|
2010-08-07 09:10:44 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // KEEPASSX_ENTRY_H
|