Gui: Set status bit when restoring is initiated by the user from the UI

This commit is contained in:
Abdullah Tahiri
2022-12-19 17:15:07 +01:00
committed by abdullahtahiriyo
parent 6cb616aeb8
commit 793a70b0e2
2 changed files with 17 additions and 8 deletions

View File

@@ -595,7 +595,10 @@ void BrowserView::urlFilter(const QUrl & url)
}
// Gui::Command::doCommand(Gui::Command::Gui,"execfile('%s')",(const char*) fi.absoluteFilePath(). toLocal8Bit());
QString filename = Base::Tools::escapeEncodeFilename(fi.absoluteFilePath());
// Set flag indicating that this load/restore has been initiated by the user (not by a macro)
Gui::Application::Instance->setStatus(Gui::Application::UserInitiatedOpenDocument, true);
Gui::Command::doCommand(Gui::Command::Gui,"with open('%s') as file:\n\texec(file.read())",(const char*) filename.toUtf8());
Gui::Application::Instance->setStatus(Gui::Application::UserInitiatedOpenDocument, false);
}
catch (const Base::Exception& e) {
QMessageBox::critical(this, tr("Error"), QString::fromUtf8(e.what()));