forked from qt-creator/qt-creator
make "close all" work with fake-restored editors
This commit is contained in:
@@ -628,6 +628,7 @@ QList<IFile *> EditorManager::filesForEditors(QList<IEditor *> editors) const
|
|||||||
|
|
||||||
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
|
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
|
||||||
{
|
{
|
||||||
|
m_d->m_editorModel->removeAllRestoredEditors();
|
||||||
return closeEditors(openedEditors(), askAboutModifiedEditors);
|
return closeEditors(openedEditors(), askAboutModifiedEditors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,17 @@ void EditorModel::removeEditor(IEditor *editor)
|
|||||||
disconnect(editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
disconnect(editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorModel::removeAllRestoredEditors()
|
||||||
|
{
|
||||||
|
for (int i = m_editors.count()-1; i >= 0; --i) {
|
||||||
|
if (!m_editors.at(i).editor) {
|
||||||
|
beginRemoveRows(QModelIndex(), i, i);
|
||||||
|
m_editors.removeAt(i);
|
||||||
|
endRemoveRows();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool EditorModel::isDuplicate(IEditor *editor) const
|
bool EditorModel::isDuplicate(IEditor *editor) const
|
||||||
{
|
{
|
||||||
return m_duplicateEditors.contains(editor);
|
return m_duplicateEditors.contains(editor);
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ public:
|
|||||||
QList<Entry> entries() const { return m_editors; }
|
QList<Entry> entries() const { return m_editors; }
|
||||||
|
|
||||||
void removeEditor(IEditor *editor);
|
void removeEditor(IEditor *editor);
|
||||||
|
void removeAllRestoredEditors();
|
||||||
void emitDataChanged(IEditor *editor);
|
void emitDataChanged(IEditor *editor);
|
||||||
|
|
||||||
QList<IEditor *> editors() const;
|
QList<IEditor *> editors() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user