diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/cloud/dropbox/dropboxstorage.h | 2 | ||||
-rw-r--r-- | backends/cloud/onedrive/onedrivestorage.cpp | 8 | ||||
-rw-r--r-- | backends/cloud/onedrive/onedrivestorage.h | 3 | ||||
-rw-r--r-- | backends/cloud/storage.h | 3 |
4 files changed, 14 insertions, 2 deletions
diff --git a/backends/cloud/dropbox/dropboxstorage.h b/backends/cloud/dropbox/dropboxstorage.h index c411e25d73..59dea9d210 100644 --- a/backends/cloud/dropbox/dropboxstorage.h +++ b/backends/cloud/dropbox/dropboxstorage.h @@ -79,7 +79,7 @@ public: virtual Networking::Request *download(Common::String remotePath, Common::String localPath, BoolCallback callback); /** Returns Common::Array<StorageFile> with list of files, which were not downloaded. */ - Networking::Request *downloadFolder(Common::String remotePath, Common::String localPath, FileArrayCallback callback, bool recursive = false); + 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 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 diff --git a/backends/cloud/storage.h b/backends/cloud/storage.h index 8ae5308a1c..8009075d0c 100644 --- a/backends/cloud/storage.h +++ b/backends/cloud/storage.h @@ -81,6 +81,9 @@ public: /** Calls the callback when finished. */ virtual Networking::Request *download(Common::String remotePath, Common::String localPath, BoolCallback callback) = 0; + /** 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) = 0; + /** Calls the callback when finished. */ virtual Networking::Request *remove(Common::String path, BoolCallback callback) = 0; |