mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add slot to update the timeinfo of a group and connect it on modified signal.
Connect modified signal of entries directly to database, so timeinfo of group is not updated.
This commit is contained in:
parent
9dc362c97e
commit
d73cbafb8e
@ -35,6 +35,8 @@ Group::Group()
|
|||||||
m_searchingEnabled = Inherit;
|
m_searchingEnabled = Inherit;
|
||||||
|
|
||||||
m_updateTimeinfo = true;
|
m_updateTimeinfo = true;
|
||||||
|
|
||||||
|
connect(this, SIGNAL(modified()), this, SLOT(updateTimeinfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Group::~Group()
|
Group::~Group()
|
||||||
@ -45,10 +47,6 @@ Group::~Group()
|
|||||||
template <class T> bool Group::set(T& property, const T& value) {
|
template <class T> bool Group::set(T& property, const T& value) {
|
||||||
if (property != value) {
|
if (property != value) {
|
||||||
property = value;
|
property = value;
|
||||||
if (m_updateTimeinfo) {
|
|
||||||
m_timeInfo.setLastModificationTime(QDateTime::currentDateTimeUtc());
|
|
||||||
m_timeInfo.setLastAccessTime(QDateTime::currentDateTimeUtc());
|
|
||||||
}
|
|
||||||
Q_EMIT modified();
|
Q_EMIT modified();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -57,6 +55,14 @@ template <class T> bool Group::set(T& property, const T& value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Group::updateTimeinfo()
|
||||||
|
{
|
||||||
|
if (m_updateTimeinfo) {
|
||||||
|
m_timeInfo.setLastModificationTime(QDateTime::currentDateTimeUtc());
|
||||||
|
m_timeInfo.setLastAccessTime(QDateTime::currentDateTimeUtc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Group::setUpdateTimeinfo(bool value) {
|
void Group::setUpdateTimeinfo(bool value) {
|
||||||
m_updateTimeinfo = value;
|
m_updateTimeinfo = value;
|
||||||
}
|
}
|
||||||
@ -304,7 +310,7 @@ void Group::addEntry(Entry *entry)
|
|||||||
|
|
||||||
m_entries << entry;
|
m_entries << entry;
|
||||||
connect(entry, SIGNAL(dataChanged(Entry*)), SIGNAL(entryDataChanged(Entry*)));
|
connect(entry, SIGNAL(dataChanged(Entry*)), SIGNAL(entryDataChanged(Entry*)));
|
||||||
connect(entry, SIGNAL(modified()), this, SIGNAL(modified()));
|
connect(entry, SIGNAL(modified()), m_db, SIGNAL(modified()));
|
||||||
|
|
||||||
Q_EMIT modified();
|
Q_EMIT modified();
|
||||||
Q_EMIT entryAdded();
|
Q_EMIT entryAdded();
|
||||||
|
@ -92,6 +92,9 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
void modified();
|
void modified();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void updateTimeinfo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <class T> inline bool set(T& property, const T& value);
|
template <class T> inline bool set(T& property, const T& value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user