From 23e807c133a23f924d56bc860aa34f62f09109ff Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 18 Dec 2015 10:38:36 +0100 Subject: Detect modifications and removals on folders in the maildirresource --- common/storage.h | 5 +++++ common/storage_common.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+) (limited to 'common') diff --git a/common/storage.h b/common/storage.h index 22bf06c..daeace8 100644 --- a/common/storage.h +++ b/common/storage.h @@ -90,6 +90,11 @@ public: const std::function &resultHandler, const std::function &errorHandler = std::function()) const; + /** + * Returns true if the database contains the substring key. + */ + bool contains(const QByteArray &uid); + NamedDatabase(NamedDatabase&& other) : d(other.d) { d = other.d; diff --git a/common/storage_common.cpp b/common/storage_common.cpp index 1dbc178..10870d4 100644 --- a/common/storage_common.cpp +++ b/common/storage_common.cpp @@ -158,4 +158,15 @@ QByteArray Storage::uidFromKey(const QByteArray &key) return key.mid(0, 38); } +bool Storage::NamedDatabase::contains(const QByteArray &uid) +{ + bool found = false; + scan(uid, [&found](const QByteArray &, const QByteArray &) -> bool { + found = true; + return false; + }, [this](const Akonadi2::Storage::Error &error) { + }, true); + return found; +} + } // namespace Akonadi2 -- cgit v1.2.3