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

BrowserWindow: Always create tab models in initialization

This commit is contained in:
David Rosca 2018-02-06 14:47:30 +01:00
parent 94e6b98450
commit 0f2728e49e
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 15 additions and 5 deletions

View File

@ -56,6 +56,7 @@
#include "mainmenu.h" #include "mainmenu.h"
#include "downloadsbutton.h" #include "downloadsbutton.h"
#include "tabmodel.h" #include "tabmodel.h"
#include "tabmrumodel.h"
#include <algorithm> #include <algorithm>
@ -370,6 +371,10 @@ void BrowserWindow::setupUi()
m_navigationToolbar = new NavigationBar(this); m_navigationToolbar = new NavigationBar(this);
m_bookmarksToolbar = new BookmarksToolbar(this); m_bookmarksToolbar = new BookmarksToolbar(this);
m_tabModel = new TabModel(this, this);
m_tabMruModel = new TabMruModel(this, this);
m_tabMruModel->setSourceModel(m_tabModel);
m_navigationContainer = new NavigationContainer(this); m_navigationContainer = new NavigationContainer(this);
m_navigationContainer->addWidget(m_navigationToolbar); m_navigationContainer->addWidget(m_navigationToolbar);
m_navigationContainer->addWidget(m_bookmarksToolbar); m_navigationContainer->addWidget(m_bookmarksToolbar);
@ -718,14 +723,16 @@ QAction* BrowserWindow::action(const QString &name) const
return m_mainMenu->action(name); return m_mainMenu->action(name);
} }
TabModel *BrowserWindow::tabModel() TabModel *BrowserWindow::tabModel() const
{ {
if (!m_tabModel) {
m_tabModel = new TabModel(this, this);
}
return m_tabModel; return m_tabModel;
} }
TabMruModel *BrowserWindow::tabMruModel() const
{
return m_tabMruModel;
}
void BrowserWindow::setWindowTitle(const QString &t) void BrowserWindow::setWindowTitle(const QString &t)
{ {
QString title = t; QString title = t;

View File

@ -52,6 +52,7 @@ class NavigationContainer;
class ClickableLabel; class ClickableLabel;
class LocationBar; class LocationBar;
class TabModel; class TabModel;
class TabMruModel;
class FALKON_EXPORT BrowserWindow : public QMainWindow class FALKON_EXPORT BrowserWindow : public QMainWindow
{ {
@ -121,7 +122,8 @@ public:
QAction* action(const QString &name) const; QAction* action(const QString &name) const;
TabModel *tabModel(); TabModel *tabModel() const;
TabMruModel *tabMruModel() const;
signals: signals:
void startingCompleted(); void startingCompleted();
@ -219,6 +221,7 @@ private:
MainMenu* m_mainMenu; MainMenu* m_mainMenu;
TabModel *m_tabModel = nullptr; TabModel *m_tabModel = nullptr;
TabMruModel *m_tabMruModel = nullptr;
int m_sideBarWidth; int m_sideBarWidth;
int m_webViewWidth; int m_webViewWidth;