Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/shell/openprojectdialog.cpp
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 85 | if (helpButton) { | |||
---|---|---|---|---|---|
87 | delete helpButton; | 87 | delete helpButton; | ||
88 | } | 88 | } | ||
89 | 89 | | |||
90 | const bool useKdeFileDialog = qEnvironmentVariableIsSet("KDE_FULL_SESSION"); | 90 | const bool useKdeFileDialog = qEnvironmentVariableIsSet("KDE_FULL_SESSION"); | ||
91 | QStringList filters, allEntry; | 91 | QStringList filters, allEntry; | ||
92 | QString filterFormat = useKdeFileDialog | 92 | QString filterFormat = useKdeFileDialog | ||
93 | ? QStringLiteral("%1|%2 (%1)") | 93 | ? QStringLiteral("%1|%2 (%1)") | ||
94 | : QStringLiteral("%2 (%1)"); | 94 | : QStringLiteral("%2 (%1)"); | ||
95 | allEntry << "*." + ShellExtension::getInstance()->projectFileExtension(); | 95 | allEntry << QLatin1String("*.") + ShellExtension::getInstance()->projectFileExtension(); | ||
96 | filters << filterFormat.arg("*." + ShellExtension::getInstance()->projectFileExtension(), ShellExtension::getInstance()->projectFileDescription()); | 96 | filters << filterFormat.arg(QLatin1String("*.") + ShellExtension::getInstance()->projectFileExtension(), ShellExtension::getInstance()->projectFileDescription()); | ||
97 | QVector<KPluginMetaData> plugins = ICore::self()->pluginController()->queryExtensionPlugins(QStringLiteral("org.kdevelop.IProjectFileManager")); | 97 | QVector<KPluginMetaData> plugins = ICore::self()->pluginController()->queryExtensionPlugins(QStringLiteral("org.kdevelop.IProjectFileManager")); | ||
98 | foreach(const KPluginMetaData& info, plugins) | 98 | foreach(const KPluginMetaData& info, plugins) | ||
99 | { | 99 | { | ||
100 | QStringList filter = KPluginMetaData::readStringList(info.rawData(), QStringLiteral("X-KDevelop-ProjectFilesFilter")); | 100 | QStringList filter = KPluginMetaData::readStringList(info.rawData(), QStringLiteral("X-KDevelop-ProjectFilesFilter")); | ||
101 | QString desc = info.value(QStringLiteral("X-KDevelop-ProjectFilesFilterDescription")); | 101 | QString desc = info.value(QStringLiteral("X-KDevelop-ProjectFilesFilterDescription")); | ||
102 | 102 | | |||
103 | m_projectFilters.insert(info.name(), filter); | 103 | m_projectFilters.insert(info.name(), filter); | ||
104 | m_projectPlugins.insert(info.name(), info); | 104 | m_projectPlugins.insert(info.name(), info); | ||
▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Line(s) | 242 | } else { | |||
244 | m_fileList << url.fileName(); | 244 | m_fileList << url.fileName(); | ||
245 | } | 245 | } | ||
246 | // Now find a manager for the file(s) in our filelist. | 246 | // Now find a manager for the file(s) in our filelist. | ||
247 | QVector<ProjectFileChoice> choices; | 247 | QVector<ProjectFileChoice> choices; | ||
248 | Q_FOREACH ( const auto& file, m_fileList ) { | 248 | Q_FOREACH ( const auto& file, m_fileList ) { | ||
249 | auto plugins = projectManagerForFile(file); | 249 | auto plugins = projectManagerForFile(file); | ||
250 | if ( plugins.contains(QStringLiteral("<built-in>")) ) { | 250 | if ( plugins.contains(QStringLiteral("<built-in>")) ) { | ||
251 | plugins.removeAll(QStringLiteral("<built-in>")); | 251 | plugins.removeAll(QStringLiteral("<built-in>")); | ||
252 | choices.append({i18n("Open existing file \"%1\"", file), "<built-in>", QString()}); | 252 | choices.append({i18n("Open existing file \"%1\"", file), QStringLiteral("<built-in>"), QString()}); | ||
253 | } | 253 | } | ||
254 | Q_FOREACH ( const auto& plugin, plugins ) { | 254 | Q_FOREACH ( const auto& plugin, plugins ) { | ||
255 | auto meta = m_projectPlugins.value(plugin); | 255 | auto meta = m_projectPlugins.value(plugin); | ||
256 | choices.append({file + QString(" (%1)").arg(plugin), meta.pluginId(), meta.iconName(), file}); | 256 | choices.append({file + QLatin1String(" (") + plugin + QLatin1Char(')'), meta.pluginId(), meta.iconName(), file}); | ||
257 | } | 257 | } | ||
258 | } | 258 | } | ||
259 | Q_FOREACH ( const auto& plugin, m_projectFilters.keys() ) { | 259 | Q_FOREACH ( const auto& plugin, m_projectFilters.keys() ) { | ||
260 | qCDebug(SHELL) << plugin << m_projectFilters.value(plugin); | 260 | qCDebug(SHELL) << plugin << m_projectFilters.value(plugin); | ||
261 | if ( m_projectFilters.value(plugin).isEmpty() ) { | 261 | if ( m_projectFilters.value(plugin).isEmpty() ) { | ||
262 | // that works in any case | 262 | // that works in any case | ||
263 | auto meta = m_projectPlugins.value(plugin); | 263 | auto meta = m_projectPlugins.value(plugin); | ||
264 | choices.append({plugin, meta.pluginId(), meta.iconName()}); | 264 | choices.append({plugin, meta.pluginId(), meta.iconName()}); | ||
265 | } | 265 | } | ||
266 | } | 266 | } | ||
267 | page->populateProjectFileCombo(choices); | 267 | page->populateProjectFileCombo(choices); | ||
268 | } | 268 | } | ||
269 | m_url.setPath( m_url.path() + '/' + m_url.fileName() + '.' + ShellExtension::getInstance()->projectFileExtension() ); | 269 | m_url.setPath( m_url.path() + QLatin1Char('/') + m_url.fileName() + QLatin1Char('.') + ShellExtension::getInstance()->projectFileExtension() ); | ||
270 | } else { | 270 | } else { | ||
271 | setAppropriate( projectInfoPage, false ); | 271 | setAppropriate( projectInfoPage, false ); | ||
272 | m_url = url; | 272 | m_url = url; | ||
273 | m_urlIsDirectory = false; | 273 | m_urlIsDirectory = false; | ||
274 | } | 274 | } | ||
275 | validateProjectInfo(); | 275 | validateProjectInfo(); | ||
276 | setValid( openPage, true ); | 276 | setValid( openPage, true ); | ||
277 | } | 277 | } | ||
Show All 36 Lines | |||||
314 | } | 314 | } | ||
315 | 315 | | |||
316 | void OpenProjectDialog::validateProjectManager( const QString& manager, const QString & fileName ) | 316 | void OpenProjectDialog::validateProjectManager( const QString& manager, const QString & fileName ) | ||
317 | { | 317 | { | ||
318 | m_projectManager = manager; | 318 | m_projectManager = manager; | ||
319 | 319 | | |||
320 | if ( m_urlIsDirectory ) | 320 | if ( m_urlIsDirectory ) | ||
321 | { | 321 | { | ||
322 | m_selected = m_url.resolved( QUrl("./" + fileName) ); | 322 | m_selected = m_url.resolved( QUrl(QLatin1String("./") + fileName) ); | ||
323 | } | 323 | } | ||
324 | 324 | | |||
325 | validateProjectInfo(); | 325 | validateProjectInfo(); | ||
326 | } | 326 | } | ||
327 | 327 | | |||
328 | QUrl OpenProjectDialog::projectFileUrl() const | 328 | QUrl OpenProjectDialog::projectFileUrl() const | ||
329 | { | 329 | { | ||
330 | return m_url; | 330 | return m_url; | ||
Show All 32 Lines |