diff --git a/src/core/collection.h b/src/core/collection.h --- a/src/core/collection.h +++ b/src/core/collection.h @@ -549,6 +549,8 @@ friend class CollectionModifyJob; friend class ProtocolHelper; + void markAttributesChanged(); + //@cond PRIVATE QSharedDataPointer d_ptr; friend class CollectionPrivate; @@ -566,6 +568,7 @@ if (hasAttribute(dummy.type())) { T *attr = dynamic_cast(attribute(dummy.type())); if (attr) { + markAttributesChanged(); return attr; } //Reuse 5250 diff --git a/src/core/collection.cpp b/src/core/collection.cpp --- a/src/core/collection.cpp +++ b/src/core/collection.cpp @@ -177,6 +177,7 @@ } d_ptr->mAttributes.insert(attr->type(), attr); d_ptr->mDeletedAttributes.remove(attr->type()); + d_ptr->attributesChanged = true; } void Collection::removeAttribute(const QByteArray &type) @@ -460,3 +461,8 @@ { return d_ptr->keepLocalChanges; } + +void Collection::markAttributesChanged() +{ + d_ptr->attributesChanged = true; +} diff --git a/src/core/collection_p.h b/src/core/collection_p.h --- a/src/core/collection_p.h +++ b/src/core/collection_p.h @@ -48,6 +48,7 @@ , referencedChanged(false) , contentTypesChanged(false) , cachePolicyChanged(false) + , attributesChanged(false) , isVirtual(false) , mId(id) , mParent(nullptr) @@ -85,6 +86,7 @@ referenced = other.referenced; referencedChanged = other.referencedChanged; keepLocalChanges = other.keepLocalChanges; + attributesChanged = other.attributesChanged; } ~CollectionPrivate() @@ -100,6 +102,7 @@ enabledChanged = false; listPreferenceChanged = false; referencedChanged = false; + attributesChanged = false; mDeletedAttributes.clear(); } @@ -121,6 +124,7 @@ bool referencedChanged: 1; bool contentTypesChanged: 1; bool cachePolicyChanged: 1; + bool attributesChanged : 1; bool isVirtual: 1; // 2 bytes padding here diff --git a/src/core/jobs/collectionmodifyjob.cpp b/src/core/jobs/collectionmodifyjob.cpp --- a/src/core/jobs/collectionmodifyjob.cpp +++ b/src/core/jobs/collectionmodifyjob.cpp @@ -100,7 +100,7 @@ if (d->mCollection.d_ptr->referencedChanged) { cmd->setReferenced(d->mCollection.referenced()); } - if (!d->mCollection.attributes().isEmpty()) { + if (d->mCollection.d_ptr->attributesChanged) { cmd->setAttributes(ProtocolHelper::attributesToProtocol(d->mCollection)); } if (auto attr = d->mCollection.attribute()) {