Avoid emptry entries in project files filter list
ClosedPublic

Authored by kossebau on Apr 3 2018, 10:22 PM.

Details

Summary

Some project file manager plugins like KDevGenericManager do not have a list
of project file name filters. They need to be skipped when accumulating the
lists of file name filters instead of adding empty entries.

Test Plan

Use "Open/Import Project..." action when running in environment with KDE_FULL_SESSION
being set and select the dropdown list of the filter selection.
No more empty entries after this patch.

Diff Detail

Repository
R32 KDevelop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau created this revision.Apr 3 2018, 10:22 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptApr 3 2018, 10:22 PM
kossebau requested review of this revision.Apr 3 2018, 10:22 PM

Target: 5.2 branch

mwolff accepted this revision.Apr 4 2018, 9:53 AM
mwolff added a subscriber: mwolff.

add a comment explaining why this happens, but otherwise lgtm

This revision is now accepted and ready to land.Apr 4 2018, 9:53 AM
This revision was automatically updated to reflect the committed changes.

I think this may prevent KDevGenericManager from being selectable at all. Later in OpenProjectDialog::validateOpenUrl() we check for empty filters to add plugins that do not need a specific file:

Q_FOREACH ( const auto& plugin, m_projectFilters.keys() ) {
    qCDebug(SHELL) << plugin << m_projectFilters.value(plugin);
    if ( m_projectFilters.value(plugin).isEmpty() ) {
        // that works in any case
        auto meta = m_projectPlugins.value(plugin);
        choices.append({plugin, meta.pluginId(), meta.iconName()});
    }
}