forked from qt-creator/qt-creator
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 path. Change-Id: I1354756bd7760561a2bd9d39f491c5e1b6aeb3ab Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -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 =
|
||||
|
Reference in New Issue
Block a user