1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

TabBar: Disallow detaching tab when there is only one tab in the only window

Otherwise it would close the last window which would quit the app.
This commit is contained in:
David Rosca 2018-01-31 20:00:38 +01:00
parent dc8ddb03c1
commit 43e472e50e
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 14 additions and 0 deletions

View File

@ -511,6 +511,10 @@ void TabBar::mouseMoveEvent(QMouseEvent* event)
return; return;
} }
if (count() == 1 && mApp->windowCount() == 1) {
return;
}
if (!m_dragStartPosition.isNull()) { if (!m_dragStartPosition.isNull()) {
int offset = 0; int offset = 0;
const int eventY = event->pos().y(); const int eventY = event->pos().y();

View File

@ -642,6 +642,10 @@ void TabWidget::detachTab(WebTab* tab)
{ {
Q_ASSERT(tab); Q_ASSERT(tab);
if (count() == 1 && mApp->windowCount() == 1) {
return;
}
m_locationBars->removeWidget(tab->locationBar()); m_locationBars->removeWidget(tab->locationBar());
disconnect(tab->webView(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int))); disconnect(tab->webView(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
disconnect(tab->webView(), SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed())); disconnect(tab->webView(), SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed()));
@ -657,6 +661,12 @@ void TabWidget::detachTab(WebTab* tab)
void TabWidget::detachTab(int index) void TabWidget::detachTab(int index)
{ {
WebTab* tab = weTab(index); WebTab* tab = weTab(index);
Q_ASSERT(tab);
if (count() == 1 && mApp->windowCount() == 1) {
return;
}
detachTab(tab); detachTab(tab);
tab->setPinned(false); tab->setPinned(false);