mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-28 16:59:44 -05: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_updateTimeinfo = true;
|
||||
|
||||
connect(this, SIGNAL(modified()), this, SLOT(updateTimeinfo()));
|
||||
}
|
||||
|
||||
Group::~Group()
|
||||
@ -45,10 +47,6 @@ Group::~Group()
|
||||
template <class T> bool Group::set(T& property, const T& value) {
|
||||
if (property != value) {
|
||||
property = value;
|
||||
if (m_updateTimeinfo) {
|
||||
m_timeInfo.setLastModificationTime(QDateTime::currentDateTimeUtc());
|
||||
m_timeInfo.setLastAccessTime(QDateTime::currentDateTimeUtc());
|
||||
}
|
||||
Q_EMIT modified();
|
||||
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) {
|
||||
m_updateTimeinfo = value;
|
||||
}
|
||||
@ -304,7 +310,7 @@ void Group::addEntry(Entry *entry)
|
||||
|
||||
m_entries << 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 entryAdded();
|
||||
|
@ -92,6 +92,9 @@ Q_SIGNALS:
|
||||
|
||||
void modified();
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateTimeinfo();
|
||||
|
||||
private:
|
||||
template <class T> inline bool set(T& property, const T& value);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user