mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 15:59:50 -05:00
Update connection of modified signals of entries when a parent group changes database.
This commit is contained in:
parent
ec3cca1f77
commit
d85e5d7560
@ -310,7 +310,9 @@ void Group::addEntry(Entry *entry)
|
||||
|
||||
m_entries << entry;
|
||||
connect(entry, SIGNAL(dataChanged(Entry*)), SIGNAL(entryDataChanged(Entry*)));
|
||||
connect(entry, SIGNAL(modified()), m_db, SIGNAL(modified()));
|
||||
if (m_db) {
|
||||
connect(entry, SIGNAL(modified()), m_db, SIGNAL(modified()));
|
||||
}
|
||||
|
||||
Q_EMIT modified();
|
||||
Q_EMIT entryAdded();
|
||||
@ -335,6 +337,11 @@ void Group::recSetDatabase(Database* db)
|
||||
disconnect(SIGNAL(added()), m_db);
|
||||
disconnect(SIGNAL(modified()), m_db);
|
||||
|
||||
Q_FOREACH (Entry* entry, m_entries) {
|
||||
entry->disconnect(m_db);
|
||||
connect(entry, SIGNAL(modified()), db, SIGNAL(modified()));
|
||||
}
|
||||
|
||||
connect(this, SIGNAL(dataChanged(Group*)), db, SIGNAL(groupDataChanged(Group*)));
|
||||
connect(this, SIGNAL(aboutToRemove(Group*)), db, SIGNAL(groupAboutToRemove(Group*)));
|
||||
connect(this, SIGNAL(removed()), db, SIGNAL(groupRemoved()));
|
||||
|
@ -71,6 +71,11 @@ void TestModified::testSignals()
|
||||
QCOMPARE(spyModified.count(), spyCount);
|
||||
QCOMPARE(spyModified2.count(), spyCount2);
|
||||
|
||||
entry1->setTitle("test");
|
||||
spyCount2++;
|
||||
QCOMPARE(spyModified.count(), spyCount);
|
||||
QCOMPARE(spyModified2.count(), spyCount2);
|
||||
|
||||
QPointer<Entry> entry2 = new Entry();
|
||||
entry2->setGroup(g2);
|
||||
spyCount++;
|
||||
|
Loading…
Reference in New Issue
Block a user