Skip to content
Phil Davis edited this page Dec 13, 2016 · 7 revisions

Account and State Handling

The key is the Account class, which represents an account. Currently, only a single account is possible, but the class was designed such that there could easily be more. The main account is held by the the AccountManager class, which again is designed to hold multiple accounts in the future. It's main features are:

  • Saving and restoring itself from config file
  • Holding the current state
  • Holding the current URL
  • Holding the credentials (currently: HTTP Basic, Shibboleth, Dummy)
  • Holding a MirallAccessManager instance (with convenience methods to create QNetworkReplys.
  • Access the current quota info

In the future, some of these functions could further be divided into separate classes.

Note: The Account constructor expects an SSLErrorHandler. This is because it creates and holds a MirallAccessManager that could throw SSL errors.

State handling

The classes that contribute to state changes are:

  • Application: Set Signed Out on explicit sign out. When the credentials have been fetched, but have not been provided, set SignedOut, if they are wrong (set to InvalidCredentials), set to Disconnected and try again.
  • ConnectionValidator: Keep SignedOut or set Disconnected if authentication fails. Set Disconnected if status.php could not be found in the first place. When in disconnected state, runs every 32 seconds and attempt to connect when the network is available again. If the authentication succeeds, it's set to Connected.
  • Folder: Switch to Disconnected if E-Tag request fails
  • AbstractNetworkJob: Switch to InvalidCredentials state if the credentials are invalid and they job needs to run authenticated.
  • QuotaInfo: Switch associated Account to Disconnected in failure.

Network Jobs

Network Jobs are based on the AbstractNetworkJob class, which provides convenience functions. They require an Account object.

SyncEngine