Commit 33c3e1cb authored by dt's avatar dt
Browse files

Add a "All Projects" Filter to the Load Project dialog

parent f6072712
......@@ -455,7 +455,7 @@ bool MimeType::setPreferredSuffix(const QString &s)
return true;
}
static QString formatFilterString(const QString &description, const QList<QRegExp> &globs)
QString MimeType::formatFilterString(const QString &description, const QList<QRegExp> &globs)
{
QString rc;
if (globs.empty()) // Binary files
......
......@@ -176,6 +176,8 @@ public:
friend QDebug operator<<(QDebug d, const MimeType &mt);
static QString formatFilterString(const QString &description, const QList<QRegExp> &globs);
private:
explicit MimeType(const MimeTypeData &d);
unsigned matchesFileBySuffix(Internal::FileMatchContext &c) const;
......
......@@ -87,6 +87,8 @@ QList<ProjectFileFactory *> ProjectFileFactory::createFactories(QString *filterS
QList<IProjectManager*> projectManagers =
ExtensionSystem::PluginManager::instance()->getObjects<IProjectManager>();
QList<QRegExp> allGlobPatterns;
const QString filterSeparator = QLatin1String(";;");
filterString->clear();
foreach (IProjectManager *manager, projectManagers) {
......@@ -94,8 +96,13 @@ QList<ProjectFileFactory *> ProjectFileFactory::createFactories(QString *filterS
if (!filterString->isEmpty())
*filterString += filterSeparator;
const QString mimeType = manager->mimeType();
const QString pFilterString = Core::ICore::instance()->mimeDatabase()->findByType(mimeType).filterString();
Core::MimeType mime = Core::ICore::instance()->mimeDatabase()->findByType(mimeType);
const QString pFilterString = mime.filterString();
allGlobPatterns.append(mime.globPatterns());
*filterString += pFilterString;
}
QString allProjectFilter = Core::MimeType::formatFilterString(tr("All Projects"), allGlobPatterns);
allProjectFilter.append(filterSeparator);
filterString->prepend(allProjectFilter);
return rc;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment