Don't report a user cancel when the user clicks on the 'Close' button after completion in the progress dialog

Originally committed to SVN as r5761.
This commit is contained in:
Thomas Goyne 2011-10-23 17:00:21 +00:00
parent 1364527681
commit f875938ee4

View file

@ -160,7 +160,7 @@ void DialogProgress::Run(std::tr1::function<void(agi::ProgressSink*)> task, int
DialogProgressSink ps(this); DialogProgressSink ps(this);
this->ps = &ps; this->ps = &ps;
new TaskRunner(task, &ps, this, priority); new TaskRunner(task, &ps, this, priority);
if (ShowModal()) if (!ShowModal())
throw agi::UserCancelException("Cancelled by user"); throw agi::UserCancelException("Cancelled by user");
} }
@ -208,7 +208,7 @@ void DialogProgress::OnComplete(wxThreadEvent &evt) {
// close button // close button
bool cancelled = ps->IsCancelled(); bool cancelled = ps->IsCancelled();
if (cancelled || log_output->IsEmpty()) if (cancelled || log_output->IsEmpty())
EndModal(cancelled); EndModal(!cancelled);
else else
cancel_button->SetLabelText(_("Close")); cancel_button->SetLabelText(_("Close"));
} }