summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-08-13 19:57:04 (GMT)
committerMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-08-13 19:57:04 (GMT)
commit2eb0e01796de7a7e54568e9355e7b92f6c50e511 (patch)
tree4a973e82f648dfd21b71f03fa4320d12986ab208
parente6e0d90a84a037dc20911cb9041327895da67437 (diff)
Merge mimetypes with same name, sort by name
-rw-r--r--shell/shell.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/shell/shell.cpp b/shell/shell.cpp
index 5671af8..459b6a4 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -436,17 +436,23 @@ void Shell::fileOpen()
QMimeDatabase mimeDatabase;
QSet<QString> globPatterns;
- QStringList namePatterns;
+ QMap<QString, QStringList> namedGlobs;
foreach ( const QString &mimeName, m_fileformats ) {
QMimeType mimeType = mimeDatabase.mimeTypeForName( mimeName );
globPatterns.unite( mimeType.globPatterns().toSet() ) ;
- namePatterns.append( mimeType.comment() +
+ namedGlobs[ mimeType.comment() ].append( mimeType.globPatterns() );
+
+ }
+ QStringList namePatterns;
+ foreach( const QString &name, namedGlobs.keys()) {
+ namePatterns.append( name +
QStringLiteral(" (") +
- mimeType.globPatterns().join( QLatin1Char(' ') ) +
+ namedGlobs[name].join( QLatin1Char(' ') ) +
QStringLiteral(")")
);
}
+
namePatterns.prepend( i18n("All files (*)") );
namePatterns.prepend( i18n("All supported files (%1)", globPatterns.toList().join( QLatin1Char(' ') ) ) );
dlg->setNameFilters( namePatterns );