diff options
author | Alexander Tkachev | 2016-05-28 20:40:20 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 6f35fc42721895be70c6c21f87eb9a75693ff168 (patch) | |
tree | b141a29912ea4be50d52a9bd53748088e8234f4a /backends/cloud/onedrive | |
parent | b74d7a6861dbb5d0fafec0e6587deb7637b0ab12 (diff) | |
download | scummvm-rg350-6f35fc42721895be70c6c21f87eb9a75693ff168.tar.gz scummvm-rg350-6f35fc42721895be70c6c21f87eb9a75693ff168.tar.bz2 scummvm-rg350-6f35fc42721895be70c6c21f87eb9a75693ff168.zip |
CLOUD: Add OneDriveStorage::downloadFolder()
Just uses FolderDownloadRequest the way DropboxStorage does.
Diffstat (limited to 'backends/cloud/onedrive')
-rw-r--r-- | backends/cloud/onedrive/onedrivestorage.cpp | 8 | ||||
-rw-r--r-- | backends/cloud/onedrive/onedrivestorage.h | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp index d14379393b..c924dbf093 100644 --- a/backends/cloud/onedrive/onedrivestorage.cpp +++ b/backends/cloud/onedrive/onedrivestorage.cpp @@ -25,6 +25,7 @@ #include "backends/cloud/onedrive/onedrivetokenrefresher.h" #include "backends/cloud/onedrive/onedrivelistdirectoryrequest.h" #include "backends/cloud/downloadrequest.h" +#include "backends/cloud/folderdownloadrequest.h" #include "backends/networking/curl/connectionmanager.h" #include "backends/networking/curl/curljsonrequest.h" #include "common/cloudmanager.h" @@ -187,6 +188,11 @@ Networking::Request *OneDriveStorage::download(Common::String remotePath, Common return ConnMan.addRequest(new DownloadRequest(this, callback, remotePath, f)); } +/** Returns Common::Array<StorageFile> with list of files, which were not downloaded. */ +Networking::Request *OneDriveStorage::downloadFolder(Common::String remotePath, Common::String localPath, FileArrayCallback callback, bool recursive) { + return ConnMan.addRequest(new FolderDownloadRequest(this, callback, remotePath, localPath, recursive)); +} + void OneDriveStorage::fileDownloaded(BoolResponse pair) { if (pair.value) debug("file downloaded!"); else debug("download failed!"); @@ -207,7 +213,7 @@ Networking::Request *OneDriveStorage::syncSaves(BoolCallback callback) { request->addHeader("Authorization: bearer " + _token); return ConnMan.addRequest(request); */ - return listDirectory("subfolder", new Common::Callback<OneDriveStorage, FileArrayResponse>(this, &OneDriveStorage::printFiles), true); + return downloadFolder("subfolder", "local/onedrive/subfolder_downloaded", new Common::Callback<OneDriveStorage, FileArrayResponse>(this, &OneDriveStorage::printFiles), false); } OneDriveStorage *OneDriveStorage::loadFromConfig(Common::String keyPrefix) { diff --git a/backends/cloud/onedrive/onedrivestorage.h b/backends/cloud/onedrive/onedrivestorage.h index c9a32a802f..674d13634d 100644 --- a/backends/cloud/onedrive/onedrivestorage.h +++ b/backends/cloud/onedrive/onedrivestorage.h @@ -85,6 +85,9 @@ public: /** Calls the callback when finished. */ virtual Networking::Request *download(Common::String remotePath, Common::String localPath, BoolCallback callback); + /** Returns Common::Array<StorageFile> with list of files, which were not downloaded. */ + virtual Networking::Request *downloadFolder(Common::String remotePath, Common::String localPath, FileArrayCallback callback, bool recursive = false); + /** Calls the callback when finished. */ virtual Networking::Request *remove(Common::String path, BoolCallback callback) { return nullptr; } //TODO |