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