diff options
Diffstat (limited to 'common/clientapi.cpp')
-rw-r--r-- | common/clientapi.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index c6f5582..5cb3b69 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -2,6 +2,7 @@ | |||
2 | #include "clientapi.h" | 2 | #include "clientapi.h" |
3 | #include "resourceaccess.h" | 3 | #include "resourceaccess.h" |
4 | #include "commands.h" | 4 | #include "commands.h" |
5 | #include "log.h" | ||
5 | 6 | ||
6 | namespace async | 7 | namespace async |
7 | { | 8 | { |
@@ -39,10 +40,19 @@ QByteArray getTypeName<AkonadiResource>() | |||
39 | 40 | ||
40 | void Store::shutdown(const QByteArray &identifier) | 41 | void Store::shutdown(const QByteArray &identifier) |
41 | { | 42 | { |
42 | Akonadi2::ResourceAccess resourceAccess(identifier); | 43 | Trace() << "shutdown"; |
43 | //FIXME this starts the resource, just to shut it down again if it's not running in the first place. | 44 | ResourceAccess::connectToServer(identifier).then<void, QSharedPointer<QLocalSocket>>([identifier](const QSharedPointer<QLocalSocket> &socket, Async::Future<void> &future) { |
44 | resourceAccess.open(); | 45 | //We can't currently reuse the socket |
45 | resourceAccess.sendCommand(Akonadi2::Commands::ShutdownCommand).exec().waitForFinished(); | 46 | socket->close(); |
47 | auto resourceAccess = QSharedPointer<Akonadi2::ResourceAccess>::create(identifier); | ||
48 | resourceAccess->open(); | ||
49 | resourceAccess->sendCommand(Akonadi2::Commands::ShutdownCommand).then<void>([&future, resourceAccess]() { | ||
50 | future.setFinished(); | ||
51 | }).exec(); | ||
52 | }, | ||
53 | [](int, const QString &) { | ||
54 | //Resource isn't started, nothing to shutdown | ||
55 | }).exec().waitForFinished(); | ||
46 | } | 56 | } |
47 | 57 | ||
48 | } // namespace Akonadi2 | 58 | } // namespace Akonadi2 |