diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-18 10:38:36 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-18 10:38:36 +0100 |
commit | 23e807c133a23f924d56bc860aa34f62f09109ff (patch) | |
tree | 92d8584902d1cc902c8a1b8d7464427035257ccf /common | |
parent | 765f27cf52497bc401579db38f0011d90fb75cbb (diff) | |
download | sink-23e807c133a23f924d56bc860aa34f62f09109ff.tar.gz sink-23e807c133a23f924d56bc860aa34f62f09109ff.zip |
Detect modifications and removals on folders in the maildirresource
Diffstat (limited to 'common')
-rw-r--r-- | common/storage.h | 5 | ||||
-rw-r--r-- | common/storage_common.cpp | 11 |
2 files changed, 16 insertions, 0 deletions
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: | |||
90 | const std::function<void(const QByteArray &key, const QByteArray &value)> &resultHandler, | 90 | const std::function<void(const QByteArray &key, const QByteArray &value)> &resultHandler, |
91 | const std::function<void(const Storage::Error &error)> &errorHandler = std::function<void(const Storage::Error &error)>()) const; | 91 | const std::function<void(const Storage::Error &error)> &errorHandler = std::function<void(const Storage::Error &error)>()) const; |
92 | 92 | ||
93 | /** | ||
94 | * Returns true if the database contains the substring key. | ||
95 | */ | ||
96 | bool contains(const QByteArray &uid); | ||
97 | |||
93 | NamedDatabase(NamedDatabase&& other) : d(other.d) | 98 | NamedDatabase(NamedDatabase&& other) : d(other.d) |
94 | { | 99 | { |
95 | d = other.d; | 100 | 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) | |||
158 | return key.mid(0, 38); | 158 | return key.mid(0, 38); |
159 | } | 159 | } |
160 | 160 | ||
161 | bool Storage::NamedDatabase::contains(const QByteArray &uid) | ||
162 | { | ||
163 | bool found = false; | ||
164 | scan(uid, [&found](const QByteArray &, const QByteArray &) -> bool { | ||
165 | found = true; | ||
166 | return false; | ||
167 | }, [this](const Akonadi2::Storage::Error &error) { | ||
168 | }, true); | ||
169 | return found; | ||
170 | } | ||
171 | |||
161 | } // namespace Akonadi2 | 172 | } // namespace Akonadi2 |