diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-11-08 23:54:37 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-11-18 15:42:47 +0100 |
commit | 43e3512afd7ef973026528a0444e04a85877eee5 (patch) | |
tree | bc0086da02b2fe7bef9d27154a0e6e5ca4e05d38 | |
parent | Remove postLaunch calls (diff) | |
download | rekonq-43e3512afd7ef973026528a0444e04a85877eee5.tar.xz |
Remove mainWindow pointer from mainview class.
-rw-r--r-- | src/mainview.cpp | 13 | ||||
-rw-r--r-- | src/mainview.h | 7 | ||||
-rw-r--r-- | src/mainwindow.cpp | 4 |
3 files changed, 11 insertions, 13 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 80457252..15c78f5a 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -59,12 +59,11 @@ //Hack: QString temporaryUglyHackString = ""; -MainView::MainView(MainWindow *parent) +MainView::MainView(QWidget *parent) : KTabWidget(parent) , m_widgetBar(new StackedUrlBar(this)) , m_addTabButton(0) , m_currentTabIndex(0) - , m_parentWindow(parent) { // setting tabbar TabBar *tabBar = new TabBar(this); @@ -107,9 +106,9 @@ MainView::MainView(MainWindow *parent) } -void MainView::addNewTabButton() +void MainView::addNewTabButton(QAction *newTabAction) { - m_addTabButton->setDefaultAction(m_parentWindow->actionByName("new_tab")); + m_addTabButton->setDefaultAction(newTabAction); m_addTabButton->setAutoRaise(true); m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); @@ -367,7 +366,8 @@ void MainView::windowCloseRequested() { if (count() == 1) { - m_parentWindow->close(); + MainWindow *w = qobject_cast<MainWindow *>(parent()); + w->close(); } else { @@ -423,7 +423,8 @@ void MainView::closeTab(int index, bool del) if (ReKonfig::lastTabClosesWindow()) { // closing window... - m_parentWindow->close(); + MainWindow *w = qobject_cast<MainWindow *>(parent()); + w->close(); return; } diff --git a/src/mainview.h b/src/mainview.h index 133ede09..632ddbca 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -42,7 +42,6 @@ // Forward Declarations class HistoryItem; -class MainWindow; class StackedUrlBar; class TabBar; class UrlBar; @@ -65,7 +64,7 @@ class REKONQ_TESTS_EXPORT MainView : public KTabWidget Q_OBJECT public: - MainView(MainWindow *parent); + MainView(QWidget *parent); inline StackedUrlBar *widgetBar() const { @@ -79,7 +78,7 @@ public: WebTab *webTab(int index) const; - void addNewTabButton(); + void addNewTabButton(QAction *); /** * show and hide TabBar if user doesn't choose @@ -196,8 +195,6 @@ private: int m_currentTabIndex; QList<TabHistory> m_recentlyClosedTabs; - - MainWindow *m_parentWindow; }; #endif // MAINVIEW_H diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bce5b54a..01e10c82 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -144,8 +144,8 @@ MainWindow::MainWindow() // then, setup our actions setupActions(); - // BEFORE setupGUI!! - m_view->addNewTabButton(); + // BEFORE setupGUI, AFTER setupActions!! + m_view->addNewTabButton(actionByName("new_tab")); // setting Panels setupPanels(); |