diff options
Diffstat (limited to 'backends/cloud')
-rw-r--r-- | backends/cloud/cloudmanager.cpp | 18 | ||||
-rw-r--r-- | backends/cloud/cloudmanager.h | 26 |
2 files changed, 43 insertions, 1 deletions
diff --git a/backends/cloud/cloudmanager.cpp b/backends/cloud/cloudmanager.cpp index a9baac5d02..cb7e6f7cb3 100644 --- a/backends/cloud/cloudmanager.cpp +++ b/backends/cloud/cloudmanager.cpp @@ -132,7 +132,7 @@ Common::StringArray CloudManager::listStorages() const { } bool CloudManager::switchStorage(uint32 index) { - if (index < 0 || index > _storages.size()) { + if (index >= _storages.size()) { warning("CloudManager::switchStorage: invalid index passed"); return false; } @@ -148,6 +148,22 @@ bool CloudManager::switchStorage(uint32 index) { return true; } +Common::String CloudManager::getStorageUsername(uint32 index) { + if (index >= _storages.size()) return ""; + return _storages[index]->name(); //TODO +} + +uint64 CloudManager::getStorageUsedSpace(uint32 index) { + if (index >= _storages.size()) return 0; + return 0; //return _storages[index]->usedSpace(); //TODO +} + +Common::String CloudManager::getStorageLastSync(uint32 index) { + if (index >= _storages.size()) return ""; + if (_storages[index]->isSyncing()) return ""; + return _storages[index]->name(); //->lastSyncDate(); //TODO +} + void CloudManager::printBool(Storage::BoolResponse response) const { debug("bool = %s", (response.value ? "true" : "false")); } diff --git a/backends/cloud/cloudmanager.h b/backends/cloud/cloudmanager.h index 7e8cfd68a3..9956a92824 100644 --- a/backends/cloud/cloudmanager.h +++ b/backends/cloud/cloudmanager.h @@ -104,6 +104,32 @@ public: bool switchStorage(uint32 index); /** + * Return username used by Storage. + * + * @param Storage's index. + * @returns username or "" if index is invalid (no such Storage). + */ + Common::String getStorageUsername(uint32 index); + + /** + * Return space used by Storage. + * + * @param Storage's index. + * @returns used space in bytes or 0 if index is invalid (no such Storage). + */ + uint64 getStorageUsedSpace(uint32 index); + + /** + * Return Storage's last sync date. + * + * @param Storage's index. + * @returns last sync date or "" if index is invalid (no such Storage). + It also returns "" if there never was any sync + or if storage is syncing right now. + */ + Common::String getStorageLastSync(uint32 index); + + /** * Starts saves syncing process in currently active storage if there is any. */ SavesSyncRequest *syncSaves(Cloud::Storage::BoolCallback callback = nullptr, Networking::ErrorCallback errorCallback = nullptr); |