#include "clientapi.h" #include "resourceaccess.h" #include "commands.h" #include "log.h" namespace async { void run(const std::function &runner) { //TODO use a job that runs in a thread? QtConcurrent::run(runner); }; } // namespace async namespace Akonadi2 { namespace ApplicationDomain { template<> QByteArray getTypeName() { return "event"; } template<> QByteArray getTypeName() { return "todo"; } template<> QByteArray getTypeName() { return "akonadiresource"; } } // namespace Domain void Store::shutdown(const QByteArray &identifier) { Trace() << "shutdown"; ResourceAccess::connectToServer(identifier).then>([identifier](const QSharedPointer &socket, Async::Future &future) { //We can't currently reuse the socket socket->close(); auto resourceAccess = QSharedPointer::create(identifier); resourceAccess->open(); resourceAccess->sendCommand(Akonadi2::Commands::ShutdownCommand).then([&future, resourceAccess]() { future.setFinished(); }).exec(); }, [](int, const QString &) { //Resource isn't started, nothing to shutdown }).exec().waitForFinished(); } } // namespace Akonadi2