From 76f78654c37e5171c830c49c6ebf3a3d136a5b40 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 30 Mar 2022 14:54:20 +0200 Subject: [PATCH] Gui: Added 'open Addon Manager' to Help message box - issue #6514 --- src/Gui/MainWindow.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index a0f7e258a4..49bd3fc5d0 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -48,6 +48,7 @@ # include # include # include +# include #endif #include @@ -703,9 +704,18 @@ void MainWindow::showDocumentation(const QString& help) PyErr_Clear(); QUrl url(help); if (url.scheme().isEmpty()) { - QMessageBox::critical(getMainWindow(), tr("Help addon needed!"), - tr("The Help system of %1 is now handled by the \"Help\" addon. " - "Install it with menu Tools > Addons Manager").arg(QString(qApp->applicationName()))); + QMessageBox msgBox(getMainWindow()); + msgBox.setWindowTitle(tr("Help addon needed!")); + msgBox.setText(tr("The Help system of %1 is now handled by the \"Help\" addon. " + "It can easily be installed via the Addons Manager").arg(QString(qApp->applicationName()))); + QAbstractButton* pButtonAddonMgr = msgBox.addButton(tr("Open Addon Manager"), QMessageBox::YesRole); + msgBox.addButton(QMessageBox::Ok); + msgBox.exec(); + if (msgBox.clickedButton() == pButtonAddonMgr) { + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Addons"); + hGrp->SetASCII("SelectedAddon", "Help"); + Gui::Command::doCommand(Gui::Command::Gui,"Gui.runCommand('Std_AddonMgr',0)"); + } } else { QDesktopServices::openUrl(url);