summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-10 10:29:12 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-10 10:29:12 +0100
commit49b1c5c3b342a84ec71e9b7dfd06a80b6d6e6c96 (patch)
treecbee8cee66e2e1803afea2ecbeea8564dace2838 /common
parent6a86e175ae2c81094e09b9833ec222005f3b12fc (diff)
downloadsink-49b1c5c3b342a84ec71e9b7dfd06a80b6d6e6c96.tar.gz
sink-49b1c5c3b342a84ec71e9b7dfd06a80b6d6e6c96.zip
Remove all databases from disk
Diffstat (limited to 'common')
-rw-r--r--common/clientapi.cpp13
-rw-r--r--common/clientapi.h5
2 files changed, 17 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
40namespace Akonadi2 41namespace Akonadi2
@@ -178,6 +179,16 @@ KAsync::Job<void> Store::start(const QByteArray &identifier)
178 }); 179 });
179} 180}
180 181
182void 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
181KAsync::Job<void> Store::synchronize(const Akonadi2::Query &query) 192KAsync::Job<void> Store::synchronize(const Akonadi2::Query &query)
182{ 193{
183 Trace() << "synchronize"; 194 Trace() << "synchronize";
diff --git a/common/clientapi.h b/common/clientapi.h
index 074aabc..3d9095d 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -93,6 +93,11 @@ public:
93 * Synchronize data to local cache. 93 * Synchronize data to local cache.
94 */ 94 */
95 static KAsync::Job<void> synchronize(const Akonadi2::Query &query); 95 static KAsync::Job<void> synchronize(const Akonadi2::Query &query);
96
97 /**
98 * Removes a resource from disk.
99 */
100 static void removeFromDisk(const QByteArray &resourceIdentifier);
96}; 101};
97 102
98 103