diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/maildirresource/libmaildir/maildir.cpp | 2 | ||||
-rw-r--r-- | examples/maildirresource/libmaildir/maildir.h | 2 | ||||
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 18 |
3 files changed, 20 insertions, 2 deletions
diff --git a/examples/maildirresource/libmaildir/maildir.cpp b/examples/maildirresource/libmaildir/maildir.cpp index 94363b8..28cf46e 100644 --- a/examples/maildirresource/libmaildir/maildir.cpp +++ b/examples/maildirresource/libmaildir/maildir.cpp | |||
@@ -770,7 +770,7 @@ bool Maildir::removeEntry(const QString& key) | |||
770 | // return newUniqueKey; | 770 | // return newUniqueKey; |
771 | // } | 771 | // } |
772 | // | 772 | // |
773 | Maildir::Flags Maildir::readEntryFlags(const QString& key) const | 773 | Maildir::Flags Maildir::readEntryFlags(const QString& key) |
774 | { | 774 | { |
775 | Flags flags; | 775 | Flags flags; |
776 | const QRegExp rx = *(statusSeparatorRx()); | 776 | const QRegExp rx = *(statusSeparatorRx()); |
diff --git a/examples/maildirresource/libmaildir/maildir.h b/examples/maildirresource/libmaildir/maildir.h index f80ba5d..fefd5a7 100644 --- a/examples/maildirresource/libmaildir/maildir.h +++ b/examples/maildirresource/libmaildir/maildir.h | |||
@@ -178,7 +178,7 @@ public: | |||
178 | /** | 178 | /** |
179 | * Return the flags encoded in the maildir file name for an entry | 179 | * Return the flags encoded in the maildir file name for an entry |
180 | **/ | 180 | **/ |
181 | Flags readEntryFlags( const QString& key ) const; | 181 | static Flags readEntryFlags( const QString& key ); |
182 | 182 | ||
183 | /** | 183 | /** |
184 | * Return the contents of the headers section of the file the maildir with the given @p file, that | 184 | * Return the contents of the headers section of the file the maildir with the given @p file, that |
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 3531b92..5d540be 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -295,7 +295,25 @@ void MaildirResource::removeFromDisk(const QByteArray &instanceIdentifier) | |||
295 | 295 | ||
296 | KAsync::Job<void> MaildirResource::inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) | 296 | KAsync::Job<void> MaildirResource::inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) |
297 | { | 297 | { |
298 | auto synchronizationStore = QSharedPointer<Akonadi2::Storage>::create(Akonadi2::storageLocation(), mResourceInstanceIdentifier + ".synchronization", Akonadi2::Storage::ReadOnly); | ||
299 | auto synchronizationTransaction = synchronizationStore->createTransaction(Akonadi2::Storage::ReadOnly); | ||
298 | Trace() << "Inspecting " << inspectionType << domainType << entityId << property << expectedValue; | 300 | Trace() << "Inspecting " << inspectionType << domainType << entityId << property << expectedValue; |
301 | if (domainType == ENTITY_TYPE_MAIL) { | ||
302 | if (inspectionType == Akonadi2::Resources::Inspection::PropertyInspectionType) { | ||
303 | if (property == "unread") { | ||
304 | const auto remoteId = resolveLocalId(ENTITY_TYPE_MAIL, entityId, synchronizationTransaction); | ||
305 | const auto flags = KPIM::Maildir::readEntryFlags(remoteId.split('/').last()); | ||
306 | if (expectedValue.toBool() && !(flags & KPIM::Maildir::Seen)) { | ||
307 | return KAsync::error<void>(1, "Expected seen but couldn't find it."); | ||
308 | } | ||
309 | if (!expectedValue.toBool() && (flags & KPIM::Maildir::Seen)) { | ||
310 | return KAsync::error<void>(1, "Expected seen but couldn't find it."); | ||
311 | } | ||
312 | return KAsync::null<void>(); | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | return KAsync::null<void>(); | ||
299 | } | 317 | } |
300 | 318 | ||
301 | MaildirResourceFactory::MaildirResourceFactory(QObject *parent) | 319 | MaildirResourceFactory::MaildirResourceFactory(QObject *parent) |