diff options
author | Michael Schuster <michael@schuster.ms> | 2020-02-14 04:10:01 +0300 |
---|---|---|
committer | Michael Schuster <michael@schuster.ms> | 2020-02-14 04:10:01 +0300 |
commit | abfebcf2917e971a4e8c279d3f2871c79e64583a (patch) | |
tree | 871350d0f6759b440e57e80ae2d96f068d0f1317 /src/gui/connectionvalidator.h | |
parent | bbb310a853b930692dd69dd1f9b6038dece0479a (diff) |
Add UserInfo class and fetch quota via API instead of PropfindJob
The PropfindJob quota includes the size of shares and thus leads to confusion
in regard of the real space available, as shown in the UI.
This commit aims to streamline the behaviour with the Android and iOS apps,
which also utilize the API.
Details:
- Refactor the QuotaInfo class into UserInfo
- Use JsonApiJob (ocs/v1.php/cloud/user) instead of PropfindJob
- Let ConnectionValidator use the new UserInfo class to fetch
the user and the avatar image (to avoid code duplication)
- Allow updating the avatar image upon AccountSettings visibility,
using UserInfo's quota fetching
Signed-off-by: Michael Schuster <michael@schuster.ms>
Diffstat (limited to 'src/gui/connectionvalidator.h')
-rw-r--r-- | src/gui/connectionvalidator.h | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/gui/connectionvalidator.h b/src/gui/connectionvalidator.h index 779b6a8a2..079fc36e6 100644 --- a/src/gui/connectionvalidator.h +++ b/src/gui/connectionvalidator.h @@ -67,23 +67,20 @@ namespace OCC { +---------------------------------+ | fetchUser - PropfindJob - | - +-> slotUserFetched - AvatarJob - | - +-> slotAvatarImage --> + Utilizes the UserInfo class to fetch the user and avatar image +-----------------------------------+ | +-> Client Side Encryption Checks --+ --reportResult() \endcode */ +class UserInfo; + class ConnectionValidator : public QObject { Q_OBJECT public: - explicit ConnectionValidator(AccountPtr account, QObject *parent = nullptr); + explicit ConnectionValidator(AccountStatePtr accountState, QObject *parent = nullptr); enum Status { Undefined, @@ -125,13 +122,12 @@ protected slots: void slotAuthSuccess(); void slotCapabilitiesRecieved(const QJsonDocument &); - void slotUserFetched(const QJsonDocument &); -#ifndef TOKEN_AUTH_ONLY - void slotAvatarImage(const QImage &img); -#endif + void slotUserFetched(UserInfo *userInfo); private: +#ifndef TOKEN_AUTH_ONLY void reportConnected(); +#endif void reportResult(Status status); void checkServerCapabilities(); void fetchUser(); @@ -144,6 +140,7 @@ private: bool setAndCheckServerVersion(const QString &version); QStringList _errors; + AccountStatePtr _accountState; AccountPtr _account; bool _isCheckingServerAndAuth; }; |