Merge lp:~michihenning/storage-framework/add-client-doc into lp:storage-framework/devel

Proposed by Michi Henning
Status: Merged
Approved by: James Henstridge
Approved revision: 137
Merged at revision: 129
Proposed branch: lp:~michihenning/storage-framework/add-client-doc
Merge into: lp:storage-framework/devel
Prerequisite: lp:~michihenning/storage-framework/remove-default-constructors
Diff against target: 1400 lines (+886/-27)
15 files modified
doc/CMakeLists.txt (+1/-1)
doc/tutorial.dox (+29/-3)
include/unity/storage/common.h (+6/-0)
include/unity/storage/provider/ProviderBase.h (+3/-0)
include/unity/storage/qt/Account.h (+134/-4)
include/unity/storage/qt/AccountsJob.h (+66/-1)
include/unity/storage/qt/Downloader.h (+40/-1)
include/unity/storage/qt/Item.h (+313/-12)
include/unity/storage/qt/ItemJob.h (+64/-1)
include/unity/storage/qt/ItemListJob.h (+61/-1)
include/unity/storage/qt/Runtime.h (+109/-0)
include/unity/storage/qt/VoidJob.h (+55/-1)
plugins/Ubuntu/StorageFramework/plugin.cpp (+4/-0)
tests/headers/CMakeLists.txt (+1/-1)
tests/local-provider/CMakeLists.txt (+0/-1)
To merge this branch: bzr merge lp:~michihenning/storage-framework/add-client-doc
Reviewer Review Type Date Requested Status
James Henstridge Approve
unity-api-1-bot continuous-integration Approve
Review via email: mp+322908@code.launchpad.net

Commit message

Partial reference doc for qt V2 API.

Description of the change

Partial reference doc for qt V2 API.

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:137
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/286/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1932
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1939
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1719
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1719/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1719
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1719/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1719
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1719/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1719
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1719/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1719
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1719/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1719
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1719/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/286/rebuild

