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_GROUP_H
|
|
|
|
#define KEEPASSX_GROUP_H
|
|
|
|
|
2010-09-19 15:22:24 -04:00
|
|
|
#include <QtGui/QIcon>
|
2010-08-12 15:38:59 -04:00
|
|
|
|
2010-08-07 09:10:44 -04:00
|
|
|
#include "Entry.h"
|
2010-08-12 15:38:59 -04:00
|
|
|
#include "TimeInfo.h"
|
2010-08-07 09:10:44 -04:00
|
|
|
#include "Uuid.h"
|
|
|
|
|
2010-08-12 15:38:59 -04:00
|
|
|
class Database;
|
|
|
|
|
|
|
|
class Group : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2011-07-07 06:45:14 -04:00
|
|
|
enum TriState { Inherit, Enable, Disable };
|
|
|
|
|
2010-08-12 15:38:59 -04:00
|
|
|
Group();
|
2010-08-18 10:22:48 -04:00
|
|
|
~Group();
|
2010-08-12 15:38:59 -04:00
|
|
|
Uuid uuid() const;
|
|
|
|
QString name() const;
|
|
|
|
QString notes() const;
|
2010-09-19 15:22:24 -04:00
|
|
|
QIcon icon() const;
|
2010-08-18 16:57:26 -04:00
|
|
|
int iconNumber() const;
|
|
|
|
Uuid iconUuid() const;
|
2010-08-12 15:38:59 -04:00
|
|
|
TimeInfo timeInfo() const;
|
|
|
|
bool isExpanded() const;
|
|
|
|
QString defaultAutoTypeSequence() const;
|
2011-07-07 06:45:14 -04:00
|
|
|
Group::TriState autoTypeEnabled() const;
|
|
|
|
Group::TriState searchingEnabed() const;
|
2010-08-12 15:38:59 -04:00
|
|
|
Entry* lastTopVisibleEntry() const;
|
|
|
|
|
|
|
|
void setUuid(const Uuid& uuid);
|
|
|
|
void setName(const QString& name);
|
|
|
|
void setNotes(const QString& notes);
|
|
|
|
void setIcon(int iconNumber);
|
|
|
|
void setIcon(const Uuid& uuid);
|
|
|
|
void setTimeInfo(const TimeInfo& timeInfo);
|
|
|
|
void setExpanded(bool expanded);
|
|
|
|
void setDefaultAutoTypeSequence(const QString& sequence);
|
2011-07-07 06:45:14 -04:00
|
|
|
void setAutoTypeEnabled(TriState enable);
|
|
|
|
void setSearchingEnabled(TriState enable);
|
2010-08-12 15:38:59 -04:00
|
|
|
void setLastTopVisibleEntry(Entry* entry);
|
|
|
|
|
2010-08-23 15:30:20 -04:00
|
|
|
Group* parentGroup();
|
2010-08-15 06:31:48 -04:00
|
|
|
const Group* parentGroup() const;
|
2010-08-18 04:27:40 -04:00
|
|
|
void setParent(Group* parent, int index = -1);
|
2010-08-12 15:38:59 -04:00
|
|
|
void setParent(Database* db);
|
|
|
|
|
2010-08-14 06:24:35 -04:00
|
|
|
const Database* database() const;
|
2010-08-15 06:31:48 -04:00
|
|
|
QList<Group*> children();
|
2010-08-25 08:00:46 -04:00
|
|
|
const QList<Group*>& children() const;
|
2010-08-15 06:31:48 -04:00
|
|
|
QList<Entry*> entries();
|
2010-08-25 08:00:46 -04:00
|
|
|
const QList<Entry*>& entries() const;
|
2010-08-12 15:38:59 -04:00
|
|
|
void addEntry(Entry* entry);
|
|
|
|
void removeEntry(Entry* entry);
|
|
|
|
|
2010-08-15 09:03:47 -04:00
|
|
|
Q_SIGNALS:
|
2010-08-23 15:30:20 -04:00
|
|
|
void dataChanged(Group* group);
|
2010-08-18 10:22:48 -04:00
|
|
|
|
2010-08-23 15:30:20 -04:00
|
|
|
void aboutToAdd(Group* group, int index);
|
2010-08-18 04:27:40 -04:00
|
|
|
void added();
|
2010-08-23 15:30:20 -04:00
|
|
|
void aboutToRemove(Group* group);
|
2010-08-18 10:22:48 -04:00
|
|
|
void removed();
|
|
|
|
|
2010-08-23 15:30:20 -04:00
|
|
|
void entryAboutToAdd(Entry* entry);
|
2010-08-18 10:22:48 -04:00
|
|
|
void entryAdded();
|
2010-08-23 15:30:20 -04:00
|
|
|
void entryAboutToRemove(Entry* entry);
|
2010-08-18 10:22:48 -04:00
|
|
|
void entryRemoved();
|
|
|
|
|
2010-08-23 15:30:20 -04:00
|
|
|
void entryDataChanged(Entry* entry);
|
2010-08-15 09:03:47 -04:00
|
|
|
|
2010-08-07 09:10:44 -04:00
|
|
|
private:
|
2010-08-14 06:24:35 -04:00
|
|
|
void recSetDatabase(Database* db);
|
|
|
|
|
2010-08-12 15:38:59 -04:00
|
|
|
Database* m_db;
|
2010-08-07 09:10:44 -04:00
|
|
|
Uuid m_uuid;
|
|
|
|
QString m_name;
|
|
|
|
QString m_notes;
|
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
|
|
|
TimeInfo m_timeInfo;
|
2010-08-07 09:10:44 -04:00
|
|
|
bool m_isExpanded;
|
2010-08-12 15:38:59 -04:00
|
|
|
QString m_defaultAutoTypeSequence;
|
2011-07-07 06:45:14 -04:00
|
|
|
TriState m_autoTypeEnabled;
|
|
|
|
TriState m_searchingEnabled;
|
2010-08-12 15:38:59 -04:00
|
|
|
Entry* m_lastTopVisibleEntry;
|
|
|
|
QList<Group*> m_children;
|
|
|
|
QList<Entry*> m_entries;
|
2010-08-07 09:10:44 -04:00
|
|
|
|
2010-08-12 15:38:59 -04:00
|
|
|
Group* m_parent;
|
2010-08-07 09:10:44 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // KEEPASSX_GROUP_H
|