diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-25 10:21:36 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-25 10:21:36 +0200 |
commit | 7ed3ecd282516296bbc7e4a2a24d1e3266bd8601 (patch) | |
tree | f7c41bcf967a7daafeb70b5421f166db58ebbc3b /examples/maildirresource/maildirresource.cpp | |
parent | 76892330fbf737cbdb09dc7bc4099418fc4cd1cc (diff) | |
download | sink-7ed3ecd282516296bbc7e4a2a24d1e3266bd8601.tar.gz sink-7ed3ecd282516296bbc7e4a2a24d1e3266bd8601.zip |
Maildir folder inspection
Diffstat (limited to 'examples/maildirresource/maildirresource.cpp')
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 6dc9990..e1e4d95 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -531,7 +531,11 @@ KAsync::Job<void> MaildirResource::inspect(int inspectionType, const QByteArray | |||
531 | } | 531 | } |
532 | if (domainType == ENTITY_TYPE_FOLDER) { | 532 | if (domainType == ENTITY_TYPE_FOLDER) { |
533 | const auto remoteId = resolveLocalId(ENTITY_TYPE_FOLDER, entityId, synchronizationTransaction); | 533 | const auto remoteId = resolveLocalId(ENTITY_TYPE_FOLDER, entityId, synchronizationTransaction); |
534 | auto mainDatabase = Sink::Storage::mainDatabase(transaction, ENTITY_TYPE_FOLDER); | ||
535 | auto bufferAdaptor = getLatest(mainDatabase, entityId, *mMailAdaptorFactory); | ||
536 | Q_ASSERT(bufferAdaptor); | ||
534 | 537 | ||
538 | const Sink::ApplicationDomain::Folder folder(mResourceInstanceIdentifier, entityId, 0, bufferAdaptor); | ||
535 | if (inspectionType == Sink::ResourceControl::Inspection::CacheIntegrityInspectionType) { | 539 | if (inspectionType == Sink::ResourceControl::Inspection::CacheIntegrityInspectionType) { |
536 | if (!QDir(remoteId).exists()) { | 540 | if (!QDir(remoteId).exists()) { |
537 | return KAsync::error<void>(1, "The directory is not existing: " + remoteId); | 541 | return KAsync::error<void>(1, "The directory is not existing: " + remoteId); |
@@ -551,6 +555,14 @@ KAsync::Job<void> MaildirResource::inspect(int inspectionType, const QByteArray | |||
551 | if (list.size() != expectedCount) { | 555 | if (list.size() != expectedCount) { |
552 | return KAsync::error<void>(1, QString("Wrong number of files; found %1 instead of %2.").arg(list.size()).arg(expectedCount)); | 556 | return KAsync::error<void>(1, QString("Wrong number of files; found %1 instead of %2.").arg(list.size()).arg(expectedCount)); |
553 | } | 557 | } |
558 | if (inspectionType == Sink::ResourceControl::Inspection::ExistenceInspectionType) { | ||
559 | if (!remoteId.endsWith(folder.getName().toUtf8())) { | ||
560 | return KAsync::error<void>(1, "Wrong folder name: " + remoteId); | ||
561 | } | ||
562 | if (QDir(remoteId).exists() != expectedValue.toBool()) { | ||
563 | return KAsync::error<void>(1, "Wrong folder existence: " + remoteId); | ||
564 | } | ||
565 | } | ||
554 | } | 566 | } |
555 | } | 567 | } |
556 | return KAsync::null<void>(); | 568 | return KAsync::null<void>(); |