Changeset View
Changeset View
Standalone View
Standalone View
src/core/jobs/itemmodifyjob.cpp
Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Line(s) | 219 | if (!mParts.isEmpty()) { | |||
---|---|---|---|---|---|
220 | QSet<QByteArray> parts; | 220 | QSet<QByteArray> parts; | ||
221 | parts.reserve(mParts.size()); | 221 | parts.reserve(mParts.size()); | ||
222 | for (const QByteArray &part : qAsConst(mParts)) { | 222 | for (const QByteArray &part : qAsConst(mParts)) { | ||
223 | parts.insert(ProtocolHelper::encodePartIdentifier(ProtocolHelper::PartPayload, part)); | 223 | parts.insert(ProtocolHelper::encodePartIdentifier(ProtocolHelper::PartPayload, part)); | ||
224 | } | 224 | } | ||
225 | cmd->setParts(parts); | 225 | cmd->setParts(parts); | ||
226 | } | 226 | } | ||
227 | 227 | | |||
228 | const auto deletedAttributes = ItemChangeLog::instance()->deletedAttributes(item.d_ptr); | 228 | const AttributeStorage &attributeStorage = ItemChangeLog::instance()->attributeStorage(item.d_ptr); | ||
229 | const QSet<QByteArray> deletedAttributes = attributeStorage.deletedAttributes(); | ||||
229 | if (!deletedAttributes.isEmpty()) { | 230 | if (!deletedAttributes.isEmpty()) { | ||
230 | QSet<QByteArray> removedParts; | 231 | QSet<QByteArray> removedParts; | ||
231 | removedParts.reserve(deletedAttributes.size()); | 232 | removedParts.reserve(deletedAttributes.size()); | ||
232 | for (const QByteArray &part : deletedAttributes) { | 233 | for (const QByteArray &part : deletedAttributes) { | ||
233 | removedParts.insert("ATR:" + part); | 234 | removedParts.insert("ATR:" + part); | ||
234 | } | 235 | } | ||
235 | cmd->setRemovedParts(removedParts); | 236 | cmd->setRemovedParts(removedParts); | ||
236 | } | 237 | } | ||
238 | if (attributeStorage.hasModifiedAttributes()) { | ||||
239 | cmd->setAttributes(ProtocolHelper::attributesToProtocol(attributeStorage.modifiedAttributes())); | ||||
240 | } | ||||
237 | 241 | | |||
238 | // nothing to do | 242 | // nothing to do | ||
239 | if (cmd->modifiedParts() == Protocol::ModifyItemsCommand::None | 243 | if (cmd->modifiedParts() == Protocol::ModifyItemsCommand::None | ||
240 | && mParts.isEmpty() | 244 | && mParts.isEmpty() | ||
241 | && item.attributes().isEmpty() | | |||
242 | && !cmd->invalidateCache()) { | 245 | && !cmd->invalidateCache()) { | ||
243 | return cmd; | 246 | return cmd; | ||
244 | } | 247 | } | ||
245 | 248 | | |||
246 | cmd->setItems(ProtocolHelper::entitySetToScope(mItems)); | 249 | cmd->setItems(ProtocolHelper::entitySetToScope(mItems)); | ||
247 | if (mRevCheck && item.revision() >= 0) { | 250 | if (mRevCheck && item.revision() >= 0) { | ||
248 | cmd->setOldRevision(item.revision()); | 251 | cmd->setOldRevision(item.revision()); | ||
249 | } | 252 | } | ||
250 | 253 | | |||
251 | if (item.d_ptr->mSizeChanged) { | 254 | if (item.d_ptr->mSizeChanged) { | ||
252 | cmd->setItemSize(item.size()); | 255 | cmd->setItemSize(item.size()); | ||
253 | } | 256 | } | ||
254 | 257 | | |||
255 | cmd->setAttributes(ProtocolHelper::attributesToProtocol(item)); | | |||
256 | | ||||
257 | return cmd; | 258 | return cmd; | ||
258 | } | 259 | } | ||
259 | 260 | | |||
260 | void ItemModifyJob::doStart() | 261 | void ItemModifyJob::doStart() | ||
261 | { | 262 | { | ||
262 | Q_D(ItemModifyJob); | 263 | Q_D(ItemModifyJob); | ||
263 | 264 | | |||
264 | Protocol::ModifyItemsCommandPtr command; | 265 | Protocol::ModifyItemsCommandPtr command; | ||
▲ Show 20 Lines • Show All 163 Lines • Show Last 20 Lines |