+ when running a bound macro check if file exists, proper unicode handling of macros in customize dialog

This commit is contained in:
wmayer
2015-10-08 12:37:30 +02:00
parent 60cffb685e
commit 19bbce6413
4 changed files with 77 additions and 36 deletions

View File

@@ -708,10 +708,17 @@ void MacroCommand::activated(int iMsg)
QDir d(QString::fromUtf8(cMacroPath.c_str()));
QFileInfo fi(d, QString::fromUtf8(sScriptName));
Application::Instance->macroManager()->run(MacroManager::File, fi.filePath().toUtf8());
// after macro run recalculate the document
if (Application::Instance->activeDocument())
Application::Instance->activeDocument()->getDocument()->recompute();
if (!fi.exists()) {
QMessageBox::critical(Gui::getMainWindow(),
qApp->translate("Gui::MacroCommand", "Macro file doesn't exist"),
qApp->translate("Gui::MacroCommand", "No such macro file: '%1'").arg(fi.absoluteFilePath()));
}
else {
Application::Instance->macroManager()->run(MacroManager::File, fi.filePath().toUtf8());
// after macro run recalculate the document
if (Application::Instance->activeDocument())
Application::Instance->activeDocument()->getDocument()->recompute();
}
}
Action * MacroCommand::createAction(void)