Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/shell/openprojectdialog.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 80 | { | |||
---|---|---|---|---|---|
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 << "*." + ShellExtension::getInstance()->projectFileExtension(); | ||
96 | filters << filterFormat.arg("*." + ShellExtension::getInstance()->projectFileExtension(), ShellExtension::getInstance()->projectFileDescription()); | 96 | filters << filterFormat.arg("*." + 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 | m_projectPlugins.insert(info.name(), info); | ||||
101 | | ||||
100 | QStringList filter = KPluginMetaData::readStringList(info.rawData(), QStringLiteral("X-KDevelop-ProjectFilesFilter")); | 102 | QStringList filter = KPluginMetaData::readStringList(info.rawData(), QStringLiteral("X-KDevelop-ProjectFilesFilter")); | ||
103 | | ||||
101 | // some project file manager plugins like KDevGenericManager have no file filter set | 104 | // some project file manager plugins like KDevGenericManager have no file filter set | ||
kossebau: Isn't this still missing to add the plugininfo to m_projectPlugins?
Adding that would be… | |||||
102 | if (filter.isEmpty()) { | 105 | if (filter.isEmpty()) { | ||
106 | m_genericProjectPlugins << info.name(); | ||||
103 | continue; | 107 | continue; | ||
104 | } | 108 | } | ||
105 | QString desc = info.value(QStringLiteral("X-KDevelop-ProjectFilesFilterDescription")); | 109 | QString desc = info.value(QStringLiteral("X-KDevelop-ProjectFilesFilterDescription")); | ||
106 | 110 | | |||
107 | m_projectFilters.insert(info.name(), filter); | 111 | m_projectFilters.insert(info.name(), filter); | ||
108 | m_projectPlugins.insert(info.name(), info); | | |||
109 | allEntry += filter; | 112 | allEntry += filter; | ||
110 | filters << filterFormat.arg(filter.join(QStringLiteral(" ")), desc); | 113 | filters << filterFormat.arg(filter.join(QStringLiteral(" ")), desc); | ||
111 | } | 114 | } | ||
112 | 115 | | |||
113 | if (useKdeFileDialog) | 116 | if (useKdeFileDialog) | ||
114 | filters.prepend(i18n("%1|All Project Files (%1)", allEntry.join(QStringLiteral(" ")))); | 117 | filters.prepend(i18n("%1|All Project Files (%1)", allEntry.join(QStringLiteral(" ")))); | ||
115 | 118 | | |||
116 | QUrl start = startUrl.isValid() ? startUrl : Core::self()->projectController()->projectsBaseDirectory(); | 119 | QUrl start = startUrl.isValid() ? startUrl : Core::self()->projectController()->projectsBaseDirectory(); | ||
▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Line(s) | 257 | if ( plugins.contains(QStringLiteral("<built-in>")) ) { | |||
255 | plugins.removeAll(QStringLiteral("<built-in>")); | 258 | plugins.removeAll(QStringLiteral("<built-in>")); | ||
256 | choices.append({i18n("Open existing file \"%1\"", file), "<built-in>", QString()}); | 259 | choices.append({i18n("Open existing file \"%1\"", file), "<built-in>", QString()}); | ||
257 | } | 260 | } | ||
258 | Q_FOREACH ( const auto& plugin, plugins ) { | 261 | Q_FOREACH ( const auto& plugin, plugins ) { | ||
259 | auto meta = m_projectPlugins.value(plugin); | 262 | auto meta = m_projectPlugins.value(plugin); | ||
260 | choices.append({file + QString(" (%1)").arg(plugin), meta.pluginId(), meta.iconName(), file}); | 263 | choices.append({file + QString(" (%1)").arg(plugin), meta.pluginId(), meta.iconName(), file}); | ||
261 | } | 264 | } | ||
262 | } | 265 | } | ||
263 | Q_FOREACH ( const auto& plugin, m_projectFilters.keys() ) { | 266 | // add managers that work in any case (e.g. KDevGenericManager) | ||
264 | qCDebug(SHELL) << plugin << m_projectFilters.value(plugin); | 267 | Q_FOREACH ( const auto& plugin, m_genericProjectPlugins ) { | ||
265 | if ( m_projectFilters.value(plugin).isEmpty() ) { | 268 | qCDebug(SHELL) << plugin; | ||
266 | // that works in any case | | |||
267 | auto meta = m_projectPlugins.value(plugin); | 269 | auto meta = m_projectPlugins.value(plugin); | ||
268 | choices.append({plugin, meta.pluginId(), meta.iconName()}); | 270 | choices.append({plugin, meta.pluginId(), meta.iconName()}); | ||
269 | } | 271 | } | ||
270 | } | | |||
271 | page->populateProjectFileCombo(choices); | 272 | page->populateProjectFileCombo(choices); | ||
272 | } | 273 | } | ||
273 | m_url.setPath( m_url.path() + '/' + m_url.fileName() + '.' + ShellExtension::getInstance()->projectFileExtension() ); | 274 | m_url.setPath( m_url.path() + '/' + m_url.fileName() + '.' + ShellExtension::getInstance()->projectFileExtension() ); | ||
274 | } else { | 275 | } else { | ||
275 | setAppropriate( projectInfoPage, false ); | 276 | setAppropriate( projectInfoPage, false ); | ||
276 | m_url = url; | 277 | m_url = url; | ||
277 | m_urlIsDirectory = false; | 278 | m_urlIsDirectory = false; | ||
278 | } | 279 | } | ||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |
Isn't this still missing to add the plugininfo to m_projectPlugins?
Adding that would be something that should always be done, and thus be before this if-else.