|
8 | 8 |
|
9 | 9 | #include <QtDataSync/accountmanager.h> |
10 | 10 |
|
| 11 | +#ifdef DOXYGEN_RUN |
| 12 | +namespace de::skycoder42::QtDataSync { |
| 13 | + |
| 14 | +/*! @brief The QML binding of ::QtDataSync::AccountManager |
| 15 | + * |
| 16 | + * @since 4.0 |
| 17 | + * |
| 18 | + * @sa QtDataSync::AccountManager |
| 19 | + */ |
| 20 | +class AccountManager : public ::QtDataSync::AccountManager |
| 21 | +#else |
11 | 22 | namespace QtDataSync { |
12 | 23 |
|
13 | 24 | class QQmlAccountManager : public AccountManager, public QQmlParserStatus |
| 25 | +#endif |
14 | 26 | { |
15 | 27 | Q_OBJECT |
16 | 28 | Q_DISABLE_COPY(QQmlAccountManager) |
17 | 29 | Q_INTERFACES(QQmlParserStatus) |
18 | 30 |
|
| 31 | + /*! @brief Holds the name of the setup this manager operates on. |
| 32 | + * |
| 33 | + * @default{`QtDataSync::DefaultSetup`} |
| 34 | + * |
| 35 | + * Allows you to specify the name of the setup that this manager should use |
| 36 | + * |
| 37 | + * @warning This property must only ever be set on construction of the object |
| 38 | + * and must not be changed afterwards. Do not set both, this property and node |
| 39 | + * |
| 40 | + * @accessors{ |
| 41 | + * @memberAc{setupName} |
| 42 | + * @notifyAc{setupNameChanged()} |
| 43 | + * } |
| 44 | + * |
| 45 | + * @sa ::QtDataSync::AccountManager::setupName, AccountManager::node, AccountManager::valid |
| 46 | + */ |
19 | 47 | Q_PROPERTY(QString setupName READ setupName WRITE setSetupName NOTIFY setupNameChanged) |
| 48 | + /*! @brief Allows to directly set the remote object node to use |
| 49 | + * |
| 50 | + * @default{`nullptr`} |
| 51 | + * |
| 52 | + * Instead of a setup name, you can directly specify the remote object node via this property. |
| 53 | + * |
| 54 | + * @warning This property must only ever be set on construction of the object |
| 55 | + * and must not be changed afterwards. Do not set both, this property and setupName |
| 56 | + * |
| 57 | + * @accessors{ |
| 58 | + * @memberAc{node} |
| 59 | + * @notifyAc{nodeChanged()} |
| 60 | + * } |
| 61 | + * |
| 62 | + * @sa AccountManager::setupName, AccountManager::valid |
| 63 | + */ |
20 | 64 | Q_PROPERTY(QRemoteObjectNode* node READ node WRITE setNode NOTIFY nodeChanged) |
| 65 | + /*! @brief Specifies if the object was correctly initialized |
| 66 | + * |
| 67 | + * @default{`false`} |
| 68 | + * |
| 69 | + * Only becomes true if the given setup name resolves to a valid datasync |
| 70 | + * instance or if the given node is valid |
| 71 | + * |
| 72 | + * @accessors{ |
| 73 | + * @memberAc{valid} |
| 74 | + * @notifyAc{validChanged()} |
| 75 | + * @readonlyAc |
| 76 | + * } |
| 77 | + * |
| 78 | + * @sa AccountManager::setupName, AccountManager::node |
| 79 | + */ |
21 | 80 | Q_PROPERTY(bool valid READ valid NOTIFY validChanged) |
22 | 81 |
|
23 | 82 | public: |
| 83 | + //! @private |
24 | 84 | explicit QQmlAccountManager(QObject *parent = nullptr); |
25 | 85 |
|
| 86 | + //! @private |
26 | 87 | void classBegin() override; |
| 88 | + //! @private |
27 | 89 | void componentComplete() override; |
28 | 90 |
|
| 91 | + //! @private |
29 | 92 | QString setupName() const; |
| 93 | + //! @private |
30 | 94 | QRemoteObjectNode* node() const; |
| 95 | + //! @private |
31 | 96 | bool valid() const; |
32 | 97 |
|
| 98 | + //! @copydoc ::QtDataSync::AccountManager::isTrustedImport(const QJsonObject &) |
33 | 99 | Q_INVOKABLE bool isTrustedImport(const QJsonObject &importData) const; |
34 | 100 |
|
| 101 | + //! @copydoc ::QtDataSync::AccountManager::exportAccount(bool, const std::function<void(QJsonObject)> &, const std::function<void(QString)> &) |
35 | 102 | Q_INVOKABLE void exportAccount(bool includeServer, const QJSValue &completedFn, const QJSValue &errorFn = {}); |
| 103 | + //! @copydoc ::QtDataSync::AccountManager::exportAccountTrusted(bool, const QString &, const std::function<void(QJsonObject)> &, const std::function<void(QString)> &) |
36 | 104 | Q_INVOKABLE void exportAccountTrusted(bool includeServer, const QString &password, const QJSValue &completedFn, const QJSValue &errorFn = {}); |
| 105 | + //! @copydoc ::QtDataSync::AccountManager::importAccount(const QJsonObject &, const std::function<void(bool,QString)> &, bool) |
37 | 106 | Q_INVOKABLE void importAccount(const QJsonObject &importData, const QJSValue &completedFn, bool keepData = false); |
| 107 | + //! @copydoc ::QtDataSync::AccountManager::importAccountTrusted(const QJsonObject &, const QString &, const std::function<void(bool,QString)> &, bool) |
38 | 108 | Q_INVOKABLE void importAccountTrusted(const QJsonObject &importData, const QString &password, const QJSValue &completedFn, bool keepData = false); |
39 | 109 |
|
40 | 110 | public Q_SLOTS: |
| 111 | + //! @private |
41 | 112 | void setSetupName(QString setupName); |
| 113 | + //! @private |
42 | 114 | void setNode(QRemoteObjectNode* node); |
43 | 115 |
|
44 | 116 | Q_SIGNALS: |
45 | | - void setupNameChanged(QString setupName); |
| 117 | + //! @notifyAcFn{AccountManager::setupName} |
| 118 | + void setupNameChanged(const QString &setupName); |
| 119 | + //! @notifyAcFn{AccountManager::node} |
46 | 120 | void nodeChanged(QRemoteObjectNode* node); |
| 121 | + //! @notifyAcFn{AccountManager::valid} |
47 | 122 | void validChanged(bool valid); |
48 | 123 |
|
49 | 124 | private: |
|
0 commit comments