diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-18 18:36:41 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-18 18:36:41 +0100 |
commit | 67e83aadde8db2bb1293cee61e8c6306a4ffcca0 (patch) | |
tree | 10531201cb5dca7617e17a4e4393bda20694c4ca /common/genericresource.cpp | |
parent | a857d9b36f80adf045cd195653cb2f8b91452981 (diff) | |
download | sink-67e83aadde8db2bb1293cee61e8c6306a4ffcca0.tar.gz sink-67e83aadde8db2bb1293cee61e8c6306a4ffcca0.zip |
Working resource inspection
Diffstat (limited to 'common/genericresource.cpp')
-rw-r--r-- | common/genericresource.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/common/genericresource.cpp b/common/genericresource.cpp index 90fc763..892c3db 100644 --- a/common/genericresource.cpp +++ b/common/genericresource.cpp | |||
@@ -301,6 +301,7 @@ GenericResource::GenericResource(const QByteArray &resourceInstanceIdentifier, c | |||
301 | if (Akonadi2::Commands::VerifyInspectionBuffer(verifier)) { | 301 | if (Akonadi2::Commands::VerifyInspectionBuffer(verifier)) { |
302 | auto buffer = Akonadi2::Commands::GetInspection(command); | 302 | auto buffer = Akonadi2::Commands::GetInspection(command); |
303 | int inspectionType = buffer->type(); | 303 | int inspectionType = buffer->type(); |
304 | QByteArray inspectionId = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer->id()->Data()), buffer->id()->size()); | ||
304 | QByteArray entityId = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer->entityId()->Data()), buffer->entityId()->size()); | 305 | QByteArray entityId = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer->entityId()->Data()), buffer->entityId()->size()); |
305 | QByteArray domainType = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer->domainType()->Data()), buffer->domainType()->size()); | 306 | QByteArray domainType = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer->domainType()->Data()), buffer->domainType()->size()); |
306 | QByteArray property = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer->property()->Data()), buffer->property()->size()); | 307 | QByteArray property = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer->property()->Data()), buffer->property()->size()); |
@@ -308,7 +309,21 @@ GenericResource::GenericResource(const QByteArray &resourceInstanceIdentifier, c | |||
308 | QDataStream s(expectedValueString); | 309 | QDataStream s(expectedValueString); |
309 | QVariant expectedValue; | 310 | QVariant expectedValue; |
310 | s >> expectedValue; | 311 | s >> expectedValue; |
311 | return inspect(inspectionType, domainType, entityId, property, expectedValue); | 312 | inspect(inspectionType, inspectionId, domainType, entityId, property, expectedValue).then<void>([=]() { |
313 | Akonadi2::ResourceNotification n; | ||
314 | n.type = Akonadi2::NotificationType_Inspection; | ||
315 | n.id = inspectionId; | ||
316 | n.code = Akonadi2::NotificationCode_Success; | ||
317 | emit notify(n); | ||
318 | }, [=](int code, const QString &message) { | ||
319 | Akonadi2::ResourceNotification n; | ||
320 | n.type = Akonadi2::NotificationType_Inspection; | ||
321 | n.message = message; | ||
322 | n.id = inspectionId; | ||
323 | n.code = Akonadi2::NotificationCode_Failure; | ||
324 | emit notify(n); | ||
325 | }).exec(); | ||
326 | return KAsync::null<void>(); | ||
312 | } | 327 | } |
313 | return KAsync::error<void>(-1, "Invalid inspection command."); | 328 | return KAsync::error<void>(-1, "Invalid inspection command."); |
314 | }); | 329 | }); |
@@ -334,7 +349,7 @@ GenericResource::~GenericResource() | |||
334 | delete mSourceChangeReplay; | 349 | delete mSourceChangeReplay; |
335 | } | 350 | } |
336 | 351 | ||
337 | KAsync::Job<void> GenericResource::inspect(int inspectionType, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) | 352 | KAsync::Job<void> GenericResource::inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) |
338 | { | 353 | { |
339 | Warning() << "Inspection not implemented"; | 354 | Warning() << "Inspection not implemented"; |
340 | return KAsync::null<void>(); | 355 | return KAsync::null<void>(); |