Commit 1561f620 authored by Jiří Paleček's avatar Jiří Paleček Committed by Kurt Hindenburg
Browse files

Allow loading of pre 19.08 session files

The format of the Konsole session file changed with 19.08. This was
overlooked and pre 19.08 files caused crashes.  That crash was fixed
in 19.08.1 to just start the default profile.
This patch will allow pre 19.08 session files to be loaded correctly.

BUG: 412173
FIXED-IN: 19.08.2
(cherry picked from commit 2de43394)
parent e65dfcb6
......@@ -935,7 +935,40 @@ void ViewManager::restoreSessions(const KConfigGroup &group)
_viewContainer->addSplitter(topLevelSplitter, _viewContainer->count());
}
if (jsonTabs.isEmpty()) { // Session file is unusable, start default Profile
if (!jsonTabs.isEmpty())
return;
// Session file is unusable, try older format
QList<int> ids = group.readEntry("Sessions", QList<int>());
int activeTab = group.readEntry("Active", 0);
TerminalDisplay *display = nullptr;
int tab = 1;
foreach (int id, ids) {
Session *session = SessionManager::instance()->idToSession(id);
if (session == nullptr) {
qWarning() << "Unable to load session with id" << id;
// Force a creation of a default session below
ids.clear();
break;
}
activeContainer()->addView(createView(session));
if (!session->isRunning()) {
session->run();
}
if (tab++ == activeTab) {
display = qobject_cast<TerminalDisplay *>(activeView());
}
}
if (display != nullptr) {
activeContainer()->setCurrentWidget(display);
display->setFocus(Qt::OtherFocusReason);
}
if (ids.isEmpty()) { // Session file is unusable, start default Profile
Profile::Ptr profile = ProfileManager::instance()->defaultProfile();
Session *session = SessionManager::instance()->createSession(profile);
activeContainer()->addView(createView(session));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment