diff options
| -rw-r--r-- | gui/remotebrowser.cpp | 26 | ||||
| -rw-r--r-- | gui/remotebrowser.h | 4 | 
2 files changed, 27 insertions, 3 deletions
| diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index fac0b02e35..995e6a654c 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -40,7 +40,7 @@ enum {  };  RemoteBrowserDialog::RemoteBrowserDialog(const char *title) -	: Dialog("Browser"), _navigationLocked(false), _updateList(false) { +	: Dialog("Browser"), _navigationLocked(false), _updateList(false), _workingRequest(nullptr), _ignoreCallback(false) {  	_backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain;  	new StaticTextWidget(this, "Browser.Headline", title); @@ -58,11 +58,27 @@ RemoteBrowserDialog::RemoteBrowserDialog(const char *title)  	new ButtonWidget(this, "Browser.Choose", _("Choose"), 0, kChooseCmd);  } +RemoteBrowserDialog::~RemoteBrowserDialog() { +	if (_workingRequest) { +		_ignoreCallback = true; +		_workingRequest->finish(); +	} +} +  void RemoteBrowserDialog::open() {	  	Dialog::open();  	listDirectory(Cloud::StorageFile());  } +void RemoteBrowserDialog::close() { +	Dialog::close(); +	if (_workingRequest) { +		_ignoreCallback = true; +		_workingRequest->finish(); +		_ignoreCallback = false; +	} +} +  void RemoteBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {  	switch (cmd) {  	case kChooseCmd: { @@ -154,7 +170,7 @@ void RemoteBrowserDialog::goUp() {  }  void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) { -	if (_navigationLocked) return; +	if (_navigationLocked || _workingRequest) return;  	_navigationLocked = true;  	_workingRequest = CloudMan.listDirectory( @@ -170,12 +186,18 @@ void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) {  }  void RemoteBrowserDialog::directoryListedCallback(Cloud::Storage::ListDirectoryResponse response) { +	_workingRequest = nullptr; +	if (_ignoreCallback) return; +  	_navigationLocked = false;  	_nodeContent = response.value;  	_updateList = true;  }  void RemoteBrowserDialog::directoryListedErrorCallback(Networking::ErrorResponse error) { +	_workingRequest = nullptr; +	if (_ignoreCallback) return; +  	_navigationLocked = false;  	_node = _backupNode;  	_updateList = true; diff --git a/gui/remotebrowser.h b/gui/remotebrowser.h index ca1f9379cd..e13ee9db3d 100644 --- a/gui/remotebrowser.h +++ b/gui/remotebrowser.h @@ -39,8 +39,10 @@ class CommandSender;  class RemoteBrowserDialog : public Dialog {  public:  	RemoteBrowserDialog(const char *title); +	virtual ~RemoteBrowserDialog();  	virtual void open(); +	virtual void close();  	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);  	virtual void handleTickle(); @@ -56,7 +58,7 @@ protected:  	bool _updateList;  	Networking::Request *_workingRequest; -	bool _ignoreCallback; //? +	bool _ignoreCallback;  	void updateListing();  	void goUp(); | 
