summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/editortoolbar.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2014-08-19 16:15:57 +0200
committerEike Ziller <eike.ziller@digia.com>2014-08-22 08:54:34 +0200
commit6772ba622a8ae37161571143005d45db180b8275 (patch)
treefdead16fe54fd7c583e074f7ea2a0df6be26f6b7 /src/plugins/coreplugin/editortoolbar.cpp
parent8213a88d3e6a3cb0952918095e5ee6543f8fd6a3 (diff)
downloadqt-creator-6772ba622a8ae37161571143005d45db180b8275.tar.gz
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>
Diffstat (limited to 'src/plugins/coreplugin/editortoolbar.cpp')
-rw-r--r--src/plugins/coreplugin/editortoolbar.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp
index acec12c2e1..7a3240e3d2 100644
--- a/src/plugins/coreplugin/editortoolbar.cpp
+++ b/src/plugins/coreplugin/editortoolbar.cpp
@@ -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()