mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
BrowserWindow: Add tabCount() method
This commit is contained in:
parent
5cc41d219e
commit
fa4fba5f49
@ -100,7 +100,7 @@ BrowserWindow::SavedWindow::SavedWindow(BrowserWindow *window)
|
|||||||
virtualDesktop = window->getCurrentVirtualDesktop();
|
virtualDesktop = window->getCurrentVirtualDesktop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int tabsCount = window->tabWidget()->count();
|
const int tabsCount = window->tabCount();
|
||||||
tabs.reserve(tabsCount);
|
tabs.reserve(tabsCount);
|
||||||
for (int i = 0; i < tabsCount; ++i) {
|
for (int i = 0; i < tabsCount; ++i) {
|
||||||
TabbedWebView *webView = window->weView(i);
|
TabbedWebView *webView = window->weView(i);
|
||||||
@ -648,6 +648,11 @@ void BrowserWindow::goBack()
|
|||||||
weView()->back();
|
weView()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int BrowserWindow::tabCount() const
|
||||||
|
{
|
||||||
|
return m_tabWidget->count();
|
||||||
|
}
|
||||||
|
|
||||||
TabbedWebView* BrowserWindow::weView() const
|
TabbedWebView* BrowserWindow::weView() const
|
||||||
{
|
{
|
||||||
return weView(m_tabWidget->currentIndex());
|
return weView(m_tabWidget->currentIndex());
|
||||||
|
@ -103,6 +103,7 @@ public:
|
|||||||
SideBar* addSideBar();
|
SideBar* addSideBar();
|
||||||
void saveSideBarSettings();
|
void saveSideBarSettings();
|
||||||
|
|
||||||
|
int tabCount() const;
|
||||||
TabbedWebView* weView() const;
|
TabbedWebView* weView() const;
|
||||||
TabbedWebView* weView(int index) const;
|
TabbedWebView* weView(int index) const;
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ void MainApplication::openSession(BrowserWindow* window, RestoreData &restoreDat
|
|||||||
if (!window)
|
if (!window)
|
||||||
window = createWindow(Qz::BW_OtherRestoredWindow);
|
window = createWindow(Qz::BW_OtherRestoredWindow);
|
||||||
|
|
||||||
if (window->tabWidget()->count() != 0) {
|
if (window->tabCount() != 0) {
|
||||||
// This can only happen when recovering crashed session!
|
// This can only happen when recovering crashed session!
|
||||||
// Don't restore tabs in current window as user already opened some new tabs.
|
// Don't restore tabs in current window as user already opened some new tabs.
|
||||||
createWindow(Qz::BW_OtherRestoredWindow)->restoreWindow(restoreData.windows.takeAt(0));
|
createWindow(Qz::BW_OtherRestoredWindow)->restoreWindow(restoreData.windows.takeAt(0));
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "browserwindow.h"
|
#include "browserwindow.h"
|
||||||
#include "qztools.h"
|
#include "qztools.h"
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
#include "tabwidget.h"
|
|
||||||
|
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
@ -123,7 +122,7 @@ void RecoveryJsObject::closeTab()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view->browserWindow()->tabWidget()->count() > 1) {
|
if (view->browserWindow()->tabCount() > 1) {
|
||||||
view->closeView();
|
view->closeView();
|
||||||
} else {
|
} else {
|
||||||
view->browserWindow()->close();
|
view->browserWindow()->close();
|
||||||
|
@ -539,7 +539,7 @@ static void detachTabsTo(BrowserWindow* targetWindow, const QHash<BrowserWindow*
|
|||||||
foreach (WebTab* webTab, tabs) {
|
foreach (WebTab* webTab, tabs) {
|
||||||
mainWindow->tabWidget()->detachTab(webTab);
|
mainWindow->tabWidget()->detachTab(webTab);
|
||||||
|
|
||||||
if (mainWindow && mainWindow->tabWidget()->count() == 0) {
|
if (mainWindow && mainWindow->tabCount() == 0) {
|
||||||
mainWindow->close();
|
mainWindow->close();
|
||||||
mainWindow = 0;
|
mainWindow = 0;
|
||||||
}
|
}
|
||||||
@ -553,7 +553,7 @@ void TabManagerWidget::detachSelectedTabs(const QHash<BrowserWindow*, WebTab*> &
|
|||||||
{
|
{
|
||||||
if (tabsHash.isEmpty() ||
|
if (tabsHash.isEmpty() ||
|
||||||
(tabsHash.uniqueKeys().size() == 1 &&
|
(tabsHash.uniqueKeys().size() == 1 &&
|
||||||
tabsHash.size() == tabsHash.keys().at(0)->tabWidget()->count())) {
|
tabsHash.size() == tabsHash.keys().at(0)->tabCount())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user