mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-05 01:15:33 -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);
|
m_attachments = new EntryAttachments(this);
|
||||||
connect(m_attachments, SIGNAL(modified()), this, SIGNAL(modified()));
|
connect(m_attachments, SIGNAL(modified()), this, SIGNAL(modified()));
|
||||||
|
connect(this, SIGNAL(modified()), this, SLOT(updateTimeinfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry::~Entry()
|
Entry::~Entry()
|
||||||
@ -48,13 +49,10 @@ Entry::~Entry()
|
|||||||
qDeleteAll(m_history);
|
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) {
|
if (property != value) {
|
||||||
property = value;
|
property = value;
|
||||||
if (m_updateTimeinfo) {
|
|
||||||
m_timeInfo.setLastModificationTime(QDateTime::currentDateTime());
|
|
||||||
m_timeInfo.setLastAccessTime(QDateTime::currentDateTime());
|
|
||||||
}
|
|
||||||
Q_EMIT modified();
|
Q_EMIT modified();
|
||||||
return true;
|
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;
|
m_updateTimeinfo = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void emitDataChanged();
|
void emitDataChanged();
|
||||||
|
void updateTimeinfo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Database* database() const;
|
const Database* database() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user