forked from qt-creator/qt-creator
Move displayName from IEditor to IDocument
The display name is not editor instance specific, but belongs to the document. Change-Id: I3c936f04a86e10e6ca30063d85036d85b4b5880e Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -174,16 +174,6 @@ void ShortCutManager::updateActions(Core::IEditor* currentEditor)
|
||||
{
|
||||
int openedCount = Core::ICore::editorManager()->openedEditorsModel()->openDocumentCount();
|
||||
|
||||
QString fileName;
|
||||
if (currentEditor) {
|
||||
if (!currentEditor->document()->filePath().isEmpty()) {
|
||||
QFileInfo fileInfo(currentEditor->document()->filePath());
|
||||
fileName = fileInfo.fileName();
|
||||
} else {
|
||||
fileName = currentEditor->displayName();
|
||||
}
|
||||
}
|
||||
|
||||
m_saveAction.setEnabled(currentEditor != 0 && currentEditor->document()->isModified());
|
||||
m_saveAsAction.setEnabled(currentEditor != 0 && currentEditor->document()->isSaveAsAllowed());
|
||||
m_revertToSavedAction.setEnabled(currentEditor != 0
|
||||
@@ -191,8 +181,8 @@ void ShortCutManager::updateActions(Core::IEditor* currentEditor)
|
||||
&& currentEditor->document()->isModified());
|
||||
|
||||
QString quotedName;
|
||||
if (!fileName.isEmpty())
|
||||
quotedName = '"' + fileName + '"';
|
||||
if (currentEditor)
|
||||
quotedName = '"' + currentEditor->document()->displayName() + '"';
|
||||
|
||||
m_saveAsAction.setText(tr("Save %1 As...").arg(quotedName));
|
||||
m_saveAction.setText(tr("&Save %1").arg(quotedName));
|
||||
|
||||
Reference in New Issue
Block a user