aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-04 14:49:33 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitd776b5397198835e1538071fd4fe53ab491c5da4 (patch)
tree2d065bf2d5d94980f22dca525821c1a6e017d759 /gui
parentc32d6fa047d03ca7be0e060aadcf33e5ee7d6d4a (diff)
downloadscummvm-rg350-d776b5397198835e1538071fd4fe53ab491c5da4.tar.gz
scummvm-rg350-d776b5397198835e1538071fd4fe53ab491c5da4.tar.bz2
scummvm-rg350-d776b5397198835e1538071fd4fe53ab491c5da4.zip
GUI: Use RemoteBrowser's result in DownloadDialog
It now checks the selected local directory, and shows different MessageDialogs to notify user of mistake or ambiguous situation.
Diffstat (limited to 'gui')
-rw-r--r--gui/downloaddialog.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/gui/downloaddialog.cpp b/gui/downloaddialog.cpp
index 6e9410dd51..34eddbe395 100644
--- a/gui/downloaddialog.cpp
+++ b/gui/downloaddialog.cpp
@@ -70,15 +70,7 @@ void DownloadDialog::selectDirectories() {
//first user should select remote directory to download
if (_remoteBrowser->runModal() <= 0) return;
- /*
- Common::FSNode dir(_browser->getResult());
- Common::FSList files;
- if (!dir.getChildren(files, Common::FSNode::kListAll)) {
- MessageDialog alert(_("ScummVM couldn't open the specified directory!"));
- alert.runModal();
- return;
- }
- */
+ Cloud::StorageFile remoteDirectory = _remoteBrowser->getResult();
//now user should select local directory to download into
if (_browser->runModal() <= 0) return;
@@ -91,7 +83,24 @@ void DownloadDialog::selectDirectories() {
return;
}
- //TODO: require empty directory?
+ //check that there is no file with the remote directory's name in the local one
+ for (Common::FSList::iterator i = files.begin(); i != files.end(); ++i) {
+ if (i->getName().equalsIgnoreCase(remoteDirectory.name())) {
+ //if there is, ask user whether it's OK
+ if (!i->isDirectory()) {
+ GUI::MessageDialog alert(_("Cannot create a directory to download - the specified directory has a file with the same name."), _("OK"));
+ alert.runModal();
+ return;
+ }
+ GUI::MessageDialog alert(
+ Common::String::format(_("The \"%s\" already exists in the specified directory.\nDo you really want to download files into that directory?"), remoteDirectory.name().c_str()),
+ _("Yes"),
+ _("No")
+ );
+ if (alert.runModal() != GUI::kMessageOK) return;
+ break;
+ }
+ }
//TODO: initiate download
}