Centralize cancelation of export

An export can be canceled by clicking on the status bar icon or by
executing export-cancel (e.g., via Document > Cancel Background
Process).

The centralized code kills the script and updates the status bar
icons.

No change in functionality intended.

Related commits: 70a71a82 and 01abab9a.
This commit is contained in:
Scott Kostyshak 2022-11-22 14:46:00 -05:00
parent 01abab9ad9
commit 3b30dbfca4
2 changed files with 14 additions and 6 deletions

View File

@ -835,10 +835,7 @@ void GuiView::checkCancelBackground()
Alert::prompt(ttl, msg, 1, 1,
_("&Cancel export"), _("Co&ntinue"));
if (ret == 0) {
Systemcall::killscript();
// stop busy signal immediately so that in the subsequent
// "Export canceled" prompt the status bar icons are accurate.
Q_EMIT scriptKilled();
cancelExport();
}
}
@ -4448,8 +4445,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
break;
}
case LFUN_EXPORT_CANCEL: {
Systemcall::killscript();
Q_EMIT scriptKilled();
cancelExport();
break;
}
case LFUN_BUFFER_SWITCH: {
@ -5099,6 +5095,15 @@ bool GuiView::lfunUiToggle(string const & ui_component)
}
void GuiView::cancelExport()
{
Systemcall::killscript();
// stop busy signal immediately so that in the subsequent
// "Export canceled" prompt the status bar icons are accurate.
Q_EMIT scriptKilled();
}
void GuiView::toggleFullScreen()
{
setWindowState(windowState() ^ Qt::WindowFullScreen);

View File

@ -408,6 +408,9 @@ private:
///
bool lfunUiToggle(std::string const & ui_component);
///
/// kill the script and hide export-in-progress status bar icons
void cancelExport();
///
void toggleFullScreen();
/// \return whether we did anything
bool insertLyXFile(docstring const & fname, bool ignorelang = false);