1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Fix closing tabs - regression from last commits

Closes #2534
This commit is contained in:
David Rosca 2018-01-04 20:50:17 +01:00
parent d380d54ef8
commit 65d1493f0a
2 changed files with 11 additions and 5 deletions

View File

@ -317,7 +317,7 @@ void NavigationBar::reloadLayout()
QSL("locationbar") QSL("locationbar")
}; };
QStringList ids = Settings().value(QSL("NavigationBar/layout"), defaultIds).toStringList(); QStringList ids = Settings().value(QSL("NavigationBar/Layout"), defaultIds).toStringList();
ids.removeDuplicates(); ids.removeDuplicates();
if (!ids.contains(QSL("locationbar"))) { if (!ids.contains(QSL("locationbar"))) {
ids.append(QSL("locationbar")); ids.append(QSL("locationbar"));

View File

@ -346,7 +346,7 @@ int TabWidget::addView(const LoadRequest &req, const QString &title, const Qz::N
m_lastBackgroundTabIndex = index; m_lastBackgroundTabIndex = index;
} }
connect(webTab->webView(), SIGNAL(wantsCloseTab(int)), this, SLOT(requestCloseTab(int))); connect(webTab->webView(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
connect(webTab->webView(), SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed())); connect(webTab->webView(), SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed()));
connect(webTab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString))); connect(webTab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
connect(webTab->webView(), &WebView::urlChanged, this, [this](const QUrl &url) { connect(webTab->webView(), &WebView::urlChanged, this, [this](const QUrl &url) {
@ -393,7 +393,7 @@ int TabWidget::insertView(int index, WebTab *tab, const Qz::NewTabPositionFlags
m_lastBackgroundTabIndex = index; m_lastBackgroundTabIndex = index;
} }
connect(tab->webView(), SIGNAL(wantsCloseTab(int)), this, SLOT(requestCloseTab(int))); connect(tab->webView(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
connect(tab->webView(), SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed())); connect(tab->webView(), SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed()));
connect(tab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString))); connect(tab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
@ -425,11 +425,17 @@ void TabWidget::closeTab(int index)
if (!webTab || !validIndex(index)) if (!webTab || !validIndex(index))
return; return;
// This is already handled in requestCloseTab
if (count() <= 1) {
requestCloseTab(index);
return;
}
m_closedTabsManager->saveTab(webTab); m_closedTabsManager->saveTab(webTab);
TabbedWebView *webView = webTab->webView(); TabbedWebView *webView = webTab->webView();
m_locationBars->removeWidget(webView->webTab()->locationBar()); m_locationBars->removeWidget(webView->webTab()->locationBar());
disconnect(webView, SIGNAL(wantsCloseTab(int)), this, SLOT(requestCloseTab(int))); disconnect(webView, SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
disconnect(webView, SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed())); disconnect(webView, SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed()));
disconnect(webView, SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString))); disconnect(webView, SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
@ -634,7 +640,7 @@ void TabWidget::detachTab(WebTab* tab)
Q_ASSERT(tab); Q_ASSERT(tab);
m_locationBars->removeWidget(tab->locationBar()); m_locationBars->removeWidget(tab->locationBar());
disconnect(tab->webView(), SIGNAL(wantsCloseTab(int)), this, SLOT(requestCloseTab(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()));
disconnect(tab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString))); disconnect(tab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));