Commit 013e10fd authored by Eike Ziller's avatar Eike Ziller
Browse files

MimeDatabase: Add allGlobPatterns and allFiltersString

Change-Id: I255d1ef3140b220de9bdc279788abf3fecb16af9
Reviewed-by: default avatarDavid Schulz <>
parent b4f494f6
......@@ -40,6 +40,7 @@
#include "mimeprovider_p.h"
#include "mimetype_p.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QSet>
......@@ -51,6 +52,8 @@
#include <algorithm>
#include <functional>
static const char ALL_FILES_FILTER[] = QT_TRANSLATE_NOOP("Core", "All Files (*)");
using namespace Utils;
using namespace Utils::Internal;
......@@ -311,6 +314,36 @@ void MimeDatabase::addMimeTypes(const QString &fileName)
QString MimeDatabase::allFiltersString(QString *allFilesFilter)
MimeDatabase mdb;
QSet<QString> uniqueFilters;
foreach (const MimeType &mt, mdb.allMimeTypes())
QStringList filters;
foreach (const QString &filter, uniqueFilters)
static const QString allFiles =
QCoreApplication::translate("Core", ALL_FILES_FILTER);
if (allFilesFilter)
*allFilesFilter = allFiles;
// Prepend all files filter
return filters.join(QLatin1String(";;"));
QStringList MimeDatabase::allGlobPatterns()
MimeDatabase mdb;
QStringList patterns;
foreach (const MimeType &mt, mdb.allMimeTypes())
return patterns;
\fn MimeType MimeDatabase::mimeTypeForName(const QString &nameOrAlias) const;
Returns a MIME type for \a nameOrAlias or an invalid one if none found.
......@@ -84,6 +84,8 @@ public:
// Qt Creator additions
static void addMimeTypes(const QString &fileName);
static QString allFiltersString(QString *allFilesFilter = 0);
static QStringList allGlobPatterns();
Internal::MimeDatabasePrivate *d;
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