Ladybird/Qt: Close the browser when the last tab's close button is used

We currently do this already when the last tab is closed via the ctrl-W
shortcut. Move the logic for this to BrowserWindow::close_tab so that we
also close the window when the tab is closed via its close button.
This commit is contained in:
Timothy Flynn 2024-04-05 07:36:12 -04:00 committed by Andreas Kling
parent db31fa730a
commit 795efea64f
Notes: sideshowbarker 2024-07-16 20:05:14 +09:00

View File

@ -613,6 +613,9 @@ void BrowserWindow::close_tab(int index)
auto* tab = m_tabs_container->widget(index);
m_tabs_container->removeTab(index);
tab->deleteLater();
if (m_tabs_container->count() == 0)
close();
}
void BrowserWindow::open_file()
@ -623,9 +626,6 @@ void BrowserWindow::open_file()
void BrowserWindow::close_current_tab()
{
close_tab(m_tabs_container->currentIndex());
if (m_tabs_container->count() == 0)
close();
}
int BrowserWindow::tab_index(Tab* tab)