mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
[CloseOnLastTab] Instead of blocking closing tab, load new-tab-url
This commit is contained in:
parent
22452aa825
commit
d109159408
@ -481,10 +481,14 @@ void TabWidget::closeTab(int index, bool force)
|
|||||||
|
|
||||||
// This would close last tab, so we close the window instead
|
// This would close last tab, so we close the window instead
|
||||||
if (!force && count() == 1) {
|
if (!force && count() == 1) {
|
||||||
// But only if we can
|
// If we are not closing window upon closing last tab, let's just load new-tab-url
|
||||||
if (m_dontCloseWithOneTab) {
|
if (m_dontCloseWithOneTab) {
|
||||||
// We won't actually close the tab
|
if (webView->url() == m_urlOnNewTab) {
|
||||||
m_closedTabsManager->takeLastClosedTab();
|
// We don't want to accumulate more than one closed tab, if user tries
|
||||||
|
// to close the last tab multiple times
|
||||||
|
m_closedTabsManager->takeLastClosedTab();
|
||||||
|
}
|
||||||
|
webView->load(m_urlOnNewTab);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_window->close();
|
m_window->close();
|
||||||
@ -506,13 +510,14 @@ void TabWidget::closeTab(int index, bool force)
|
|||||||
webView->disconnectObjects();
|
webView->disconnectObjects();
|
||||||
webTab->disconnectObjects();
|
webTab->disconnectObjects();
|
||||||
|
|
||||||
webTab->deleteLater();
|
|
||||||
|
|
||||||
if (!m_closedInsteadOpened && m_menuTabs->isVisible()) {
|
if (!m_closedInsteadOpened && m_menuTabs->isVisible()) {
|
||||||
QAction* labelAction = m_menuTabs->actions().last();
|
QAction* labelAction = m_menuTabs->actions().last();
|
||||||
labelAction->setText(tr("Currently you have %n opened tab(s)", "", count() - 1));
|
labelAction->setText(tr("Currently you have %n opened tab(s)", "", count() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeTab(index);
|
||||||
|
delete webTab;
|
||||||
|
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
WebPage* page() const;
|
WebPage* page() const;
|
||||||
void setPage(QWebPage* page);
|
void setPage(QWebPage* page);
|
||||||
|
|
||||||
|
void load(const QUrl &url);
|
||||||
void load(const QNetworkRequest &request,
|
void load(const QNetworkRequest &request,
|
||||||
QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
|
QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
|
||||||
const QByteArray &body = QByteArray());
|
const QByteArray &body = QByteArray());
|
||||||
@ -82,7 +83,6 @@ public slots:
|
|||||||
void editSelectAll();
|
void editSelectAll();
|
||||||
void editDelete();
|
void editDelete();
|
||||||
|
|
||||||
void load(const QUrl &url);
|
|
||||||
void reload();
|
void reload();
|
||||||
void reloadBypassCache();
|
void reloadBypassCache();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user