mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-26 22:36:59 -05:00
Add slot to update the timeinfo of an entry and connect it on modified signal.
This commit is contained in:
parent
900420630d
commit
ad865774d1
@ -37,6 +37,7 @@ Entry::Entry()
|
||||
|
||||
m_attachments = new EntryAttachments(this);
|
||||
connect(m_attachments, SIGNAL(modified()), this, SIGNAL(modified()));
|
||||
connect(this, SIGNAL(modified()), this, SLOT(updateTimeinfo()));
|
||||
}
|
||||
|
||||
Entry::~Entry()
|
||||
@ -48,13 +49,10 @@ Entry::~Entry()
|
||||
qDeleteAll(m_history);
|
||||
}
|
||||
|
||||
template <class T> bool Entry::set(T& property, const T& value) {
|
||||
template <class T> bool Entry::set(T& property, const T& value)
|
||||
{
|
||||
if (property != value) {
|
||||
property = value;
|
||||
if (m_updateTimeinfo) {
|
||||
m_timeInfo.setLastModificationTime(QDateTime::currentDateTime());
|
||||
m_timeInfo.setLastAccessTime(QDateTime::currentDateTime());
|
||||
}
|
||||
Q_EMIT modified();
|
||||
return true;
|
||||
}
|
||||
@ -63,7 +61,17 @@ template <class T> bool Entry::set(T& property, const T& value) {
|
||||
}
|
||||
}
|
||||
|
||||
void Entry::setUpdateTimeinfo(bool value) {
|
||||
void Entry::updateTimeinfo()
|
||||
{
|
||||
if (m_updateTimeinfo) {
|
||||
m_timeInfo.setLastModificationTime(QDateTime::currentDateTime());
|
||||
m_timeInfo.setLastAccessTime(QDateTime::currentDateTime());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Entry::setUpdateTimeinfo(bool value)
|
||||
{
|
||||
m_updateTimeinfo = value;
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,7 @@ Q_SIGNALS:
|
||||
|
||||
private Q_SLOTS:
|
||||
void emitDataChanged();
|
||||
void updateTimeinfo();
|
||||
|
||||
private:
|
||||
const Database* database() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user