1
#include <unity/storage/qt/client/internal/remote_client/LookupHandler.h>
3
#include <unity/storage/qt/client/Exceptions.h>
4
#include <unity/storage/qt/client/File.h>
5
#include <unity/storage/qt/client/Folder.h>
6
#include <unity/storage/qt/client/internal/remote_client/dbusmarshal.h>
7
#include <unity/storage/qt/client/internal/remote_client/FileImpl.h>
8
#include <unity/storage/qt/client/internal/remote_client/FolderImpl.h>
24
namespace remote_client
27
LookupHandler::LookupHandler(QDBusPendingReply<QList<storage::internal::ItemMetadata>> const& reply,
28
weak_ptr<Root> const& root)
29
: watcher_(reply, this)
33
connect(&watcher_, &QDBusPendingCallWatcher::finished, this, &LookupHandler::finished);
37
QFuture<QVector<shared_ptr<Item>>> LookupHandler::future()
42
void LookupHandler::finished(QDBusPendingCallWatcher* call)
46
QDBusPendingReply<QList<storage::internal::ItemMetadata>> reply = *call;
49
qDebug() << reply.error().message(); // TODO, remove this
50
qf_.reportException(StorageException()); // TODO
55
QVector<Item::SPtr> items;
56
auto metadata = reply.value();
57
for (auto const& md : metadata)
64
item = FileImpl::make_file(md, root_);
67
case ItemType::folder:
69
item = FolderImpl::make_folder(md, root_);
74
// TODO: log impossible item type here
80
abort(); // LCOV_EXCL_LINE // Impossible
87
qf_.reportException(StorageException()); // TODO
91
qf_.reportResult(items);
96
} // namespace remote_client
97
} // namespace internal
100
} // namespace storage
103
#include "LookupHandler.moc"