make "close all" work with fake-restored editors

This commit is contained in:
mae
2009-03-10 15:16:27 +01:00
parent 5b683c84ef
commit 73b886fcce
3 changed files with 13 additions and 0 deletions

View File

@@ -628,6 +628,7 @@ QList<IFile *> EditorManager::filesForEditors(QList<IEditor *> editors) const
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
{
m_d->m_editorModel->removeAllRestoredEditors();
return closeEditors(openedEditors(), askAboutModifiedEditors);
}

View File

@@ -181,6 +181,17 @@ void EditorModel::removeEditor(IEditor *editor)
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
{
return m_duplicateEditors.contains(editor);

View File

@@ -86,6 +86,7 @@ public:
QList<Entry> entries() const { return m_editors; }
void removeEditor(IEditor *editor);
void removeAllRestoredEditors();
void emitDataChanged(IEditor *editor);
QList<IEditor *> editors() const;