From 0b592c69b0b6c7b29f3ec948dceda26ddea3d3db Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Fri, 11 May 2012 14:13:22 +0200 Subject: [PATCH] Emit defaultKeyModified() only when the data has actually changed. --- src/core/EntryAttributes.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/EntryAttributes.cpp b/src/core/EntryAttributes.cpp index 64232d65..c35aa4b2 100644 --- a/src/core/EntryAttributes.cpp +++ b/src/core/EntryAttributes.cpp @@ -46,13 +46,14 @@ void EntryAttributes::set(const QString& key, const QString& value, bool protect bool emitModified = false; bool addAttribute = !m_attributes.contains(key); + bool changeValue = !addAttribute && (m_attributes.value(key) != value); bool defaultAttribute = isDefaultAttribute(key); if (addAttribute && !defaultAttribute) { Q_EMIT aboutToBeAdded(key); } - if (addAttribute || m_attributes.value(key) != value) { + if (addAttribute || changeValue) { m_attributes.insert(key, value); emitModified = true; } @@ -71,7 +72,7 @@ void EntryAttributes::set(const QString& key, const QString& value, bool protect Q_EMIT modified(); } - if (defaultAttribute) { + if (defaultAttribute && changeValue) { Q_EMIT defaultKeyModified(); } else if (addAttribute) {