Changeset View
Changeset View
Standalone View
Standalone View
plugins/appwizard/projectselectionpage.cpp
Show First 20 Lines • Show All 300 Lines • ▼ Show 20 Line(s) | 298 | { | |||
---|---|---|---|---|---|
301 | return res == KMessageBox::Yes; | 301 | return res == KMessageBox::Yes; | ||
302 | } | 302 | } | ||
303 | } | 303 | } | ||
304 | return true; | 304 | return true; | ||
305 | } | 305 | } | ||
306 | 306 | | |||
307 | void ProjectSelectionPage::loadFileClicked() | 307 | void ProjectSelectionPage::loadFileClicked() | ||
308 | { | 308 | { | ||
309 | QString filter = QStringLiteral("application/x-desktop application/x-bzip-compressed-tar application/zip"); | 309 | const QStringList supportedMimeTypes { | ||
310 | const QString fileName = QFileDialog::getOpenFileName(this, i18n("Load Template From File"), QString(), filter); | 310 | QStringLiteral("application/x-desktop"), | ||
311 | if (!fileName.isEmpty()) | 311 | QStringLiteral("application/x-bzip-compressed-tar"), | ||
312 | { | 312 | QStringLiteral("application/zip") | ||
313 | }; | ||||
314 | QFileDialog fileDialog(this, i18n("Load Template From File")); | ||||
315 | fileDialog.setMimeTypeFilters(supportedMimeTypes); | ||||
316 | fileDialog.setFileMode(QFileDialog::ExistingFiles); | ||||
317 | | ||||
318 | if (!fileDialog.exec()) { | ||||
319 | return; | ||||
320 | } | ||||
321 | | ||||
322 | for (const auto& fileName : fileDialog.selectedFiles()) { | ||||
313 | QString destination = m_templatesModel->loadTemplateFile(fileName); | 323 | QString destination = m_templatesModel->loadTemplateFile(fileName); | ||
314 | QModelIndexList indexes = m_templatesModel->templateIndexes(destination); | 324 | QModelIndexList indexes = m_templatesModel->templateIndexes(destination); | ||
315 | if (indexes.size() > 2) | 325 | if (indexes.size() > 2) | ||
316 | { | 326 | { | ||
317 | m_listView->setCurrentIndex(indexes.at(1)); | 327 | m_listView->setCurrentIndex(indexes.at(1)); | ||
318 | ui->templateType->setCurrentIndex(indexes.at(2).row()); | 328 | ui->templateType->setCurrentIndex(indexes.at(2).row()); | ||
319 | } | 329 | } | ||
320 | } | 330 | } | ||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |