forked from qt-creator/qt-creator
Core: Save session state on autoSave
If Creator crashes, session information (like open files, bookmarks etc.) should be restored. Task-number: QTCREATORBUG-16752 Change-Id: Ife1a2ffb62a3dd9b302e08ad9df9537667173e47 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
3517480557
commit
eed064c7ed
@@ -1970,6 +1970,7 @@ void EditorManagerPrivate::autoSave()
|
|||||||
if (!errors.isEmpty())
|
if (!errors.isEmpty())
|
||||||
QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
|
QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
|
||||||
errors.join(QLatin1Char('\n')));
|
errors.join(QLatin1Char('\n')));
|
||||||
|
emit m_instance->autoSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorManagerPrivate::handleContextChange(const QList<IContext *> &context)
|
void EditorManagerPrivate::handleContextChange(const QList<IContext *> &context)
|
||||||
|
@@ -185,6 +185,7 @@ signals:
|
|||||||
void editorsClosed(QList<Core::IEditor *> editors);
|
void editorsClosed(QList<Core::IEditor *> editors);
|
||||||
void findOnFileSystemRequest(const QString &path);
|
void findOnFileSystemRequest(const QString &path);
|
||||||
void aboutToSave(IDocument *document);
|
void aboutToSave(IDocument *document);
|
||||||
|
void autoSaved();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
static void saveDocument();
|
static void saveDocument();
|
||||||
|
@@ -1061,6 +1061,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
|
|
||||||
connect(ICore::instance(), &ICore::saveSettingsRequested,
|
connect(ICore::instance(), &ICore::saveSettingsRequested,
|
||||||
dd, &ProjectExplorerPluginPrivate::savePersistentSettings);
|
dd, &ProjectExplorerPluginPrivate::savePersistentSettings);
|
||||||
|
connect(EditorManager::instance(), &EditorManager::autoSaved, this, [this] {
|
||||||
|
if (!dd->m_shuttingDown && !SessionManager::loadingSession())
|
||||||
|
SessionManager::save();
|
||||||
|
});
|
||||||
|
|
||||||
addAutoReleasedObject(new ProjectTreeWidgetFactory);
|
addAutoReleasedObject(new ProjectTreeWidgetFactory);
|
||||||
addAutoReleasedObject(new FolderNavigationWidgetFactory);
|
addAutoReleasedObject(new FolderNavigationWidgetFactory);
|
||||||
|
Reference in New Issue
Block a user