From b1264df120b6594a79d99cbb1cc5ef944fa2e448 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Wed, 20 Jul 2016 15:00:44 +0600 Subject: CLOUD: Check whether Storage is working when replacing it We do that in CloudManager::replaceStorage(), but I've tried to eliminate such possibility by adding a check in the StorageWizardDialog. --- gui/storagewizarddialog.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gui') diff --git a/gui/storagewizarddialog.cpp b/gui/storagewizarddialog.cpp index 393b8263ef..a8574ab7d2 100644 --- a/gui/storagewizarddialog.cpp +++ b/gui/storagewizarddialog.cpp @@ -74,6 +74,29 @@ StorageWizardDialog::StorageWizardDialog(uint32 storageId): void StorageWizardDialog::open() { Dialog::open(); + + if (CloudMan.isWorking()) { + bool doClose = true; + + MessageDialog alert(_("The other Storage is working. Do you want to interrupt it?"), _("Yes"), _("No")); + if (alert.runModal() == GUI::kMessageOK) { + if (CloudMan.isDownloading()) CloudMan.cancelDownload(); + if (CloudMan.isSyncing()) CloudMan.cancelSync(); + + // I believe it still would return `true` here, but just in case + if (CloudMan.isWorking()) { + MessageDialog alert2(_("Wait until current Storage finishes up and try again.")); + alert2.runModal(); + } else + doClose = false; + } + + if (doClose) { + close(); + return; + } + } + #ifdef USE_SDL_NET _stopServerOnClose = !LocalServer.isRunning(); LocalServer.start(); -- cgit v1.2.3