summaryrefslogtreecommitdiffstats
path: root/common/store.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-04 10:36:58 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-04 10:36:58 +0100
commit59aa460cf704d5f1a1fb1fe6b8ede4457da083ff (patch)
treed1cf394099e4897d2b8abf6817191c488c754667 /common/store.cpp
parent41006b5cab7b0260f8abc42aa2d2e959a013764e (diff)
downloadsink-59aa460cf704d5f1a1fb1fe6b8ede4457da083ff.tar.gz
sink-59aa460cf704d5f1a1fb1fe6b8ede4457da083ff.zip
Copy command and proper move
Diffstat (limited to 'common/store.cpp')
-rw-r--r--common/store.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/store.cpp b/common/store.cpp
index fad8c5e..ef8a593 100644
--- a/common/store.cpp
+++ b/common/store.cpp
@@ -225,6 +225,15 @@ KAsync::Job<void> Store::move(const DomainType &domainObject, const QByteArray &
225} 225}
226 226
227template <class DomainType> 227template <class DomainType>
228KAsync::Job<void> Store::copy(const DomainType &domainObject, const QByteArray &newResource)
229{
230 SinkTrace() << "Copy: " << domainObject << newResource;
231 // Potentially copy to separate thread as well
232 auto facade = getFacade<DomainType>(domainObject.resourceInstanceIdentifier());
233 return facade->copy(domainObject, newResource).addToContext(std::shared_ptr<void>(facade)).onError([](const KAsync::Error &error) { SinkWarning() << "Failed to copy"; });
234}
235
236template <class DomainType>
228KAsync::Job<void> Store::remove(const DomainType &domainObject) 237KAsync::Job<void> Store::remove(const DomainType &domainObject)
229{ 238{
230 SinkTrace() << "Remove: " << domainObject; 239 SinkTrace() << "Remove: " << domainObject;
@@ -396,6 +405,7 @@ QList<DomainType> Store::read(const Sink::Query &q)
396 template KAsync::Job<void> Store::create<T>(const T &domainObject); \ 405 template KAsync::Job<void> Store::create<T>(const T &domainObject); \
397 template KAsync::Job<void> Store::modify<T>(const T &domainObject); \ 406 template KAsync::Job<void> Store::modify<T>(const T &domainObject); \
398 template KAsync::Job<void> Store::move<T>(const T &domainObject, const QByteArray &newResource); \ 407 template KAsync::Job<void> Store::move<T>(const T &domainObject, const QByteArray &newResource); \
408 template KAsync::Job<void> Store::copy<T>(const T &domainObject, const QByteArray &newResource); \
399 template QSharedPointer<QAbstractItemModel> Store::loadModel<T>(Query query); \ 409 template QSharedPointer<QAbstractItemModel> Store::loadModel<T>(Query query); \
400 template KAsync::Job<T> Store::fetchOne<T>(const Query &); \ 410 template KAsync::Job<T> Store::fetchOne<T>(const Query &); \
401 template KAsync::Job<QList<T::Ptr>> Store::fetchAll<T>(const Query &); \ 411 template KAsync::Job<QList<T::Ptr>> Store::fetchAll<T>(const Query &); \