Commit 186c1d15 authored by Eric Armbruster's avatar Eric Armbruster 🍁
Browse files

Only guard showWelcomeViewIfNeeded with singleShot

showWelcomeView is expected to be called after startup
showWelcomeViewIfNeeded may also be called at startup
parent f08ffde0
Pipeline #234983 passed with stage
in 10 minutes and 25 seconds
......@@ -1512,27 +1512,27 @@ void KateViewManager::hideWelcomeView(KateViewSpace *vs)
void KateViewManager::showWelcomeViewIfNeeded()
{
// we really want to show up only if nothing is in the current view space
// this guard versus double invocation of this function, too
if (activeViewSpace() && (activeViewSpace()->currentView() || activeViewSpace()->currentWidget()))
return;
// delay the creation, e.g. used on startup
QTimer::singleShot(0, this, [this]() {
// we really want to show up only if nothing is in the current view space
// this guard versus double invocation of this function, too
if (activeViewSpace() && (activeViewSpace()->currentView() || activeViewSpace()->currentWidget()))
return;
showWelcomeView();
showWelcomeView();
});
}
void KateViewManager::showWelcomeView()
{
// delay the creation, e.g. used on startup
QTimer::singleShot(0, this, [this]() {
auto welcomeView = new WelcomeView(this);
auto recentFilesAction = mainWindow()->recentFilesAction();
connect(recentFilesAction, &KRecentFilesAction::recentListCleared, this, &KateViewManager::refreshRecentsOnWelcomeView);
connect(welcomeView, &WelcomeView::forgetAllRecents, recentFilesAction, &KRecentFilesAction::clear);
connect(this, &KateViewManager::loadRecentFiles, welcomeView, &WelcomeView::loadRecents);
auto welcomeView = new WelcomeView(this);
auto recentFilesAction = mainWindow()->recentFilesAction();
connect(recentFilesAction, &KRecentFilesAction::recentListCleared, this, &KateViewManager::refreshRecentsOnWelcomeView);
connect(welcomeView, &WelcomeView::forgetAllRecents, recentFilesAction, &KRecentFilesAction::clear);
connect(this, &KateViewManager::loadRecentFiles, welcomeView, &WelcomeView::loadRecents);
mainWindow()->addWidget(welcomeView);
refreshRecentsOnWelcomeView();
});
mainWindow()->addWidget(welcomeView);
refreshRecentsOnWelcomeView();
}
void KateViewManager::refreshRecentsOnWelcomeView()
......
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