Set the group of the entry in Database::recycleEntry().

Drop Metadata::addEntryToRecycleBin() and add a non-const
Metadata::recycleBin() getter instead.
This commit is contained in:
Felix Geyer 2012-04-18 23:17:29 +02:00
parent 8735a4846c
commit 3d1fc6cd6d
3 changed files with 8 additions and 10 deletions

View File

@ -188,12 +188,12 @@ void Database::recycleEntry(Entry* entry)
if (!m_metadata->recycleBin()) {
Group* recycleBin = new Group();
recycleBin->setUuid(Uuid::random());
recycleBin->setName("Recycle Bin");
recycleBin->setName(tr("Recycle Bin"));
recycleBin->setIcon(43);
recycleBin->setParent(rootGroup());
m_metadata->setRecycleBin(recycleBin);
}
m_metadata->addEntryToRecycleBin(entry);
entry->setGroup(metadata()->recycleBin());
}
else {
delete entry;

View File

@ -167,6 +167,11 @@ bool Metadata::recycleBinEnabled() const
return m_recycleBinEnabled;
}
Group* Metadata::recycleBin()
{
return m_recycleBin;
}
const Group* Metadata::recycleBin() const
{
return m_recycleBin;
@ -372,8 +377,3 @@ void Metadata::removeCustomField(const QString& key)
m_customFields.remove(key);
Q_EMIT modified();
}
void Metadata::addEntryToRecycleBin(Entry* entry)
{
entry->setGroup(m_recycleBin);
}

View File

@ -26,7 +26,6 @@
class Database;
class Group;
class Entry;
class Metadata : public QObject
{
@ -52,6 +51,7 @@ public:
QImage customIcon(const Uuid& uuid) const;
QHash<Uuid, QImage> customIcons() const;
bool recycleBinEnabled() const;
Group* recycleBin();
const Group* recycleBin() const;
QDateTime recycleBinChanged() const;
const Group* entryTemplatesGroup() const;
@ -93,8 +93,6 @@ public:
void removeCustomField(const QString& key);
void setUpdateDatetime(bool value);
void addEntryToRecycleBin(Entry* entry);
Q_SIGNALS:
void nameTextChanged(Database* db);
void modified();