Commit 65931bea authored by Christoph Cullmann's avatar Christoph Cullmann

cleanup code, ensure always one windows exists after session loading

Differential Revision: https://phabricator.kde.org/D21876
parent 0c98f36e
......@@ -217,23 +217,24 @@ void KateSessionManager::loadSession(const KateSession::Ptr &session) const
}
}
} else {
const int windowsCount = KateApp::self()->mainWindowsCount();
for (int i = 0; i < windowsCount ; ++i) {
// if there are no main windows, create one to call loadOpenRecent()
if(i == windowsCount) {
KateMainWindow *w = KateApp::self()->newMainWindow();
if (w !=nullptr) {
w->loadOpenRecent(cfg);
}
} else {
KateApp::self()->mainWindow(i)->loadOpenRecent(cfg);
}
// load recent files for all existing windows, see bug 408499
for (int i = 0; i < KateApp::self()->mainWindowsCount(); ++i) {
KateApp::self()->mainWindow(i)->loadOpenRecent(cfg);
}
}
// ensure we have at least one window, always! load recent files for it, too, see bug 408499
if (KateApp::self()->mainWindowsCount() == 0) {
auto w = KateApp::self()->newMainWindow();
w->loadOpenRecent(cfg);
}
if (delete_cfg) {
delete cfg;
}
// we shall always have some existing windows here!
Q_ASSERT(KateApp::self()->mainWindowsCount() > 0);
}
bool KateSessionManager::activateSession(const QString &name, const bool closeAndSaveLast, const bool loadNew)
......
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