forked from qt-creator/qt-creator
SessionManager: Improve encapsulation on save
Change-Id: I3fa5edf226c8369f9f12ccf95bf2914b50f9d48b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
5b47c653c1
commit
738eaf85d1
@@ -1518,11 +1518,7 @@ void ProjectExplorerPlugin::openNewProjectDialog()
|
|||||||
|
|
||||||
void ProjectExplorerPluginPrivate::showSessionManager()
|
void ProjectExplorerPluginPrivate::showSessionManager()
|
||||||
{
|
{
|
||||||
if (SessionManager::isDefaultVirgin()) {
|
SessionManager::save();
|
||||||
// do not save new virgin default sessions
|
|
||||||
} else {
|
|
||||||
SessionManager::save();
|
|
||||||
}
|
|
||||||
SessionDialog sessionDialog(ICore::mainWindow());
|
SessionDialog sessionDialog(ICore::mainWindow());
|
||||||
sessionDialog.setAutoLoadSession(dd->m_projectExplorerSettings.autorestoreLastSession);
|
sessionDialog.setAutoLoadSession(dd->m_projectExplorerSettings.autorestoreLastSession);
|
||||||
sessionDialog.exec();
|
sessionDialog.exec();
|
||||||
@@ -1551,11 +1547,7 @@ void ProjectExplorerPluginPrivate::savePersistentSettings()
|
|||||||
foreach (Project *pro, SessionManager::projects())
|
foreach (Project *pro, SessionManager::projects())
|
||||||
pro->saveSettings();
|
pro->saveSettings();
|
||||||
|
|
||||||
if (SessionManager::isDefaultVirgin()) {
|
SessionManager::save();
|
||||||
// do not save new virgin default sessions
|
|
||||||
} else {
|
|
||||||
SessionManager::save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSettings *s = ICore::settings();
|
QSettings *s = ICore::settings();
|
||||||
|
@@ -408,6 +408,10 @@ bool SessionManager::loadingSession()
|
|||||||
|
|
||||||
bool SessionManager::save()
|
bool SessionManager::save()
|
||||||
{
|
{
|
||||||
|
// do not save new virgin default sessions
|
||||||
|
if (isDefaultVirgin())
|
||||||
|
return true;
|
||||||
|
|
||||||
emit m_instance->aboutToSaveSession();
|
emit m_instance->aboutToSaveSession();
|
||||||
|
|
||||||
if (!d->m_writer || d->m_writer->fileName() != sessionNameToFileName(d->m_sessionName)) {
|
if (!d->m_writer || d->m_writer->fileName() != sessionNameToFileName(d->m_sessionName)) {
|
||||||
@@ -961,11 +965,9 @@ bool SessionManager::loadSession(const QString &session)
|
|||||||
// Allow everyone to set something in the session and before saving
|
// Allow everyone to set something in the session and before saving
|
||||||
emit m_instance->aboutToUnloadSession(d->m_sessionName);
|
emit m_instance->aboutToUnloadSession(d->m_sessionName);
|
||||||
|
|
||||||
if (!isDefaultVirgin()) {
|
if (!save()) {
|
||||||
if (!save()) {
|
d->m_loadingSession = false;
|
||||||
d->m_loadingSession = false;
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
|
Reference in New Issue
Block a user