diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-10 10:29:12 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-10 10:29:12 +0100 |
commit | 49b1c5c3b342a84ec71e9b7dfd06a80b6d6e6c96 (patch) | |
tree | cbee8cee66e2e1803afea2ecbeea8564dace2838 /common/clientapi.cpp | |
parent | 6a86e175ae2c81094e09b9833ec222005f3b12fc (diff) | |
download | sink-49b1c5c3b342a84ec71e9b7dfd06a80b6d6e6c96.tar.gz sink-49b1c5c3b342a84ec71e9b7dfd06a80b6d6e6c96.zip |
Remove all databases from disk
Diffstat (limited to 'common/clientapi.cpp')
-rw-r--r-- | common/clientapi.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 255ea21..061d920 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -24,17 +24,18 @@ | |||
24 | #include <QTimer> | 24 | #include <QTimer> |
25 | #include <QEventLoop> | 25 | #include <QEventLoop> |
26 | #include <QAbstractItemModel> | 26 | #include <QAbstractItemModel> |
27 | #include <QDir> | ||
27 | #include <functional> | 28 | #include <functional> |
28 | #include <memory> | 29 | #include <memory> |
29 | 30 | ||
30 | #include "resourceaccess.h" | 31 | #include "resourceaccess.h" |
31 | #include "commands.h" | 32 | #include "commands.h" |
32 | #include "resourcefacade.h" | 33 | #include "resourcefacade.h" |
33 | #include "log.h" | ||
34 | #include "definitions.h" | 34 | #include "definitions.h" |
35 | #include "resourceconfig.h" | 35 | #include "resourceconfig.h" |
36 | #include "facadefactory.h" | 36 | #include "facadefactory.h" |
37 | #include "modelresult.h" | 37 | #include "modelresult.h" |
38 | #include "storage.h" | ||
38 | #include "log.h" | 39 | #include "log.h" |
39 | 40 | ||
40 | namespace Akonadi2 | 41 | namespace Akonadi2 |
@@ -178,6 +179,16 @@ KAsync::Job<void> Store::start(const QByteArray &identifier) | |||
178 | }); | 179 | }); |
179 | } | 180 | } |
180 | 181 | ||
182 | void Store::removeFromDisk(const QByteArray &identifier) | ||
183 | { | ||
184 | //TODO By calling the resource executable with a --remove option instead | ||
185 | //we can ensure that no other resource process is running at the same time | ||
186 | QDir dir(Akonadi2::storageLocation()); | ||
187 | for (const auto &folder : dir.entryList(QStringList() << identifier + "*")) { | ||
188 | Akonadi2::Storage(Akonadi2::storageLocation(), folder, Akonadi2::Storage::ReadWrite).removeFromDisk(); | ||
189 | } | ||
190 | } | ||
191 | |||
181 | KAsync::Job<void> Store::synchronize(const Akonadi2::Query &query) | 192 | KAsync::Job<void> Store::synchronize(const Akonadi2::Query &query) |
182 | { | 193 | { |
183 | Trace() << "synchronize"; | 194 | Trace() << "synchronize"; |