[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [falkon] src/lib/tabwidget: TabBar: Disallow detaching tab when there is only one tab in the only wi
From: David Rosca <null () kde ! org>
Date: 2018-01-31 20:10:36
Message-ID: E1egyiK-0002Fo-Uz () code ! kde ! org
[Download RAW message or body]
Git commit 43e472e50e52c6f06f0d83b5150dbc6a3401c59f by David Rosca.
Committed on 31/01/2018 at 20:05.
Pushed by drosca into branch 'master'.
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.
M +4 -0 src/lib/tabwidget/tabbar.cpp
M +10 -0 src/lib/tabwidget/tabwidget.cpp
https://commits.kde.org/falkon/43e472e50e52c6f06f0d83b5150dbc6a3401c59f
diff --git a/src/lib/tabwidget/tabbar.cpp b/src/lib/tabwidget/tabbar.cpp
index 7672fb58..d1fefae4 100644
--- a/src/lib/tabwidget/tabbar.cpp
+++ b/src/lib/tabwidget/tabbar.cpp
@@ -511,6 +511,10 @@ void TabBar::mouseMoveEvent(QMouseEvent* event)
return;
}
+ if (count() == 1 && mApp->windowCount() == 1) {
+ return;
+ }
+
if (!m_dragStartPosition.isNull()) {
int offset = 0;
const int eventY = event->pos().y();
diff --git a/src/lib/tabwidget/tabwidget.cpp b/src/lib/tabwidget/tabwidget.cpp
index 76956461..f1396b1f 100644
--- a/src/lib/tabwidget/tabwidget.cpp
+++ b/src/lib/tabwidget/tabwidget.cpp
@@ -642,6 +642,10 @@ void TabWidget::detachTab(WebTab* tab)
{
Q_ASSERT(tab);
+ if (count() == 1 && mApp->windowCount() == 1) {
+ return;
+ }
+
m_locationBars->removeWidget(tab->locationBar());
disconnect(tab->webView(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
disconnect(tab->webView(), SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed()));
@@ -657,6 +661,12 @@ void TabWidget::detachTab(WebTab* tab)
void TabWidget::detachTab(int index)
{
WebTab* tab = weTab(index);
+ Q_ASSERT(tab);
+
+ if (count() == 1 && mApp->windowCount() == 1) {
+ return;
+ }
+
detachTab(tab);
tab->setPinned(false);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic