diff --git a/plugins/appwizard/projectselectionpage.cpp b/plugins/appwizard/projectselectionpage.cpp --- a/plugins/appwizard/projectselectionpage.cpp +++ b/plugins/appwizard/projectselectionpage.cpp @@ -304,10 +304,20 @@ void ProjectSelectionPage::loadFileClicked() { - QString filter = QStringLiteral("application/x-desktop application/x-bzip-compressed-tar application/zip"); - const QString fileName = QFileDialog::getOpenFileName(this, i18n("Load Template From File"), QString(), filter); - if (!fileName.isEmpty()) - { + const QStringList supportedMimeTypes { + QStringLiteral("application/x-desktop"), + QStringLiteral("application/x-bzip-compressed-tar"), + QStringLiteral("application/zip") + }; + QFileDialog fileDialog(this, i18n("Load Template From File")); + fileDialog.setMimeTypeFilters(supportedMimeTypes); + fileDialog.setFileMode(QFileDialog::ExistingFiles); + + if (!fileDialog.exec()) { + return; + } + + for (const auto& fileName : fileDialog.selectedFiles()) { QString destination = m_templatesModel->loadTemplateFile(fileName); QModelIndexList indexes = m_templatesModel->templateIndexes(destination); if (indexes.size() > 2) diff --git a/shell/settings/templatepage.cpp b/shell/settings/templatepage.cpp --- a/shell/settings/templatepage.cpp +++ b/shell/settings/templatepage.cpp @@ -23,13 +23,14 @@ #include #include -#include #include #include #include #include #include +#include + TemplatePage::TemplatePage (KDevelop::ITemplateProvider* provider, QWidget* parent) : QWidget (parent), m_provider(provider) { @@ -66,10 +67,15 @@ void TemplatePage::loadFromFile() { - const QString filter = m_provider->supportedMimeTypes().join(QStringLiteral(";;")); - const QString filename = QFileDialog::getOpenFileName(this, QString(), QString(), filter); - if (!filename.isEmpty()) { - m_provider->loadTemplate(filename); + QFileDialog fileDialog(this); + fileDialog.setMimeTypeFilters(m_provider->supportedMimeTypes()); + fileDialog.setFileMode(QFileDialog::ExistingFiles); + if (!fileDialog.exec()) { + return; + } + + for (const auto& file : fileDialog.selectedFiles()) { + m_provider->loadTemplate(file); } m_provider->reload();