Gui: Do not allow to activate disabled workbench

Change Command::_assureWorkbench to check if the passed workbench is
disabled or not. If yes then do nothing.

This fixes issue 21477.

Hint: The method Application::activateWorkbench() is still able to
activate a disabled workbench
This commit is contained in:
wmayer
2026-02-27 23:45:37 +01:00
committed by Kacper Donat
parent 92ebf00cc4
commit d588e89d1d
+6 -2
View File
@@ -49,6 +49,7 @@
#include "BitmapFactory.h"
#include "Control.h"
#include "Dialogs/DlgUndoRedo.h"
#include "PreferencePages/DlgSettingsWorkbenchesImp.h"
#include "Document.h"
#include "frameobject.h"
#include "Macro.h"
@@ -821,8 +822,11 @@ std::string Command::_assureWorkbench(const char* file, int line, const char* sN
return actName;
}
// else - switch to new WB
_doCommand(file, line, Gui, "Gui.activateWorkbench('%s')", sName);
QStringList disabledWbNames = DlgSettingsWorkbenchesImp::getDisabledWorkbenches();
if (!disabledWbNames.contains(QString::fromUtf8(sName))) {
// else - switch to new WB
_doCommand(file, line, Gui, "Gui.activateWorkbench('%s')", sName);
}
return actName;
}