From b36ee3c2871929fd5b8caa52df640e7294fa5bf7 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 23 May 2024 12:08:41 +0200 Subject: [PATCH] Core: Enable starting of PluginInstallWizard with predefined archive The wizard usually allows users to chose an archive file path on the first page. The ExtensionManager would like to first download that archive and then launch this wizard without said first page. This change implements such shortcut. Change-Id: Ifc7ffcc04a59be97bd389697977dbd38714237c7 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/plugininstallwizard.cpp | 10 +++++++--- src/plugins/coreplugin/plugininstallwizard.h | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/coreplugin/plugininstallwizard.cpp b/src/plugins/coreplugin/plugininstallwizard.cpp index 34be2ceedf3..bc69e66913e 100644 --- a/src/plugins/coreplugin/plugininstallwizard.cpp +++ b/src/plugins/coreplugin/plugininstallwizard.cpp @@ -397,15 +397,19 @@ static bool copyPluginFile(const FilePath &src, const FilePath &dest) return true; } -bool PluginInstallWizard::exec() +bool PluginInstallWizard::exec(const FilePath &archive) { Wizard wizard(ICore::dialogParent()); wizard.setWindowTitle(Tr::tr("Install Plugin")); Data data; - auto filePage = new SourcePage(&data, &wizard); - wizard.addPage(filePage); + if (archive.isEmpty()) { + auto filePage = new SourcePage(&data, &wizard); + wizard.addPage(filePage); + } else { + data.sourcePath = archive; + } auto checkArchivePage = new CheckArchivePage(&data, &wizard); wizard.addPage(checkArchivePage); diff --git a/src/plugins/coreplugin/plugininstallwizard.h b/src/plugins/coreplugin/plugininstallwizard.h index 6f9b80af8a5..076661b83cc 100644 --- a/src/plugins/coreplugin/plugininstallwizard.h +++ b/src/plugins/coreplugin/plugininstallwizard.h @@ -3,6 +3,8 @@ #pragma once +#include + #include namespace Core { @@ -11,7 +13,7 @@ namespace Internal { class PluginInstallWizard { public: - static bool exec(); + static bool exec(const Utils::FilePath &archive = {}); }; } // namespace Internal