| 79 | } |
| 80 | |
| 81 | void AppWizardPlugin::slotNewProject() |
| 82 | { |
| 83 | model()->refresh(); |
| 84 | |
| 85 | ScopedDialog<AppWizardDialog> dlg(core()->pluginController(), m_templatesModel); |
| 86 | |
| 87 | if (dlg->exec() == QDialog::Accepted) |
| 88 | { |
| 89 | QString project = createProject( dlg->appInfo() ); |
| 90 | if (!project.isEmpty()) |
| 91 | { |
| 92 | core()->projectController()->openProject(QUrl::fromLocalFile(project)); |
| 93 | |
| 94 | KConfig templateConfig(dlg->appInfo().appTemplate); |
| 95 | KConfigGroup general(&templateConfig, QStringLiteral("General")); |
| 96 | const QStringList fileArgs = |
| 97 | general.readEntry("ShowFilesAfterGeneration").split(QLatin1Char(','), Qt::SkipEmptyParts); |
| 98 | for (const auto& fileArg : fileArgs) { |
| 99 | QString file = KMacroExpander::expandMacros(fileArg.trimmed(), m_variables); |
| 100 | if (QDir::isRelativePath(file)) { |
| 101 | file = m_variables[QStringLiteral("PROJECTDIR")] + QLatin1Char('/') + file; |
| 102 | } |
| 103 | core()->documentController()->openDocument(QUrl::fromUserInput(file)); |
| 104 | } |
| 105 | } else { |
| 106 | const QString messageText = i18n("Could not create project from template."); |
| 107 | auto* message = new Sublime::Message(messageText, Sublime::Message::Error); |
| 108 | ICore::self()->uiController()->postMessage(message); |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | namespace |
| 114 | { |
nothing calls this directly
no test coverage detected