review: Approve (continuous-integration)
Revision history for this message
James Henstridge (jamesh) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/CMakeLists.txt'
2--- doc/CMakeLists.txt 2017-03-30 06:31:03 +0000
3+++ doc/CMakeLists.txt 2017-04-21 01:35:48 +0000
4@@ -11,7 +11,7 @@
5 ${CMAKE_SOURCE_DIR}/include
6 EXCLUDE_PATTERNS
7 */internal/*
8- */qt/*
9+ */registry/*
10 ALL
11 )
12
13
14=== renamed file 'doc/provider_tut.dox' => 'doc/tutorial.dox'
15--- doc/provider_tut.dox 2017-04-05 04:06:39 +0000
16+++ doc/tutorial.dox 2017-04-21 01:35:48 +0000
17@@ -133,6 +133,8 @@
18 If a provider supplies non-standard metadata items, the item keys have a provider-specific prefix, such as
19 <tt>mcloud:</tt> or <tt>gdrive:</tt>.
20
21+Do not use hard-wired string literals as keys; instead use the symbolic constants defined in \ref common.h.
22+
23 \subsection uploads-downloads Uploads and Downloads
24
25 Uploads and downloads take place over a UNIX domain socket. When a client requests an upload, the runtime creates
26@@ -576,13 +578,37 @@
27 aggressively you try to resume though; on a battery-powered device, it is expensive to turn on the radio, so you
28 should use a back-off algorithm and give up if the upload cannot be resumed within a reasonable period of time.)
29
30-\section local-provider The Local Provider
31+\section client Implementing a Client
32+
33+This section provides an overview of the client API and explains the semantics you can expect when interacting
34+with a provider.
35+
36+\subsection client-overview Overview
37+
38+\page local-provider The Local Provider
39
40 The storage framework includes a local provider that stores files in the local file system.
41-In a classic environment, the root of the local files is <code>$XDG_DATA_DIR/storage-framework/local</code>;
42-in a Snap environment, the root is <code>$SNAP_USER_COMMON/storage-framework/local</code>.
43+The default root for local files is
44+- <code>$XDG_DATA_DIR/storage-framework/local</code> (classic environment)
45+- <code>$SNAP_USER_COMMON/storage-framework/local</code> (snap environment)
46+
47 You can set <code>$SF_LOCAL_PROVIDER_ROOT</code> to change the root directory. (This is intended mainly for testing.)
48
49 The local provider uses <code>com.canonical.StorageFramework.Provider.Local</code> as the DBus name. The object path
50 is <code>/provider/0</code>.
51+
52+\page environment-variables Environment Variables
53+The storage framework uses the following environment variables.
54+- <code>SF_REGISTRY_IDLE_TIMEOUT</code><br>
55+ The idle timeout for the storage framework registry, in seconds. The default value is 30 seconds.<br>
56+ Setting this variable to 0 disables the idle timeout.
57+- <code>SF_PROVIDER_IDLE_TIMEOUT</code><br>
58+ The idle timeout for providers, in seconds. The default value is 30 seconds.<br>
59+ Setting this variable to 0 disables the idle timeout.
60+- <code>SF_LOCAL_PROVIDER_ROOT</code><br>
61+ The root directory for files accessed via the \link local-provider local provider\endlink.
62+ (This is intended for testing.)<br>
63+ If not set, the default value is
64+ - <code>$XDG_DATA_DIR/storage-framework/local</code> (classic environment)
65+ - <code>$SNAP_USER_COMMON/storage-framework/local</code> (snap environment)
66 */
67
68=== modified file 'include/unity/storage/common.h'
69--- include/unity/storage/common.h 2017-03-29 01:01:24 +0000
70+++ include/unity/storage/common.h 2017-04-21 01:35:48 +0000
71@@ -18,8 +18,14 @@
72
73 #pragma once
74
75+/**
76+\brief Top-level namespace for all things Unity-related.
77+*/
78 namespace unity
79 {
80+/**
81+\brief Top-level namespace for the storage framework API.
82+*/
83 namespace storage
84 {
85
86
87=== modified file 'include/unity/storage/provider/ProviderBase.h'
88--- include/unity/storage/provider/ProviderBase.h 2017-04-05 00:56:00 +0000
89+++ include/unity/storage/provider/ProviderBase.h 2017-04-21 01:35:48 +0000
90@@ -36,6 +36,9 @@
91 {
92 namespace storage
93 {
94+/**
95+\brief This namespace contains the provider API.
96+*/
97 namespace provider
98 {
99
100
101=== modified file 'include/unity/storage/qt/Account.h'
102--- include/unity/storage/qt/Account.h 2016-11-28 11:04:17 +0000
103+++ include/unity/storage/qt/Account.h 2017-04-21 01:35:48 +0000
104@@ -40,54 +40,172 @@
105 class ItemJob;
106 class ItemListJob;
107
108+/**
109+Class th provides access to account details.
110+
111+Note that this class is an immutable value type: if you retrieve the details of an account, and
112+those details change in Online Accounts later, the change is not reflected in the Account
113+instance you retrieved earlier. To get the updated details, you must retrieve the latest
114+list of accounts again by calling Runtime::accounts() and use the accounts returned
115+by the corresponding AccountsJob.
116+*/
117+
118 class Q_DECL_EXPORT Account final
119 {
120 Q_GADGET
121+ /**
122+ \see \link isValid() const isValid()\endlink
123+ */
124 Q_PROPERTY(bool isValid READ isValid FINAL)
125+
126+ /**
127+ \see \link busName() const busName()\endlink
128+ */
129 Q_PROPERTY(QString busName READ busName FINAL)
130+
131+ /**
132+ \see \link objectPath() const objectPath()\endlink
133+ */
134 Q_PROPERTY(QString objectPath READ objectPath FINAL)
135+
136+ /**
137+ \see \link displayName() const displayName()\endlink
138+ */
139 Q_PROPERTY(QString displayName READ displayName FINAL)
140+
141+ /**
142+ \see \link providerName() const providerName()\endlink
143+ */
144 Q_PROPERTY(QString providerName READ providerName FINAL)
145+
146+ /**
147+ \see \link iconName() const iconName()\endlink
148+ */
149 Q_PROPERTY(QString iconName READ iconName FINAL)
150
151 public:
152+ /**
153+ \brief Constructs an account.
154+
155+ A default-constructed Account returns <code>false</code> from isValid(), and the remaining accessors return
156+ the empty string.
157+ */
158 Account();
159+
160+ /**
161+ \brief Destroys an account.
162+ */
163+ ~Account();
164+
165+ /** @name Copy and assignment
166+ Copy and assignment operators (move and non-move versions) have the usual value semantics.
167+ */
168+ //{@
169 Account(Account const&);
170 Account(Account&&);
171- ~Account();
172 Account& operator=(Account const&);
173 Account& operator=(Account&&);
174+ //@}
175
176+ /**
177+ \brief Checks whether this account was successfully constructed.
178+ \return Returns <code>true</code> if the account contains valid details; <code>false</code> otherwise.
179+ */
180 bool isValid() const;
181+
182+ /**
183+ \brief Returns the DBus name of the corresponding provider.
184+ \return The DBus name or the empty string if isValid() returns <code>false</code>.
185+ */
186 QString busName() const;
187+
188+ /**
189+ \brief Returns the DBus object path of the corresponding provider.
190+ \return The DBus object path or the empty string if isValid() returns <code>false</code>.
191+ */
192 QString objectPath() const;
193+
194+ /**
195+ \brief Returns the display name of the account.
196+ \return The display name (such as "user@domain.com") or the empty string if isValid() returns <code>false</code>.
197+ */
198 QString displayName() const;
199+
200+ /**
201+ \brief Returns the name of the provider for the account.
202+ \return The provider name (such as "Nextcloud") or the empty string if isValid() returns <code>false</code>.
203+ */
204 QString providerName() const;
205+
206+ /**
207+ \brief Returns the name of an icon file.
208+ \return The name of a file containing an icon image or the empty string if isValid() returns <code>false</code>.
209+ */
210 QString iconName() const;
211
212+ /**
213+ \brief Retrieves the list of available roots.
214+ \param keys A list of metadata keys for metadata items that should be returned by the provider.
215+ If the list is empty, the provider returns a default set of metadata items.
216+ \return An ItemListJob that, once complete, provides access to the available roots.
217+ \note You <i>must</i> deallocate the returned job by calling <code>delete</code>.
218+ \see Item, \link metadata Metadata\endlink
219+ */
220 Q_INVOKABLE unity::storage::qt::ItemListJob* roots(QStringList const& keys = QStringList()) const;
221+
222+ /**
223+ \brief Retrieves an item by identity.
224+ \return An ItemJob that, once complete, provides access to the item's details.
225+ \note You <i>must</i> deallocate the returned job by calling <code>delete</code>.
226+ \see Item
227+ */
228 Q_INVOKABLE unity::storage::qt::ItemJob* get(QString const& itemId, QStringList const& keys = QStringList()) const;
229
230- bool operator==(Account const&) const;
231+ /** @name Comparison operators and hashing
232+ */
233+ //{@
234+ /**
235+ \brief Compares Account instances for equality.
236+
237+ Account instances are equal if both are invalid or both are valid and all their details
238+ (bus name, object path, display name, provider name, and icon name) are equal.
239+ \param other The account to compare this account with.
240+ \return If all details of the accounts match, <code>true</code> is returned; <code>false</code> otherwise.
241+ */
242+ bool operator==(Account const& other) const;
243 bool operator!=(Account const&) const;
244 bool operator<(Account const&) const;
245 bool operator<=(Account const&) const;
246 bool operator>(Account const&) const;
247 bool operator>=(Account const&) const;
248
249+ /**
250+ \brief Returns a hash value.
251+ \note The hash value is <i>not</i> necessarily the same as the one returned by
252+ \link unity::storage::qt::qHash(Account const& acc) qHash()\endlink, but <i>is</i> the same as the one returned by
253+ \link std::hash<unity::storage::qt::Account> std::hash<Account>()\endlink.
254+ \return A hash value for use with unordered containers.
255+ */
256 size_t hash() const;
257+ //@}
258
259 private:
260+ ///@cond
261 Account(std::shared_ptr<internal::AccountImpl> const& p);
262
263 std::shared_ptr<internal::AccountImpl> p_;
264
265 friend class internal::AccountImpl;
266 friend class internal::ItemImpl;
267+ ///@endcond
268 };
269
270-// Note: qHash(Account) does *not* return the same hash value is std::hash<Account> because
271-// std:hash() returns size_t (typically 64 bits), but qHash() returns uint (typically 32 bits).
272+/**
273+\brief Returns a hash value.
274+\note The hash value is <i>not</i> necessarily the same as the one returned by
275+\link Account::hash()\endlink.
276+\return A hash value for use with unordered containers.
277+*/
278 uint Q_DECL_EXPORT qHash(Account const& acc);
279
280 } // namespace qt
281@@ -100,8 +218,20 @@
282 namespace std
283 {
284
285+/**
286+\brief Function template specialization in namespace <code>std</code> to allow use of
287+\link unity::storage::qt::Account Account\endlink instances with unordered containers.
288+*/
289 template<> struct Q_DECL_EXPORT hash<unity::storage::qt::Account>
290 {
291+ /**
292+ \brief Returns a hash value.
293+ \note The hash value is <i>not</i> necessarily the same as the one returned by
294+ \link unity::storage::qt::qHash(const Account& acc) qHash()\endlink (but <i>is</i> the same as the value returned
295+ by \link unity::storage::qt::Account::hash() Account::hash()\endlink).
296+ \return A hash value for use with unordered containers.
297+ \see \link unity::storage::qt::Account::hash Account::hash()\endlink
298+ */
299 std::size_t operator()(unity::storage::qt::Account const& a) const
300 {
301 return a.hash();
302
303=== modified file 'include/unity/storage/qt/AccountsJob.h'
304--- include/unity/storage/qt/AccountsJob.h 2016-11-15 02:05:14 +0000
305+++ include/unity/storage/qt/AccountsJob.h 2017-04-21 01:35:48 +0000
306@@ -40,29 +40,93 @@
307 class Account;
308 class StorageError;
309
310+/**
311+\brief Asynchronous job to retrieve a list of accounts.
312+*/
313+
314 class Q_DECL_EXPORT AccountsJob final : public QObject
315 {
316 Q_OBJECT
317+
318+ /**
319+ \see \link isValid() const isValid()\endlink
320+ */
321 Q_PROPERTY(bool isValid READ isValid NOTIFY statusChanged FINAL)
322+
323+ /**
324+ \see \link status() const status()\endlink
325+ */
326 Q_PROPERTY(unity::storage::qt::AccountsJob::Status status READ status NOTIFY statusChanged FINAL)
327+
328+ /**
329+ \see \link error() const error()\endlink
330+ */
331 Q_PROPERTY(unity::storage::qt::StorageError error READ error NOTIFY statusChanged FINAL)
332+
333+ /**
334+ \see \link accounts() const accounts()\endlink
335+ */
336 Q_PROPERTY(QVariantList accounts READ accountsAsVariantList NOTIFY statusChanged FINAL)
337
338 public:
339- enum Status { Loading, Finished, Error };
340+ /**
341+ \brief Indicates the status of the job.
342+ */
343+ enum Status {
344+ Loading, /*!< The job is still executing. */
345+ Finished, /*!< The job finished succesfully. */
346+ Error /*!< The job finished with an error. */
347+ };
348 Q_ENUMS(Status)
349
350+ /**
351+ \brief Destroys the job.
352+
353+ It is safe to destroy a job while it is still executing.
354+ */
355 virtual ~AccountsJob();
356
357+ /**
358+ \brief Returns whether this job was successfully created.
359+ \return If the job status is \link Error\endlink, the return value is <code>false</code>;
360+ <code>true</code> otherwise.
361+ */
362 bool isValid() const;
363+
364+ /**
365+ \brief Returns the current job status.
366+ \return The job status.
367+ */
368 Status status() const;
369+
370+ /**
371+ \brief Returns the last error that occured in this job.
372+ \return A StorageError that indicates the cause of the error if isValid() returns <code>false</code>.
373+ If isValid() returns <code>true</code>, the returned StorageError has type StorageError::NoError.
374+ */
375 StorageError error() const;
376+
377+ /**
378+ \brief Returns the list of accounts.
379+ \return The list of accounts or an empty list if the status is not \link Finished\endlink.
380+ */
381 QList<Account> accounts() const;
382
383 Q_SIGNALS:
384+ //@}
385+
386+ /** @name Signals
387+ */
388+ //{@
389+ /**
390+ \brief This signal is emitted whenever this job transitions to the \link Finished\endlink or \link Error\endlink state.
391+ \param status The status of the job.
392+ */
393 void statusChanged(unity::storage::qt::AccountsJob::Status status) const;
394+ //@}
395
396 private:
397+ ///@cond
398 AccountsJob(std::unique_ptr<internal::AccountsJobImpl> accounts_job_impl);
399
400 QVariantList accountsAsVariantList() const;
401@@ -70,6 +134,7 @@
402 std::unique_ptr<internal::AccountsJobImpl> const p_;
403
404 friend class internal::AccountsJobImpl;
405+ ///@endcond
406 };
407
408 } // namespace qt
409
410=== modified file 'include/unity/storage/qt/Downloader.h'
411--- include/unity/storage/qt/Downloader.h 2017-04-21 01:35:48 +0000
412+++ include/unity/storage/qt/Downloader.h 2017-04-21 01:35:48 +0000
413@@ -36,16 +36,45 @@
414
415 } // namespace internal
416
417+/**
418+\brief Class to download the contents of a file.
419+*/
420+
421 class Q_DECL_EXPORT Downloader final : public QIODevice
422 {
423 Q_OBJECT
424+
425+ /**
426+ \see \link isValid() const isValid()\endlink
427+ */
428 Q_PROPERTY(bool isValid READ isValid NOTIFY statusChanged FINAL)
429+
430+ /**
431+ \see \link status() const status()\endlink
432+ */
433 Q_PROPERTY(unity::storage::qt::Downloader::Status status READ status NOTIFY statusChanged FINAL)
434+
435+ /**
436+ \see \link error() const error()\endlink
437+ */
438 Q_PROPERTY(unity::storage::qt::StorageError error READ error NOTIFY statusChanged FINAL)
439+
440+ /**
441+ \see \link item() const item()\endlink
442+ */
443 Q_PROPERTY(unity::storage::qt::Item item READ item NOTIFY statusChanged FINAL)
444
445 public:
446- enum Status { Loading, Ready, Cancelled, Finished, Error };
447+ /**
448+ \brief Indicates the status of the job.
449+ */
450+ enum Status {
451+ Loading, /*!< The job is still executing. */
452+ Ready, /*!< The job is ready for reading data. */
453+ Cancelled, /*!< The job was cancelled. */
454+ Finished, /*!< The job finished succesfully. */
455+ Error /*!< The job finished with an error. */
456+ };
457 Q_ENUMS(Status)
458
459 virtual ~Downloader();
460@@ -67,9 +96,18 @@
461 Q_INVOKABLE bool waitForReadyRead(int msecs = 30000) override;
462
463 Q_SIGNALS:
464+ /** @name Signals
465+ */
466+ //{@
467+ /**
468+ \brief This signal is emitted whenever this job transitions to a new state.
469+ \param status The status of the job.
470+ */
471 void statusChanged(unity::storage::qt::Downloader::Status status) const;
472+ //@}
473
474 private:
475+ ///@cond
476 Downloader(std::unique_ptr<internal::DownloaderImpl> p);
477
478 qint64 readData(char* data, qint64 c);
479@@ -78,6 +116,7 @@
480 std::unique_ptr<internal::DownloaderImpl> p_;
481
482 friend class internal::DownloaderImpl;
483+ ///@endcond
484 };
485
486 } // namespace qt
487
488=== modified file 'include/unity/storage/qt/Item.h'
489--- include/unity/storage/qt/Item.h 2016-11-03 07:33:40 +0000
490+++ include/unity/storage/qt/Item.h 2017-04-21 01:35:48 +0000
491@@ -52,85 +52,369 @@
492 class Uploader;
493 class VoidJob;
494
495+/**
496+Class that provides access to a file or folder.
497+
498+Item provides access to the details of a file or folder, such as its identity, name, etc.
499+It also provides operations to, for example, create or destroy files or folders, and to
500+initiate uploads and downloads.
501+
502+Note that this class is an immutable value type: if you retrieve the details of an item, and
503+those details change due to other operations being performed on the item, any changes are <i>not</i> reflected
504+by the Item instance you retrieved earlier. Each operation that potentially modifies the state of an item
505+also returns the new update item once it completes, so you can assign the update item to the original item or,
506+alternatively, simply let the original item go out scope after initiating an operation.
507+*/
508+
509 class Q_DECL_EXPORT Item final
510 {
511 Q_GADGET
512+
513+ /**
514+ \see \link itemId() const itemId()\endlink
515+ */
516 Q_PROPERTY(QString itemId READ itemId FINAL)
517+
518+ /**
519+ \see \link name() const name()\endlink
520+ */
521 Q_PROPERTY(QString name READ name FINAL)
522+
523+ /**
524+ \see \link account() const account()\endlink
525+ */
526 Q_PROPERTY(unity::storage::qt::Account account READ account FINAL)
527+
528+ /**
529+ \see \link etag() const etag()\endlink
530+ */
531 Q_PROPERTY(QString etag READ etag FINAL)
532+
533+ /**
534+ \see \link type() const type()\endlink
535+ */
536 Q_PROPERTY(unity::storage::qt::Item::Type type READ type FINAL)
537+
538+ /**
539+ \see \link metadata() const metadata()\endlink
540+ */
541 Q_PROPERTY(QVariantMap metadata READ metadata FINAL)
542+
543+ /**
544+ \see \link lastModifiedTime() const lastModifiedTime()\endlink
545+ */
546 Q_PROPERTY(QDateTime lastModifiedTime READ lastModifiedTime FINAL)
547+
548+ /**
549+ \see \link parentIds() const parentIds()\endlink
550+ */
551 Q_PROPERTY(QStringList parentIds READ parentIds FINAL)
552
553 public:
554+ /**
555+ \brief Constructs an item.
556+
557+ A default-constructed Item returns <code>false</code> from isValid(), and the remaining accessors return
558+ default-constructed values.
559+ */
560 Item();
561+
562+ /**
563+ \brief Destroys an item.
564+ */
565+ ~Item();
566+
567+ /** @name Copy and assignment
568+ \brief Copy and assignment operators (move and non-move versions) have the usual value semantics.
569+ */
570+ //{@
571 Item(Item const&);
572 Item(Item&&);
573- ~Item();
574 Item& operator=(Item const&);
575 Item& operator=(Item&&);
576+ //@}
577
578+ /**
579+ \brief Indicates the type of the item.
580+ */
581 enum Type
582 {
583- File = unsigned(unity::storage::ItemType::file),
584- Folder = unsigned(unity::storage::ItemType::folder),
585- Root = unsigned(unity::storage::ItemType::root)
586+ File /** @cond */ = unsigned(unity::storage::ItemType::file) /** @endcond */, /*!< The item is a file. */
587+ Folder /** @cond */ = unsigned(unity::storage::ItemType::folder) /** @endcond */, /*!< The item is a folder. */
588+ Root /** @cond */ = unsigned(unity::storage::ItemType::root) /** @endcond */ /*!< The item is a root folder. */
589 };
590 Q_ENUMS(Type)
591
592+ /**
593+ \brief Indicates how the provider should respond in case of an ETag mismatch.
594+ */
595 enum ConflictPolicy
596 {
597- ErrorIfConflict = unsigned(unity::storage::ConflictPolicy::error_if_conflict),
598- IgnoreConflict = unsigned(unity::storage::ConflictPolicy::ignore_conflict)
599+ ErrorIfConflict /** @cond */
600+ = unsigned(unity::storage::ConflictPolicy::error_if_conflict) /** @endcond */, /*!< Fail the operation. */
601+ IgnoreConflict /** @cond */
602+ = unsigned(unity::storage::ConflictPolicy::ignore_conflict) /** @endcond */ /*!< Ignore the ETag mismatch. */
603 };
604 Q_ENUMS(ConflictPolicy)
605
606+ /** @name Accessors
607+ */
608+ //{@
609+
610+ /**
611+ \brief Checks whether this item was successfully constructed.
612+ \return Returns <code>true</code> if the item contains valid details; <code>false</code> otherwise.
613+ */
614 bool isValid() const;
615+
616+ /**
617+ \brief Returns the identity of the item.
618+
619+ Identities are unique only within their corresponding account, so items belong to different accounts may
620+ have the same identity. If an item is destroyed, it is possible for a different item that is created later
621+ to get the destroyed item's identity.
622+ \return The identity of the item.
623+ \see \link identity File and Folder Identity\endlink
624+ */
625 QString itemId() const;
626+
627+ /**
628+ \brief Returns the name of the item.
629+
630+ Providers may silently modify the name of files and folders that are created. (For example, a provider
631+ may map upper-case letters to lower-case.) After creating an item,
632+ always call name() to obtain the actual name of the item.
633+ \return The item's name.
634+ \see \link names File and Folder Names\endlink
635+ */
636 QString name() const;
637+
638+ /**
639+ \brief Returns the account for the item.
640+ \return The item's account.
641+ \see \link accounts Accounts\endlink
642+ */
643 Account account() const;
644+
645+ /**
646+ \brief Returns the ETag of the item.
647+ \return The item's ETag.
648+ \see \link etags ETags\endlink
649+ */
650 QString etag() const;
651+
652+ /**
653+ \brief Returns the type of the item.
654+ \return The item's type
655+ */
656 Type type() const;
657+
658+ /**
659+ \brief Returns the metadata for the item.
660+ \return The item's metadata
661+ \see \link metadata Metadata\endlink
662+ */
663 QVariantMap metadata() const;
664+
665+ /**
666+ \brief Returns the size in bytes of a file.
667+ \return The file size. If the item is not a file, the return value is 0.
668+ */
669 qint64 sizeInBytes() const;
670+
671+ /**
672+ \brief Returns the time at which the item was last modified.
673+ \return The item's modification time. For files, the modification time is always available.
674+ Some providers do not support modification time stamps for folders. If so, the returned
675+ time is invalid.
676+ */
677 QDateTime lastModifiedTime() const;
678+
679+ /**
680+ \brief Returns the identity of the item's parent folders.
681+ \return The item's parent identities.
682+ */
683 QStringList parentIds() const;
684+ //@}
685
686+ /** @name Operations
687+ All operations are asynchronous and return a job that, once complete, provides the return value
688+ or error information.
689+ \note You <i>must</i> deallocate the returned instance by calling <code>delete</code> (or, alternatively,
690+ call <a href="http://doc.qt.io/qt-5/qobject.html#setParent">setParent()</a> to re-parent the job).
691+ Failing to do so causes a memory leak!
692+ */
693+ //{@
694+ /**
695+ \brief Creates a job that retrieves the parent folders of this item.
696+ \return A job that, once complete, provides access to the parent folders.
697+ */
698 Q_INVOKABLE unity::storage::qt::ItemListJob* parents(QStringList const& keys = QStringList()) const;
699+
700+ /**
701+ \brief Copies this file or folder.
702+
703+ Copying is recursive. If you copy a folder, all it's contents are copied.
704+
705+ You can copy files and folders only within the same account.
706+ \param newParent The parent folder for this item. If you want to copy this item within
707+ the same parent folder, <code>newParent</code> must be the same as this item's current parent.
708+ \param newName The new name for this item within its <code>newParent</code> folder.
709+ \param keys A list of metadata keys for metadata items that should be returned by the provider.
710+ If the list is empty, the provider returns a default set of metadata items.
711+ \return A job that, once complete, provides access to the copied item.
712+ */
713 Q_INVOKABLE unity::storage::qt::ItemJob* copy(Item const& newParent,
714 QString const& newName,
715 QStringList const& keys = QStringList()) const;
716+
717+ /**
718+ \brief Moves and/or rename this file or folder.
719+
720+ You can move files and folders only within the same account.
721+ \param newParent The parent folder for this item. If you want to rename this item within
722+ the same parent folder, <code>newParent</code> must be the same as this item's current parent.
723+ \param newName The new name for this item within its <code>newParent</code> folder.
724+ \param keys A list of metadata keys for metadata items that should be returned by the provider.
725+ If the list is empty, the provider returns a default set of metadata items.
726+ \return A job that, once complete, provides access to the copied item.
727+ */
728 Q_INVOKABLE unity::storage::qt::ItemJob* move(Item const& newParent,
729 QString const& newName,
730 QStringList const& keys = QStringList()) const;
731+
732+ /**
733+ \brief Deletes this item.
734+
735+ Deletion is recursive. If this item is a folder, all it's contents are deleted as well.
736+
737+ You cannot delete a root folder.
738+ \return A job that, once complete, provides access to a StorageError (if any).
739+ */
740 Q_INVOKABLE unity::storage::qt::VoidJob* deleteItem() const;
741
742+ /**
743+ \brief Creates an uploader for this file.
744+
745+ Attempts to upload to a folder return an uploader that indicates an error.
746+ \param policy If set to <code>ErrorIfConflict</code>, the upload job indicates an error if this file's
747+ ETag no longer matches the ETag maintained by the provider. If set to <code>IgnoreConflict</code>, this
748+ file's contents are overwritten.
749+ \param sizeInBytes The size of the upload. You must write <i>exactly</i> that number of bytes to the upload
750+ socket before finalizing the upload. If the <code>sizeInBytes</code> does not match the size of the
751+ actually uploaded data, the upload will fail.
752+ \param keys A list of metadata keys for metadata items that should be returned by the provider.
753+ If the list is empty, the provider returns a default set of metadata items.
754+ \return An uploader that, once ready, can be used to upload the data for this file.
755+ \see \link uploads-downloads Uploads and Downloads\endlink
756+ */
757 Q_INVOKABLE unity::storage::qt::Uploader* createUploader(ConflictPolicy policy,
758 qint64 sizeInBytes,
759 QStringList const& keys = QStringList()) const;
760+
761+ /**
762+ \brief Creates a downloader for this file.
763+
764+ Attempts to download a folder return a downloader that indicates an error.
765+ \param policy If set to <code>ErrorIfConflict</code>, the download job indicates an error if this file's
766+ ETag no longer matches the ETag maintained by the provider. If set to <code>IgnoreConflict</code>, the
767+ download will proceed regardless of any ETag mismatch.
768+ \return A downloader that, once ready, can be used to download the data for this file.
769+ \see \link uploads-downloads Uploads and Downloads\endlink
770+ */
771 Q_INVOKABLE unity::storage::qt::Downloader* createDownloader(ConflictPolicy policy) const;
772
773+ /**
774+ \brief Lists the contents of this folder.
775+
776+ Attempts to list a file return a job that indicates an error.
777+ \param keys A list of metadata keys for metadata items that should be returned by the provider.
778+ If the list is empty, the provider returns a default set of metadata items.
779+ \return A job that, once complete, provides access to this folder's items.
780+ */
781 Q_INVOKABLE unity::storage::qt::ItemListJob* list(QStringList const& keys = QStringList()) const;
782- Q_INVOKABLE unity::storage::qt::ItemListJob* lookup(QString const& name, QStringList const& = QStringList()) const;
783- Q_INVOKABLE unity::storage::qt::ItemJob* createFolder(QString const& name, QStringList const& = QStringList()) const;
784+
785+ /**
786+ \brief Locates an item by name within this folder.
787+
788+ Attempts to perform a lookup on a file return a job that indicates an error.
789+ \param name The name of the item to look up.
790+ \param keys A list of metadata keys for metadata items that should be returned by the provider.
791+ If the list is empty, the provider returns a default set of metadata items.
792+ \return A job that, once complete, provides access to the items with the given <code>name</code>.
793+ */
794+ Q_INVOKABLE unity::storage::qt::ItemListJob* lookup(QString const& name,
795+ QStringList const& keys = QStringList()) const;
796+
797+ /**
798+ \brief Creates a child folder within this folder.
799+
800+ Attempts to create a folder within a file return a job that indicates an error.
801+ \param name The name of the new folder within this folder.
802+ \param keys A list of metadata keys for metadata items that should be returned by the provider.
803+ If the list is empty, the provider returns a default set of metadata items.
804+ \return A job that, once complete, provides access to the new folder.
805+ */
806+ Q_INVOKABLE unity::storage::qt::ItemJob* createFolder(QString const& name,
807+ QStringList const& keys = QStringList()) const;
808+
809+ /**
810+ \brief Creates a file within this folder.
811+
812+ The number of bytes written via the returned uploader <i>must</i> match <code>sizeInBytes</code>, otherwise
813+ the upload will indicate an error.
814+
815+ Attempts to create a file within a file return a job that indicates an error.
816+ \param name The name of the new file within this folder.
817+ \param policy If set to <code>ErrorIfConflict</code>, the upload job indicates an error if this file's
818+ ETag no longer matches the ETag maintained by the provider. If set to <code>IgnoreConflict</code>, any
819+ existing file with the same name is overwritten.
820+ \param sizeInBytes The number of bytes that the client will upload for this file.
821+ \param contentType The <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">media type</a>
822+ of the file. Note that providers may ignore this parameter and determine the media type
823+ themselves (based on the file name or the file contents).
824+ \param keys A list of metadata keys for metadata items that should be returned by the provider.
825+ If the list is empty, the provider returns a default set of metadata items.
826+ \return An uploader that, once ready, can be used to upload the data for this file.
827+ \see \link uploads-downloads Uploads and Downloads\endlink
828+ */
829 Q_INVOKABLE unity::storage::qt::Uploader* createFile(QString const& name,
830 ConflictPolicy policy,
831 qint64 sizeInBytes,
832 QString const& contentType,
833 QStringList const& keys = QStringList()) const;
834-
835- bool operator==(Item const&) const;
836+ //@}
837+
838+ /** @name Comparison operators and hashing.
839+ */
840+ //{@
841+ /**
842+ \brief Compares Item instances for equality.
843+
844+ Item instances are equal if both are invalid, or both are valid, use the same account,
845+ and have the same identity.
846+ \param other The item to compare this item with.
847+ \return If all details of the items match, <code>true</code> is returned; <code>false</code> otherwise.
848+ */
849+ bool operator==(Item const& other) const;
850 bool operator!=(Item const&) const;
851 bool operator<(Item const&) const;
852 bool operator<=(Item const&) const;
853 bool operator>(Item const&) const;
854 bool operator>=(Item const&) const;
855
856+ /**
857+ \brief Returns a hash value.
858+ \note The hash value is <i>not</i> necessarily the same as the one returned by
859+ \link unity::storage::qt::qHash(Item const& i) qHash()\endlink, but <i>is</i> the same as the one returned by
860+ \link std::hash<unity::storage::qt::Item> Item::hash()\endlink.
861+ \return A hash value for use with unordered containers.
862+ */
863 size_t hash() const;
864+ //@}
865
866 private:
867+ ///@cond
868 Item(std::shared_ptr<internal::ItemImpl> const&);
869
870 std::shared_ptr<internal::ItemImpl> p_;
871@@ -138,10 +422,15 @@
872 friend class internal::ItemImpl;
873 friend class internal::DownloaderImpl;
874 friend class internal::UploaderImpl;
875+ ///@endcond
876 };
877
878-// Note: qHash(Item) does *not* return the same hash value is std::hash<Item> because
879-// std:hash() returns size_t (typically 64 bits), but qHash() returns uint (typically 32 bits).
880+/**
881+\brief Returns a hash value.
882+\note The hash value is <i>not</i> necessarily the same as the one returned by
883+\link Item::hash()\endlink.
884+\return A hash value for use with unordered containers.
885+*/
886 uint Q_DECL_EXPORT qHash(unity::storage::qt::Item const& i);
887
888 } // namespace qt
889@@ -156,8 +445,20 @@
890 namespace std
891 {
892
893+/**
894+\brief Function template specialization in namespace <code>std</code> to allow use of
895+\link unity::storage::qt::Item Item\endlink instances with unordered containers.
896+*/
897 template<> struct Q_DECL_EXPORT hash<unity::storage::qt::Item>
898 {
899+ /**
900+ \brief Returns a hash value.
901+ \note The hash value is <i>not</i> necessarily the same as the one returned by
902+ \link unity::storage::qt::qHash(const Item& i) qHash()\endlink (but <i>is</i> the same as the value returned
903+ by \link unity::storage::qt::Item::hash() Item::hash()\endlink).
904+ \return A hash value for use with unordered containers.
905+ \see \link unity::storage::qt::Item::hash Item::hash()\endlink
906+ */
907 std::size_t operator()(unity::storage::qt::Item const& i) const
908 {
909 return i.hash();
910
911=== modified file 'include/unity/storage/qt/ItemJob.h'
912--- include/unity/storage/qt/ItemJob.h 2016-10-10 04:07:07 +0000
913+++ include/unity/storage/qt/ItemJob.h 2017-04-21 01:35:48 +0000
914@@ -38,34 +38,97 @@
915 class Item;
916 class StorageError;
917
918+/**
919+\brief Asynchronous job to retrieve an item.
920+*/
921+
922 class Q_DECL_EXPORT ItemJob final : public QObject
923 {
924 Q_OBJECT
925+
926+ /**
927+ \see \link isValid() const isValid()\endlink
928+ */
929 Q_PROPERTY(bool isValid READ isValid NOTIFY statusChanged FINAL)
930+
931+ /**
932+ \see \link status() const status()\endlink
933+ */
934 Q_PROPERTY(unity::storage::qt::ItemJob::Status status READ status NOTIFY statusChanged FINAL)
935+
936+ /**
937+ \see \link error() const error()\endlink
938+ */
939 Q_PROPERTY(unity::storage::qt::StorageError error READ error NOTIFY statusChanged FINAL)
940+
941+ /**
942+ \see \link item() const item()\endlink
943+ */
944 Q_PROPERTY(unity::storage::qt::Item item READ item NOTIFY statusChanged FINAL)
945
946 public:
947+ /**
948+ \brief Destroys the job.
949+
950+ It is safe to destroy a job while it is still executing.
951+ */
952 virtual ~ItemJob();
953
954- enum Status { Loading, Finished, Error };
955+ /**
956+ \brief Indicates the status of the job.
957+ */
958+ enum Status {
959+ Loading, /*!< The job is still executing. */
960+ Finished, /*!< The job finished succesfully. */
961+ Error /*!< The job finished with an error. */
962+ };
963 Q_ENUMS(Status)
964
965+ /**
966+ \brief Returns whether this job was successfully created.
967+ \return If the job status is \link Error\endlink, the return value is <code>false</code>;
968+ <code>true</code> otherwise.
969+ */
970 bool isValid() const;
971+
972+ /**
973+ \brief Returns the current job status.
974+ \return The job status.
975+ */
976 Status status() const;
977+
978+ /**
979+ \brief Returns the last error that occured in this job.
980+ \return A StorageError that indicates the cause of the error if isValid() returns <code>false</code>.
981+ If isValid() returns <code>true</code>, the returned StorageError has type StorageError::NoError.
982+ */
983 StorageError error() const;
984+
985+ /**
986+ \brief Returns the item for the job.
987+ \return The item. If the status is not \link Finished\endlink, the returned Item is invalid.
988+ */
989 Item item() const;
990
991 Q_SIGNALS:
992+ /** @name Signals
993+ */
994+ //{@
995+ /**
996+ \brief This signal is emitted whenever this job transitions to the \link Finished\endlink or \link Error\endlink state.
997+ \param status The status of the job.
998+ */
999 void statusChanged(unity::storage::qt::ItemJob::Status status) const;
1000+ //@}
1001
1002 private:
1003+ ///@cond
1004 ItemJob(std::unique_ptr<internal::ItemJobImpl> p);
1005
1006 std::unique_ptr<internal::ItemJobImpl> const p_;
1007
1008 friend class internal::ItemJobImpl;
1009+ ///@endcond
1010 };
1011
1012 } // namespace qt
1013
1014=== modified file 'include/unity/storage/qt/ItemListJob.h'
1015--- include/unity/storage/qt/ItemListJob.h 2016-10-10 04:07:07 +0000
1016+++ include/unity/storage/qt/ItemListJob.h 2017-04-21 01:35:48 +0000
1017@@ -44,28 +44,87 @@
1018 class Item;
1019 class StorageError;
1020
1021+/**
1022+\brief Asynchronous job to retrieve an item.
1023+*/
1024 class Q_DECL_EXPORT ItemListJob final : public QObject
1025 {
1026 Q_OBJECT
1027+
1028+ /**
1029+ \see \link isValid() const isValid()\endlink
1030+ */
1031 Q_PROPERTY(bool isValid READ isValid NOTIFY statusChanged FINAL)
1032+
1033+ /**
1034+ \see \link status() const status()\endlink
1035+ */
1036 Q_PROPERTY(unity::storage::qt::ItemListJob::Status status READ status NOTIFY statusChanged FINAL)
1037+
1038+ /**
1039+ \see \link error() const error()\endlink
1040+ */
1041 Q_PROPERTY(unity::storage::qt::StorageError error READ error NOTIFY statusChanged FINAL)
1042
1043 public:
1044+ /**
1045+ \brief Destroys the job.
1046+
1047+ It is safe to destroy a job while it is still executing.
1048+ */
1049 virtual ~ItemListJob();
1050
1051- enum Status { Loading, Finished, Error };
1052+ /**
1053+ \brief Indicates the status of the job.
1054+ */
1055+ enum Status {
1056+ Loading, /*!< The job is still executing. */
1057+ Finished, /*!< The job finished succesfully. */
1058+ Error /*!< The job finished with an error. */
1059+ };
1060 Q_ENUMS(Status)
1061
1062+ /**
1063+ \brief Returns whether this job was successfully created.
1064+ \return If the job status is \link Error\endlink, the return value is <code>false</code>;
1065+ <code>true</code> otherwise.
1066+ */
1067 bool isValid() const;
1068+
1069+ /**
1070+ \brief Returns the current job status.
1071+ \return The job status.
1072+ */
1073 Status status() const;
1074+
1075+ /**
1076+ \brief Returns the last error that occured in this job.
1077+ \return A StorageError that indicates the cause of the error if isValid() returns <code>false</code>.
1078+ If isValid() returns <code>true</code>, the returned StorageError has type StorageError::NoError.
1079+ */
1080 StorageError error() const;
1081
1082 Q_SIGNALS:
1083+ /** @name Signals
1084+ */
1085+ //{@
1086+ /**
1087+ \brief This signal is emitted whenever this job transitions to the \link Finished\endlink or \link Error\endlink state.
1088+ \param status The status of the job.
1089+ */
1090 void statusChanged(unity::storage::qt::ItemListJob::Status status) const;
1091+
1092+ /**
1093+ \brief This signal is emitted whenever one or more items are available.
1094+
1095+ The provider may deliver items in batches. If so, this signal is emitted once for each batch.
1096+ \param items The available items.
1097+ */
1098 void itemsReady(QList<unity::storage::qt::Item> const& items) const;
1099+ //@}
1100
1101 private:
1102+ ///@cond
1103 ItemListJob(std::unique_ptr<internal::ListJobImplBase> p);
1104
1105 std::unique_ptr<internal::ListJobImplBase> const p_;
1106@@ -74,6 +133,7 @@
1107 friend class internal::ItemListJobImpl;
1108 friend class internal::MultiItemJobImpl;
1109 friend class internal::MultiItemListJobImpl;
1110+ ///@endcond
1111 };
1112
1113 } // namespace qt
1114
1115=== modified file 'include/unity/storage/qt/Runtime.h'
1116--- include/unity/storage/qt/Runtime.h 2016-11-21 02:50:38 +0000
1117+++ include/unity/storage/qt/Runtime.h 2017-04-21 01:35:48 +0000
1118@@ -35,6 +35,9 @@
1119 {
1120 namespace storage
1121 {
1122+/**
1123+\brief This namespace contains the client-side API.
1124+*/
1125 namespace qt
1126 {
1127 namespace internal
1128@@ -46,24 +49,130 @@
1129
1130 class AccountsJob;
1131
1132+/**
1133+\brief Class to access to the storage framework runtime.
1134+
1135+Before you can do anything with the storage framework API, you must instantiate the Runtime.
1136+
1137+*/
1138 class Q_DECL_EXPORT Runtime : public QObject
1139 {
1140 Q_OBJECT
1141+
1142+ /**
1143+ \see \link isValid() const isValid()\endlink
1144+ */
1145 Q_PROPERTY(bool isValid READ isValid FINAL)
1146+
1147+ /**
1148+ \see \link error() const error()\endlink
1149+ */
1150 Q_PROPERTY(unity::storage::qt::StorageError error READ error FINAL)
1151+
1152+ /**
1153+ \see \link connection() const connection()\endlink
1154+ */
1155 Q_PROPERTY(QDBusConnection connection READ connection CONSTANT FINAL)
1156
1157 public:
1158+ /**
1159+ \brief Initializes the storage framework runtime.
1160+
1161+ You can interact with the storage framework API only while a Runtime instance exists.
1162+ You must create a Runtime instance before doing anything
1163+ else, and you must not interact with anything obtained via that runtime once it
1164+ is destroyed.
1165+ (Any calls to other instances obtained via this runtime after it has been destroyed
1166+ or after shutdown() was called fail with StorageError::RuntimeDestroyed.)
1167+
1168+ You can create more than one Runtime instance, but should generally not have any need to do so. (Each
1169+ instance uses a separate DBus connection to access providers.)
1170+ \param parent The runtime's owner object.
1171+ */
1172 Runtime(QObject* parent = nullptr);
1173+
1174+ /**
1175+ \brief Initializes the storage framework runtime for a specific DBus connection.
1176+
1177+ This constructor allows you to provide a separate DBus connection that the runtime will
1178+ use to access DBus services. This constructor is provided for testing the storage framework
1179+ API itself; you should not have any need to use it for a normal application.
1180+ \param bus The DBus connection to use for accessing DBus services.
1181+ \param parent The runtime's owner object.
1182+ */
1183 Runtime(QDBusConnection const& bus, QObject* parent = nullptr);
1184+
1185+ /**
1186+ \brief Destroys the storage framework runtime.
1187+
1188+ The destructor finalizes the runtime, that is, disconnects all signals and tears down the DBus connection.
1189+ Any calls to other instances obtained via this runtime after it has been destroyed
1190+ or after shutdown() was called fail with StorageError::RuntimeDestroyed.
1191+ */
1192 virtual ~Runtime();
1193
1194+ /**
1195+ \brief Checks whether this runtime was successfully constructed.
1196+
1197+ If any errors were encountered during initialization, isValid() returns <code>false</code>
1198+ and youu can obtain further details about the cause of the error via the error() method.
1199+ \return Returns <code>true</code> if the runtime was successfully initialized; <code>false</code> otherwise.
1200+ */
1201 bool isValid() const;
1202+
1203+ /**
1204+ \brief Returns the last error that occured in this runtime.
1205+ \return A StorageError that indicates the cause of the error if isValid() returns <code>false</code>.
1206+ If isValid() returns <code>true</code>, the returned StorageError has type StorageError::NoError.
1207+ */
1208 StorageError error() const;
1209+
1210+ /**
1211+ \brief Returns the DBus connection used by this runtime.
1212+ \return The <a href="http://doc.qt.io/qt-5/qdbusconnection.html">QDBusConnection</a> used by this runtime
1213+ to access providers.
1214+ */
1215 QDBusConnection connection() const;
1216+
1217+ /**
1218+ \brief Shuts down the runtime.
1219+
1220+ This method is provided to allow you to check whether the runtime was successfully finalized and log
1221+ any errors. If errors were encountered during shutdown, isValid() returns <code>false</code>
1222+ and you can call error() to get the details of the problem.
1223+
1224+ Calling shutdown() more than once is safe and does nothing.
1225+
1226+ The destructor implicitly calls shutdown().
1227+
1228+ Any calls to other instances obtained via this runtime after
1229+ calling shutdown() fail with StorageError::RuntimeDestroyed.
1230+ \return Details of any error encountered during shutdown.
1231+ */
1232 StorageError shutdown();
1233+
1234+ /**
1235+ \brief Retrieves the list of available accounts.
1236+ \return An AccountsJob that, once complete, provides access to the available accounts.
1237+ \note You <i>must</i> deallocate the returned job by calling <code>delete</code>.
1238+ \see Account
1239+ */
1240 Q_INVOKABLE unity::storage::qt::AccountsJob* accounts() const;
1241
1242+ /**
1243+ \brief Creates a test account.
1244+
1245+ This method is intended for testing. You can use the returned Account to talk to a provider that
1246+ listens on DBus with the provided bus name and object path.
1247+ (If you want to test a client application without the overhead of accessing a cloud provider or creating
1248+ a mock provider, we suggest to use the \link local-provider local provider\endlink.)
1249+ \param bus_name The DBus name of the provider for the account.
1250+ \param object_path The DBus object path of the provider for the account.
1251+ \param id The numeric ID of the account.
1252+ \param service_id The account service ID, such as "storage-provider-nextcloud".
1253+ \param name The name of the account, such as "user@domain.com".
1254+ \return The test account.
1255+ */
1256 Account make_test_account(QString const& bus_name,
1257 QString const& object_path,
1258 quint32 id = 999,
1259
1260=== modified file 'include/unity/storage/qt/VoidJob.h'
1261--- include/unity/storage/qt/VoidJob.h 2016-10-10 04:07:07 +0000
1262+++ include/unity/storage/qt/VoidJob.h 2017-04-21 01:35:48 +0000
1263@@ -37,32 +37,86 @@
1264
1265 class StorageError;
1266
1267+/**
1268+\brief Asynchronous job to monitor progress of an operation that returns no result.
1269+*/
1270+
1271 class Q_DECL_EXPORT VoidJob final : public QObject
1272 {
1273 Q_OBJECT
1274+
1275+ /**
1276+ \see \link isValid() const isValid()\endlink
1277+ */
1278 Q_PROPERTY(bool isValid READ isValid NOTIFY statusChanged FINAL)
1279+
1280+ /**
1281+ \see \link status() const status()\endlink
1282+ */
1283 Q_PROPERTY(unity::storage::qt::VoidJob::Status status READ status NOTIFY statusChanged FINAL)
1284+
1285+ /**
1286+ \see \link error() const error()\endlink
1287+ */
1288 Q_PROPERTY(unity::storage::qt::StorageError error READ error NOTIFY statusChanged FINAL)
1289
1290 public:
1291+ /**
1292+ \brief Destroys the job.
1293+
1294+ It is safe to destroy a job while it is still executing.
1295+ */
1296 virtual ~VoidJob();
1297
1298- enum Status { Loading, Finished, Error };
1299+ /**
1300+ \brief Indicates the status of the job.
1301+ */
1302+ enum Status {
1303+ Loading, /*!< The job is still executing. */
1304+ Finished, /*!< The job finished succesfully. */
1305+ Error /*!< The job finished with an error. */
1306+ };
1307 Q_ENUMS(Status)
1308
1309+ /**
1310+ \brief Returns whether this job was successfully created.
1311+ \return If the job status is \link Error\endlink, the return value is <code>false</code>;
1312+ <code>true</code> otherwise.
1313+ */
1314 bool isValid() const;
1315+
1316+ /**
1317+ \brief Returns the current job status.
1318+ \return The job status.
1319+ */
1320 Status status() const;
1321+
1322+ /**
1323+ \brief Returns the last error that occured in this job.
1324+ \return A StorageError that indicates the cause of the error if isValid() returns <code>false</code>.
1325+ If isValid() returns <code>true</code>, the returned StorageError has type StorageError::NoError.
1326+ */
1327 StorageError error() const;
1328
1329 Q_SIGNALS:
1330+ /** @name Signals
1331+ */
1332+ //{@
1333+ /**
1334+ \brief This signal is emitted whenever this job transitions to the \link Finished\endlink or \link Error\endlink state.
1335+ \param status The status of the job.
1336+ */
1337 void statusChanged(unity::storage::qt::VoidJob::Status status) const;
1338+ //@}
1339
1340 private:
1341+ ///@cond
1342 VoidJob(std::unique_ptr<internal::VoidJobImpl> p);
1343
1344 std::unique_ptr<internal::VoidJobImpl> const p_;
1345
1346 friend class internal::VoidJobImpl;
1347+ ///@endcond
1348 };
1349
1350 } // namespace qt
1351
1352=== modified file 'plugins/Ubuntu/StorageFramework/plugin.cpp'
1353--- plugins/Ubuntu/StorageFramework/plugin.cpp 2016-11-02 02:54:48 +0000
1354+++ plugins/Ubuntu/StorageFramework/plugin.cpp 2017-04-21 01:35:48 +0000
1355@@ -20,9 +20,11 @@
1356 #include <unity/storage/qt/Runtime.h>
1357 #include <unity/storage/qt/Account.h>
1358 #include <unity/storage/qt/AccountsJob.h>
1359+#include <unity/storage/qt/Downloader.h>
1360 #include <unity/storage/qt/Item.h>
1361 #include <unity/storage/qt/ItemJob.h>
1362 #include <unity/storage/qt/ItemListJob.h>
1363+#include <unity/storage/qt/Uploader.h>
1364
1365 using namespace unity::storage::qt;
1366
1367@@ -41,6 +43,8 @@
1368 qmlRegisterUncreatableType<Item>(uri, 0, 1, "Item", "");
1369 qmlRegisterUncreatableType<ItemJob>(uri, 0, 1, "ItemJob", "Use Account or another item to access items");
1370 qmlRegisterUncreatableType<ItemListJob>(uri, 0, 1, "ItemListJob", "Use Account or another item to access items");
1371+ qmlRegisterUncreatableType<Downloader>(uri, 0, 1, "Downloader", "Use another item to create a downloader");
1372+ qmlRegisterUncreatableType<Uploader>(uri, 0, 1, "Uploader", "Use another item to create an uploader");
1373 }
1374
1375 }
1376
1377=== modified file 'tests/headers/CMakeLists.txt'
1378--- tests/headers/CMakeLists.txt 2016-11-18 05:55:17 +0000
1379+++ tests/headers/CMakeLists.txt 2017-04-21 01:35:48 +0000
1380@@ -16,7 +16,7 @@
1381 set(extra_inc_dirs "${Qt5Core_INCLUDE_DIRS}")
1382 set(extra_inc_dirs "${extra_inc_dirs};${Qt5DBus_INCLUDE_DIRS}")
1383 set(extra_inc_dirs "${extra_inc_dirs};${Qt5Network_INCLUDE_DIRS}")
1384-set(extra_inc_dirs "${extra_inc_dirs};${GIO_DEPS_INCLUDE_DIRS}")
1385+set(extra_inc_dirs "${extra_inc_dirs};${GLIB_DEPS_INCLUDE_DIRS}")
1386 set(extra_inc_dirs "${extra_inc_dirs};${ONLINEACCOUNTS_DEPS_INCLUDE_DIRS}")
1387
1388 set(extra_defines "-D BOOST_THREAD_VERSION=4")
1389
1390=== modified file 'tests/local-provider/CMakeLists.txt'
1391--- tests/local-provider/CMakeLists.txt 2017-03-10 04:46:55 +0000
1392+++ tests/local-provider/CMakeLists.txt 2017-04-21 01:35:48 +0000
1393@@ -9,7 +9,6 @@
1394 Qt5::Test
1395 ${Boost_LIBRARIES}
1396 ${GLIB_DEPS_LIBRARIES}
1397- ${GIO_DEPS_LIBRARIES}
1398 testutils
1399 gtest
1400 )

Subscribers

People subscribed via source and target branches

to all changes: