diff options
Diffstat (limited to 'common/resourceaccess.cpp')
-rw-r--r-- | common/resourceaccess.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 7be1259..65e9a8c 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "common/modifyentity_generated.h" | 30 | #include "common/modifyentity_generated.h" |
31 | #include "common/deleteentity_generated.h" | 31 | #include "common/deleteentity_generated.h" |
32 | #include "common/revisionreplayed_generated.h" | 32 | #include "common/revisionreplayed_generated.h" |
33 | #include "common/inspection_generated.h" | ||
33 | #include "common/entitybuffer.h" | 34 | #include "common/entitybuffer.h" |
34 | #include "log.h" | 35 | #include "log.h" |
35 | 36 | ||
@@ -37,6 +38,8 @@ | |||
37 | #include <QDebug> | 38 | #include <QDebug> |
38 | #include <QDir> | 39 | #include <QDir> |
39 | #include <QProcess> | 40 | #include <QProcess> |
41 | #include <QDataStream> | ||
42 | #include <QBuffer> | ||
40 | 43 | ||
41 | #undef Trace | 44 | #undef Trace |
42 | #define Trace() Akonadi2::Log::debugStream(Akonadi2::Log::DebugLevel::Trace, __LINE__, __FILE__, Q_FUNC_INFO, "ResourceAccess") | 45 | #define Trace() Akonadi2::Log::debugStream(Akonadi2::Log::DebugLevel::Trace, __LINE__, __FILE__, Q_FUNC_INFO, "ResourceAccess") |
@@ -338,6 +341,25 @@ KAsync::Job<void> ResourceAccess::sendRevisionReplayedCommand(qint64 revision) | |||
338 | return sendCommand(Akonadi2::Commands::RevisionReplayedCommand, fbb); | 341 | return sendCommand(Akonadi2::Commands::RevisionReplayedCommand, fbb); |
339 | } | 342 | } |
340 | 343 | ||
344 | KAsync::Job<void> ResourceAccess::sendInspectionCommand(const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) | ||
345 | { | ||
346 | flatbuffers::FlatBufferBuilder fbb; | ||
347 | auto id = fbb.CreateString(inspectionId.toStdString()); | ||
348 | auto domain = fbb.CreateString(domainType.toStdString()); | ||
349 | auto entity = fbb.CreateString(entityId.toStdString()); | ||
350 | auto prop = fbb.CreateString(property.toStdString()); | ||
351 | |||
352 | QByteArray array; | ||
353 | QDataStream s(&array, QIODevice::WriteOnly); | ||
354 | s << expectedValue; | ||
355 | |||
356 | auto expected = fbb.CreateString(array.toStdString()); | ||
357 | auto location = Akonadi2::Commands::CreateInspection (fbb, id, 0, entity, domain, prop, expected); | ||
358 | Akonadi2::Commands::FinishInspectionBuffer(fbb, location); | ||
359 | open(); | ||
360 | return sendCommand(Akonadi2::Commands::InspectionCommand, fbb); | ||
361 | } | ||
362 | |||
341 | void ResourceAccess::open() | 363 | void ResourceAccess::open() |
342 | { | 364 | { |
343 | if (d->socket && d->socket->isValid()) { | 365 | if (d->socket && d->socket->isValid()) { |