diff options
Diffstat (limited to 'common/clientapi.cpp')
-rw-r--r-- | common/clientapi.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index b732205..3dc9370 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -149,23 +149,35 @@ KAsync::Job<void> Store::remove(const DomainType &domainObject) | |||
149 | 149 | ||
150 | KAsync::Job<void> Store::shutdown(const QByteArray &identifier) | 150 | KAsync::Job<void> Store::shutdown(const QByteArray &identifier) |
151 | { | 151 | { |
152 | Trace() << "shutdown"; | 152 | Trace() << "shutdown " << identifier; |
153 | return ResourceAccess::connectToServer(identifier).then<void, QSharedPointer<QLocalSocket>>([identifier](QSharedPointer<QLocalSocket> socket, KAsync::Future<void> &future) { | 153 | return ResourceAccess::connectToServer(identifier).then<void, QSharedPointer<QLocalSocket>>([identifier](QSharedPointer<QLocalSocket> socket, KAsync::Future<void> &future) { |
154 | //We can't currently reuse the socket | 154 | //We can't currently reuse the socket |
155 | socket->close(); | 155 | socket->close(); |
156 | auto resourceAccess = QSharedPointer<Akonadi2::ResourceAccess>::create(identifier); | 156 | auto resourceAccess = QSharedPointer<Akonadi2::ResourceAccess>::create(identifier); |
157 | resourceAccess->open(); | 157 | resourceAccess->open(); |
158 | resourceAccess->sendCommand(Akonadi2::Commands::ShutdownCommand).then<void>([&future, resourceAccess]() { | 158 | resourceAccess->sendCommand(Akonadi2::Commands::ShutdownCommand).then<void>([&future, resourceAccess]() { |
159 | Trace() << "Shutdown complete"; | ||
159 | future.setFinished(); | 160 | future.setFinished(); |
160 | }).exec(); | 161 | }).exec(); |
161 | }, | 162 | }, |
162 | [](int, const QString &) { | 163 | [](int, const QString &) { |
164 | Trace() << "Resource is already closed."; | ||
163 | //Resource isn't started, nothing to shutdown | 165 | //Resource isn't started, nothing to shutdown |
164 | }) | 166 | }) |
165 | //FIXME JOBAPI this is only required because we don't care about the return value of connectToServer | 167 | //FIXME JOBAPI this is only required because we don't care about the return value of connectToServer |
166 | .template then<void>([](){}); | 168 | .template then<void>([](){}); |
167 | } | 169 | } |
168 | 170 | ||
171 | KAsync::Job<void> Store::start(const QByteArray &identifier) | ||
172 | { | ||
173 | Trace() << "start " << identifier; | ||
174 | auto resourceAccess = QSharedPointer<Akonadi2::ResourceAccess>::create(identifier); | ||
175 | resourceAccess->open(); | ||
176 | return resourceAccess->sendCommand(Akonadi2::Commands::PingCommand).then<void>([resourceAccess]() { | ||
177 | Trace() << "Start complete"; | ||
178 | }); | ||
179 | } | ||
180 | |||
169 | KAsync::Job<void> Store::synchronize(const Akonadi2::Query &query) | 181 | KAsync::Job<void> Store::synchronize(const Akonadi2::Query &query) |
170 | { | 182 | { |
171 | Trace() << "synchronize"; | 183 | Trace() << "synchronize"; |