From ef26065a99b595ae3bd59100d806a152ef345d3f Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Sun, 22 Apr 2012 12:09:12 +0200 Subject: [PATCH] Update LocationChanged time when entries and groups are moved. Closes #3 --- src/core/Entry.cpp | 8 ++++++++ src/core/Group.cpp | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index c579c5034..376bc4b42 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -357,6 +357,10 @@ Group* Entry::group() void Entry::setGroup(Group* group) { + if (m_group == group) { + return; + } + if (m_group) { m_group->removeEntry(this); if (m_group->database() != group->database() && m_group->database()) { @@ -367,6 +371,10 @@ void Entry::setGroup(Group* group) group->addEntry(this); m_group = group; QObject::setParent(group); + + if (m_updateTimeinfo) { + m_timeInfo.setLocationChanged(QDateTime::currentDateTimeUtc()); + } } void Entry::emitDataChanged() diff --git a/src/core/Group.cpp b/src/core/Group.cpp index c0bb67bb6..676ebaa5a 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -264,6 +264,9 @@ void Group::setParent(Group* parent, int index) index = parent->children().size(); } + if (m_parent == parent && index == parent->children().indexOf(this)) { + return; + } cleanupParent(); @@ -280,6 +283,10 @@ void Group::setParent(Group* parent, int index) parent->m_children.insert(index, this); + if (m_updateTimeinfo) { + m_timeInfo.setLocationChanged(QDateTime::currentDateTimeUtc()); + } + Q_EMIT modified(); Q_EMIT added(); }