Session: Do not save temporary editors

Do not save temporary editors in the session. Chances are high
that files opened in those editors are not around when the
session is reopened.

Task-number: QTCREATORBUG-2422
This commit is contained in:
Tobias Hunger
2010-10-06 18:05:07 +02:00
parent bb02af93dd
commit 72eaca26db
2 changed files with 20 additions and 5 deletions

View File

@@ -269,8 +269,14 @@ bool SessionFile::save(const QString &fileName)
writer.saveValue(QLatin1String("ProjectDependencies"), QVariant(depMap));
writer.saveValue(QLatin1String("OpenEditors"),
m_core->editorManager()->openedEditors().count());
int editorCount = 0;
QList<Core::IEditor *> editors = m_core->editorManager()->openedEditors();
foreach (Core::IEditor *editor, editors) {
Q_ASSERT(editor);
if (!editor->isTemporary())
++editorCount;
}
writer.saveValue(QLatin1String("OpenEditors"), editorCount);
writer.saveValue(QLatin1String("EditorSettings"),
m_core->editorManager()->saveState().toBase64());