MCPcopy Create free account
hub / github.com/KDE/kdevelop / OpenProjectDialog

Method OpenProjectDialog

kdevplatform/shell/openprojectdialog.cpp:76–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74{
75
76OpenProjectDialog::OpenProjectDialog(bool fetch, const QUrl& startUrl,
77 const QUrl& repoUrl, IPlugin* vcsOrProviderPlugin,
78 QWidget* parent)
79 : KAssistantDialog( parent )
80 , m_urlIsDirectory(false)
81 , sourcePage(nullptr)
82 , openPage(nullptr)
83 , projectInfoPage(nullptr)
84{
85 if (!KDevelop::restoreAndAutoSaveGeometry(*this, configGroupName(), QStringLiteral("KDE"))) {
86 resize(QSize(700, 500));
87 }
88
89 // KAssistantDialog creates a help button by default, no option to prevent that
90 auto helpButton = button(QDialogButtonBox::Help);
91 if (helpButton) {
92 buttonBox()->removeButton(helpButton);
93 delete helpButton;
94 }
95
96 const bool useKdeFileDialog = qEnvironmentVariableIsSet("KDE_FULL_SESSION");
97 // Since b736adda01a19d80b2f4fb5553c1288eaca2bec5 (Make open project dialog work properly again)
98 // filters, allEntry, filterFormat (now makeFileFilter) only used with "KdeFileDialog"
99 QList<KFileFilter> filters;
100 QStringList allEntry;
101 auto makeFileFilter = [](const QString& description, const QStringList& filePatterns) {
102 const auto label = QLatin1String("%1 (%2)").arg(description, filePatterns.join(QLatin1Char(' ')));
103 return KFileFilter(label, filePatterns, {});
104 };
105 if (useKdeFileDialog) {
106 const QString projectFilePattern = QLatin1String("*.") + ShellExtension::getInstance()->projectFileExtension();
107 allEntry << projectFilePattern;
108 filters << makeFileFilter(ShellExtension::getInstance()->projectFileDescription(), {projectFilePattern});
109 }
110 const QVector<KPluginMetaData> plugins = ICore::self()->pluginController()->queryExtensionPlugins(QStringLiteral("org.kdevelop.IProjectFileManager"));
111 for (const KPluginMetaData& info : plugins) {
112 m_projectPlugins.insert(info.name(), info);
113
114 const auto filter = info.value(QStringLiteral("X-KDevelop-ProjectFilesFilter"), QStringList());
115
116 // some project file manager plugins like KDevGenericManager have no file filter set
117 if (filter.isEmpty()) {
118 m_genericProjectPlugins << info.name();
119 continue;
120 }
121
122 m_projectFilters.insert(info.name(), filter);
123
124 if (useKdeFileDialog) {
125 const QString desc = info.value(QStringLiteral("X-KDevelop-ProjectFilesFilterDescription"));
126 allEntry += filter;
127 filters << makeFileFilter(desc, filter);
128 }
129 }
130
131 if (useKdeFileDialog)
132 filters.prepend(makeFileFilter(i18nc("@item:inlistbox", "All Project Files"), allEntry));
133

Callers

nothing calls this directly

Calls 15

buttonFunction · 0.85
KFileFilterClass · 0.85
QStringListClass · 0.85
joinMethod · 0.80
projectFileExtensionMethod · 0.80
pluginControllerMethod · 0.80
projectsBaseDirectoryMethod · 0.80
projectControllerMethod · 0.80
configGroupNameFunction · 0.70
queryExtensionPluginsMethod · 0.45

Tested by

no test coverage detected