From 21c659400a6ecbf6b49986e4b46d02b914a0ea26 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 25 Nov 2022 10:00:19 +0100 Subject: [PATCH] StudioPlugin: Use custom openOpenProjectDialog() to only allow qmlproject MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QDS-2549 Change-Id: I7393877b5f0306eafc6dbd5b5919e6592e664c16 Reviewed-by: Henning Gründl --- .../studiowelcome/studiowelcomeplugin.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index faf17d5f627..5a48bc0148e 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -72,6 +72,16 @@ static bool useNewWelcomePage() return settings->value(newWelcomePageEntry, false).toBool(); } +static void openOpenProjectDialog() +{ + const FilePath path = Core::DocumentManager::useProjectsDirectory() + ? Core::DocumentManager::projectsDirectory() + : FilePath(); + const FilePaths files = Core::DocumentManager::getOpenFileNames("*.qmlproject", path); + if (!files.isEmpty()) + Core::ICore::openFiles(files, Core::ICore::None); +} + const char DO_NOT_SHOW_SPLASHSCREEN_AGAIN_KEY[] = "StudioSplashScreen"; const char DETAILED_USAGE_STATISTICS[] = "DetailedUsageStatistics"; @@ -194,16 +204,14 @@ public: Q_INVOKABLE void createProject() { - QTimer::singleShot(0, []() { + QTimer::singleShot(0, this, []() { ProjectExplorer::ProjectExplorerPlugin::openNewProjectDialog(); }); } Q_INVOKABLE void openProject() { - QTimer::singleShot(0, []() { - ProjectExplorer::ProjectExplorerPlugin::openOpenProjectDialog(); - }); + QTimer::singleShot(0, this, []() { openOpenProjectDialog(); }); } Q_INVOKABLE void openProjectAt(int row)