Editor manager: Fix selected filter in Save as...

Make sure to ask mime database only for mime type of non-empty paths.

Change-Id: I5de896021c8438f17b1c5368674493337ccee0c4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Eike Ziller
2015-02-24 14:53:11 +01:00
parent 6c49356471
commit d156103d8d

View File

@@ -1696,8 +1696,12 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
Utils::MimeDatabase mdb;
const QString filter = Utils::MimeDatabase::allFiltersString();
QString selectedFilter =
mdb.mimeTypeForFile(document->filePath().toFileInfo()).filterString();
QString selectedFilter;
QString filePath = document->filePath().toString();
if (filePath.isEmpty())
filePath = document->defaultPath() + QLatin1Char('/') + document->suggestedFileName();
if (!filePath.isEmpty())
selectedFilter = mdb.mimeTypeForFile(filePath).filterString();
if (selectedFilter.isEmpty())
selectedFilter = mdb.mimeTypeForName(document->mimeType()).filterString();
const QString &absoluteFilePath =