~unity-api-team/storage-framework/vivid

« back to all changes in this revision

Viewing changes to src/qt/client/internal/remote_client/ItemImpl.cpp

  • Committer: Bileto Bot
  • Date: 2016-11-04 12:21:58 UTC
  • mfrom: (12.1.1 merge-devel)
  • Revision ID: ci-train-bot@canonical.com-20161104122158-hu8h9qyg3vm129t5
* Added v2 of the client-side API.
* Updated server-side API to tell the provider which metadata to return.
* Update provider API to manager ProviderBase class as a shared_ptr.
* Update client to discover ownCloud/Nextcloud and OneDrive accounts.
* Add match_etag argument to Download() D-Bus method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <unity/storage/qt/client/internal/remote_client/ItemImpl.h>
20
20
 
21
21
#include "ProviderInterface.h"
22
 
#include <unity/storage/provider/metadata_keys.h>
 
22
#include <unity/storage/common.h>
23
23
#include <unity/storage/qt/client/Account.h>
24
24
#include <unity/storage/qt/client/internal/remote_client/AccountImpl.h>
25
25
#include <unity/storage/qt/client/internal/remote_client/FileImpl.h>
72
72
QDateTime ItemImpl::last_modified_time() const
73
73
{
74
74
    throw_if_destroyed("Item::last_modified_time()");
75
 
    return QDateTime::fromString(md_.metadata.value(provider::LAST_MODIFIED_TIME).toString(), Qt::ISODate);
 
75
    return QDateTime::fromString(md_.metadata.value(metadata::LAST_MODIFIED_TIME).toString(), Qt::ISODate);
76
76
}
77
77
 
78
78
QFuture<shared_ptr<Item>> ItemImpl::copy(shared_ptr<Folder> const& new_parent, QString const& new_name)
95
95
    }
96
96
 
97
97
    auto prov = provider();
98
 
    auto reply = prov->Copy(md_.item_id, new_parent->native_identity(), new_name);
 
98
    auto reply = prov->Copy(md_.item_id, new_parent->native_identity(), new_name, QList<QString>());
99
99
 
100
100
    auto process_reply = [this](decltype(reply) const& reply, QFutureInterface<std::shared_ptr<Item>>& qf)
101
101
    {
160
160
    {
161
161
        return make_exceptional_future<shared_ptr<Item>>(RuntimeDestroyedException("Item::move()"));
162
162
    }
163
 
    auto reply = prov->Move(md_.item_id, new_parent->native_identity(), new_name);
 
163
    auto reply = prov->Move(md_.item_id, new_parent->native_identity(), new_name, QList<QString>());
164
164
 
165
165
    auto process_reply = [this](decltype(reply) const& reply, QFutureInterface<std::shared_ptr<Item>>& qf)
166
166
    {
217
217
{
218
218
    throw_if_destroyed("Item::parent_ids()");
219
219
    // TODO, need different metadata representation, affects xml
220
 
    return md_.parent_ids;
 
220
    // We changed ItemMetadata to contain a QList for the v2 API,
 
221
    // so we copy here.
 
222
    QVector<QString> ids;
 
223
    for (auto const& id : md_.parent_ids)
 
224
    {
 
225
        ids.append(id);
 
226
    }
 
227
    return ids;
221
228
}
222
229
 
223
230
QFuture<void> ItemImpl::delete_item()
247
254
QDateTime ItemImpl::creation_time() const
248
255
{
249
256
    throw_if_destroyed("Item::creation_time()");
250
 
    return QDateTime::fromString(md_.metadata.value(provider::CREATION_TIME).toString(), Qt::ISODate);
 
257
    return QDateTime::fromString(md_.metadata.value(metadata::CREATION_TIME).toString(), Qt::ISODate);
251
258
}
252
259
 
253
260
MetadataMap ItemImpl::native_metadata() const