From 63290ccce102495427a26e689725e565a03ae77a Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 27 Jul 2017 15:45:12 -0600 Subject: Skip modifications that do nothing. This allows us to i.e. blindly mark mails as read in kube, with the modification automatically being dropped if it doesn't do anything useful. --- common/domain/applicationdomaintype.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'common/domain') diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index 2050fac..ee70c35 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp @@ -222,8 +222,13 @@ QVariant ApplicationDomainType::getProperty(const QByteArray &key) const void ApplicationDomainType::setProperty(const QByteArray &key, const QVariant &value) { Q_ASSERT(mAdaptor); - mChangeSet->insert(key); - mAdaptor->setProperty(key, value); + auto existing = mAdaptor->getProperty(key); + if (existing.isValid() && existing == value) { + SinkTrace() << "Tried to set property that is still the same: " << key << value; + } else { + mChangeSet->insert(key); + mAdaptor->setProperty(key, value); + } } void ApplicationDomainType::setResource(const QByteArray &identifier) -- cgit v1.2.3