mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-09-19 23:56:10 +00:00
Call m_group->database() instead of keeping a reference to Database in Entries.
Previously we didn't update m_db when the database of the group changed.
This commit is contained in:
parent
123e3766fe
commit
a5ac1f2e80
@ -25,7 +25,6 @@
|
|||||||
Entry::Entry()
|
Entry::Entry()
|
||||||
{
|
{
|
||||||
m_group = 0;
|
m_group = 0;
|
||||||
m_db = 0;
|
|
||||||
m_updateTimeinfo = true;
|
m_updateTimeinfo = true;
|
||||||
|
|
||||||
m_iconNumber = 0;
|
m_iconNumber = 0;
|
||||||
@ -79,8 +78,8 @@ QImage Entry::icon() const
|
|||||||
return databaseIcons()->icon(m_iconNumber);
|
return databaseIcons()->icon(m_iconNumber);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// TODO check if m_db is 0
|
// TODO check if database() is 0
|
||||||
return m_db->metadata()->customIcon(m_customIcon);
|
return database()->metadata()->customIcon(m_customIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,8 +91,8 @@ QPixmap Entry::iconPixmap() const
|
|||||||
else {
|
else {
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) {
|
if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) {
|
||||||
// TODO check if m_db is 0
|
// TODO check if database() is 0
|
||||||
pixmap = QPixmap::fromImage(m_db->metadata()->customIcon(m_customIcon));
|
pixmap = QPixmap::fromImage(database()->metadata()->customIcon(m_customIcon));
|
||||||
*const_cast<QPixmapCache::Key*>(&m_pixmapCacheKey) = QPixmapCache::insert(pixmap);
|
*const_cast<QPixmapCache::Key*>(&m_pixmapCacheKey) = QPixmapCache::insert(pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +335,6 @@ void Entry::setGroup(Group* group)
|
|||||||
}
|
}
|
||||||
group->addEntry(this);
|
group->addEntry(this);
|
||||||
m_group = group;
|
m_group = group;
|
||||||
m_db = group->database();
|
|
||||||
QObject::setParent(group);
|
QObject::setParent(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,3 +342,13 @@ void Entry::emitDataChanged()
|
|||||||
{
|
{
|
||||||
Q_EMIT dataChanged(this);
|
Q_EMIT dataChanged(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Database* Entry::database() const
|
||||||
|
{
|
||||||
|
if (m_group) {
|
||||||
|
return m_group->database();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -111,6 +111,8 @@ private Q_SLOTS:
|
|||||||
void emitDataChanged();
|
void emitDataChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const Database* database() const;
|
||||||
|
|
||||||
Uuid m_uuid;
|
Uuid m_uuid;
|
||||||
int m_iconNumber;
|
int m_iconNumber;
|
||||||
Uuid m_customIcon;
|
Uuid m_customIcon;
|
||||||
@ -128,7 +130,6 @@ private:
|
|||||||
|
|
||||||
QList<Entry*> m_history;
|
QList<Entry*> m_history;
|
||||||
QPointer<Group> m_group;
|
QPointer<Group> m_group;
|
||||||
const Database* m_db;
|
|
||||||
QPixmapCache::Key m_pixmapCacheKey;
|
QPixmapCache::Key m_pixmapCacheKey;
|
||||||
bool m_updateTimeinfo;
|
bool m_updateTimeinfo;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user