Debugger: Suggest a non-empty name when saving scratch buffers

The user needs some clue what buffer is about to be saved,
even if this is not a real file name.

Task-number: QTCREATORBUG-14602
Change-Id: I7d81a50079d8aa1a3b2ba63130d54515667a6663
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
This commit is contained in:
hjk
2015-07-20 17:07:28 +02:00
parent 5f9f95a451
commit e863393355

View File

@@ -3088,6 +3088,12 @@ void openTextEditor(const QString &titlePattern0, const QString &contents)
IEditor *editor = EditorManager::openEditorWithContents(
CC::K_DEFAULT_TEXT_EDITOR_ID, &titlePattern, contents.toUtf8(), QString(),
EditorManager::IgnoreNavigationHistory);
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor)) {
QString suggestion = titlePattern;
if (!suggestion.contains(QLatin1Char('.')))
suggestion.append(QLatin1String(".txt"));
textEditor->textDocument()->setSuggestedFileName(suggestion);
}
QTC_ASSERT(editor, return);
}