Commit 7cc33208 authored by Christoph Cullmann's avatar Christoph Cullmann 🍨 Committed by Eric Armbruster
Browse files

show welcome view if last view closed

parent 3d87ee0c
......@@ -180,12 +180,7 @@ KateMainWindow::KateMainWindow(KConfig *sconfig, const QString &sgroup)
}
// ensure we have the welcome view if no active view is there
// delay this after initialisation
QTimer::singleShot(0, this, [this]() {
if (activeView())
return;
addWidget(new KateWelcomeView(m_viewManager->activeViewSpace(), nullptr));
});
showWelcomeViewIfNeeded();
}
KateMainWindow::~KateMainWindow()
......@@ -1500,3 +1495,13 @@ void KateMainWindow::addRecentOpenedFile(const QUrl &url)
// to the global "Recent Document Menu", see bug 420504
// KRecentDocument::add(url);
}
void KateMainWindow::showWelcomeViewIfNeeded()
{
// delay the creation, e.g. used on startup
QTimer::singleShot(0, this, [this]() {
if (activeView())
return;
addWidget(new KateWelcomeView(m_viewManager->activeViewSpace(), nullptr));
});
}
......@@ -138,6 +138,12 @@ public:
*/
void saveOptions();
/**
* Trigger creation of welcome view via timer.
* Will do nothing if we have some view around when the timer triggers.
*/
void showWelcomeViewIfNeeded();
private:
/**
* Setup actions which pointers are needed already in setupMainWindow
......
......@@ -1077,7 +1077,11 @@ void KateViewManager::onViewSpaceEmptied(KateViewSpace *vs)
// got empty, remove it
if (m_viewSpaceList.size() > 1) {
removeViewSpace(vs);
return;
}
// else we want to trigger showing of the welcome view
m_mainWindow->showWelcomeViewIfNeeded();
}
void KateViewManager::setShowUrlNavBar(bool show)
......
Supports Markdown
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