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:
parent
dc8ddb03c1
commit
43e472e50e
@ -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();
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user