[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [sink/develop] common: Properly track changes applied by preprocessors
From: Christian Mollekopf <chrigi_1 () fastmail ! fm>
Date: 2016-06-30 19:49:33
Message-ID: E1bIhxt-0005c3-8s () code ! kde ! org
[Download RAW message or body]
Git commit ef9a070c10dffc346b7dee0c7714d7bda7663017 by Christian Mollekopf.
Committed on 30/06/2016 at 13:13.
Pushed by cmollekopf into branch 'develop'.
Properly track changes applied by preprocessors
This is necessary so we get the actual changeset during replay,
so a mark-as-read action doesn't result in a new mime message, but only
the flag change.
M +14 -0 common/bufferadaptor.h
M +3 -2 common/pipeline.cpp
http://commits.kde.org/akonadi-next/ef9a070c10dffc346b7dee0c7714d7bda7663017
diff --git a/common/bufferadaptor.h b/common/bufferadaptor.h
index ad50582..2a40d18 100644
--- a/common/bufferadaptor.h
+++ b/common/bufferadaptor.h
@@ -82,15 +82,29 @@ public:
}
virtual void setProperty(const QByteArray &key, const QVariant &value)
{
+ if (value != mValues.value(key)) {
+ mChanges << key;
+ }
mValues.insert(key, value);
}
+
virtual QByteArrayList availableProperties() const
{
return mValues.keys();
}
+ void resetChangedProperties()
+ {
+ mChanges.clear();
+ }
+
+ QList<QByteArray> changedProperties() const
+ {
+ return mChanges;
+ }
private:
QHash<QByteArray, QVariant> mValues;
+ QList<QByteArray> mChanges;
};
}
}
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index 976a83f..c6d5297 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -305,7 +305,7 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, \
size_t size)
// Apply diff
// FIXME only apply the properties that are available in the buffer
- Trace() << "Applying changed properties: " << diff->availableProperties();
+ Trace() << "Applying changed properties: " << changeset;
for (const auto &property : changeset) {
const auto value = diff->getProperty(property);
if (value.isValid()) {
@@ -320,6 +320,7 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, \
size_t size) }
}
+ newAdaptor->resetChangedProperties();
for (auto processor : d->processors[bufferType]) {
processor->modifiedEntity(key, Storage::maxRevision(d->transaction) + 1, \
*current, *newAdaptor, d->transaction); }
@@ -330,7 +331,7 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, \
size_t size) flatbuffers::FlatBufferBuilder metadataFbb;
{
//We add availableProperties to account for the properties that have been \
changed by the preprocessors
- auto modifiedProperties = BufferUtils::toVector(metadataFbb, changeset + \
newAdaptor->availableProperties()); + auto modifiedProperties = \
BufferUtils::toVector(metadataFbb, changeset + newAdaptor->changedProperties()); \
auto metadataBuilder = MetadataBuilder(metadataFbb); \
metadataBuilder.add_revision(newRevision); \
metadataBuilder.add_operation(Operation_Modification);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic