forked from qt-creator/qt-creator
Fix closing editor with ctrl+w or "x" or File > Close
If there are other editors on the document visible in some split, it should not close the document, but only the editor. Task-number: QTCREATORBUG-9346 Change-Id: Idce1ae2f518d4c6e875d86f9831d41c46c06361c Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -233,12 +233,8 @@ void EditorToolBar::setCloseSplitIcon(const QIcon &icon)
|
||||
|
||||
void EditorToolBar::closeEditor()
|
||||
{
|
||||
IEditor *current = EditorManager::currentEditor();
|
||||
if (!current)
|
||||
return;
|
||||
|
||||
if (d->m_isStandalone)
|
||||
EditorManager::closeEditor(current);
|
||||
EditorManager::slotCloseCurrentEditorOrDocument();
|
||||
emit closeClicked();
|
||||
}
|
||||
|
||||
@@ -314,13 +310,18 @@ void EditorToolBar::changeActiveEditor(int row)
|
||||
|
||||
void EditorToolBar::listContextMenu(QPoint pos)
|
||||
{
|
||||
DocumentModel::Entry *entry = DocumentModel::entryAtRow(
|
||||
d->m_editorList->currentIndex());
|
||||
QMenu menu;
|
||||
EditorManager::addSaveAndCloseEditorActions(&menu, entry);
|
||||
menu.addSeparator();
|
||||
EditorManager::addNativeDirAndOpenWithActions(&menu, entry);
|
||||
menu.exec(d->m_editorList->mapToGlobal(pos));
|
||||
if (d->m_isStandalone) {
|
||||
IEditor *editor = EditorManager::currentEditor();
|
||||
DocumentModel::Entry entry;
|
||||
entry.document = editor ? editor->document() : 0;
|
||||
QMenu menu;
|
||||
EditorManager::addSaveAndCloseEditorActions(&menu, &entry, editor);
|
||||
menu.addSeparator();
|
||||
EditorManager::addNativeDirAndOpenWithActions(&menu, &entry);
|
||||
menu.exec(d->m_editorList->mapToGlobal(pos));
|
||||
} else {
|
||||
emit listContextMenuRequested(d->m_editorList->mapToGlobal(pos));
|
||||
}
|
||||
}
|
||||
|
||||
void EditorToolBar::makeEditorWritable()
|
||||
|
||||
Reference in New Issue
Block a user