diff options
author | Christian Kamm <kamm@incasoftware.de> | 2014-12-18 14:09:48 +0300 |
---|---|---|
committer | Christian Kamm <kamm@incasoftware.de> | 2014-12-18 17:39:51 +0300 |
commit | 38ebfec1fb6814c9516a249ddb69b2816ce224fc (patch) | |
tree | f2be2bf5fcfefa78b4dcfa11d67b07a7cee6be73 /src/gui/accountstate.h | |
parent | 6c7acd585e1a5758180d71de39119db5d890093d (diff) |
Use global Account/AccountState less.
* Use a shared pointer to Account everywhere to ensure
the instance stays alive long enough for a sync to terminate
* Folder is now tied to an AccountState
* SyncEngine and OwncloudPropagator tie to an Account and use that
for all jobs they run
Issue: Since the setup wizard currently always replaces the
account, it will always wipe all folder definitions, even when
the actual changes to the account were minor.
Diffstat (limited to 'src/gui/accountstate.h')
-rw-r--r-- | src/gui/accountstate.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/accountstate.h b/src/gui/accountstate.h index 22c2cd4da..f60d54636 100644 --- a/src/gui/accountstate.h +++ b/src/gui/accountstate.h @@ -42,7 +42,7 @@ signals: void accountStateRemoved(AccountState *accountState); private slots: - void slotAccountAdded(Account *account); + void slotAccountAdded(AccountPtr account); private: void setAccountState(AccountState *account); @@ -79,10 +79,11 @@ public: /// The actual current connectivity status. typedef ConnectionValidator::Status ConnectionStatus; - AccountState(Account* account); + /// Use the account as parent + AccountState(AccountPtr account); ~AccountState(); - Account* account() const; + AccountPtr account() const; ConnectionStatus connectionStatus() const; QStringList connectionErrors() const; @@ -114,7 +115,9 @@ protected Q_SLOTS: void slotCredentialsFetched(AbstractCredentials* creds); private: - Account * _account; + // A strong reference here would keep Account and AccountState + // alive indefinitely since Account is the parent of AccountState. + QWeakPointer<Account> _account; QuotaInfo *_quotaInfo; State _state; ConnectionStatus _connectionStatus; |