forked from qt-creator/qt-creator
EditorManager: Close documents instead of editors where appropriate
This is the first step in actually making "closeEditor(s)" close editors instead of documents. Change-Id: I02761e0cef950b8fc093f65a90df04a9a7550681 Reviewed-by: Daniel Teske <daniel.teske@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -1576,7 +1576,7 @@ void EditorManagerPrivate::closeEditorFromContextMenu()
|
||||
{
|
||||
IDocument *document = d->m_contextMenuEntry ? d->m_contextMenuEntry->document : 0;
|
||||
if (document)
|
||||
EditorManager::closeEditors(DocumentModel::editorsForDocument(document));
|
||||
EditorManager::closeDocument(document);
|
||||
}
|
||||
|
||||
void EditorManagerPrivate::closeOtherDocumentsFromContextMenu()
|
||||
@@ -2327,6 +2327,11 @@ QList<IEditor*> EditorManager::visibleEditors()
|
||||
return editors;
|
||||
}
|
||||
|
||||
bool EditorManager::closeDocument(IDocument *document, bool askAboutModifiedEditors)
|
||||
{
|
||||
return closeDocuments(QList<IDocument *>() << document, askAboutModifiedEditors);
|
||||
}
|
||||
|
||||
bool EditorManager::closeDocuments(const QList<IDocument *> &document, bool askAboutModifiedEditors)
|
||||
{
|
||||
return m_instance->closeEditors(DocumentModel::editorsForDocuments(document), askAboutModifiedEditors);
|
||||
|
||||
@@ -132,6 +132,7 @@ public:
|
||||
static void activateEditorForEntry(DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
|
||||
static IEditor *activateEditorForDocument(IDocument *document, OpenEditorFlags flags = 0);
|
||||
|
||||
static bool closeDocument(IDocument *document, bool askAboutModifiedEditors = true);
|
||||
static bool closeDocuments(const QList<IDocument *> &documents, bool askAboutModifiedEditors = true);
|
||||
static void closeDocument(DocumentModel::Entry *entry);
|
||||
static void closeOtherDocuments(IDocument *document);
|
||||
|
||||
Reference in New Issue
Block a user