Commit 66088a79 authored by Eike Ziller's avatar Eike Ziller
Browse files

EditorManager: Remove unnecessary use of defaultPath() in saveDocumentAs

Do not unnecessarily construct a path with document->defaultPath(). We
can just ask for the mime type(s) for the suggestedFileName without a

Change-Id: I1354756bd7760561a2bd9d39f491c5e1b6aeb3ab
Reviewed-by: default avatarDavid Schulz <>
parent 27425b62
......@@ -1926,11 +1926,17 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
Utils::MimeDatabase mdb;
const QString filter = Utils::MimeDatabase::allFiltersString();
QString selectedFilter;
QString filePath = document->filePath().toString();
if (filePath.isEmpty())
filePath = document->defaultPath() + QLatin1Char('/') + document->suggestedFileName();
if (!filePath.isEmpty())
const QString filePath = document->filePath().toString();
if (!filePath.isEmpty()) {
selectedFilter = mdb.mimeTypeForFile(filePath).filterString();
} else {
const QString suggestedName = document->suggestedFileName();
if (!suggestedName.isEmpty()) {
const QList<MimeType> types = mdb.mimeTypesForFileName(suggestedName);
if (!types.isEmpty())
selectedFilter = types.first().filterString();
if (selectedFilter.isEmpty())
selectedFilter = mdb.mimeTypeForName(document->mimeType()).filterString();
const QString &absoluteFilePath =
Supports Markdown
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