summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-11-10 14:47:39 +0100
committerAndrea Diamantini <adjam7@gmail.com>2009-11-10 14:47:39 +0100
commitc7fa09a7b96e239ff6e7349c9d90e7409d7bbcb3 (patch)
tree9715e1f86daba6e14ec74625ae10cd85c23b2359 /src/mainview.cpp
parentSafer Application::mainWindow() call. No 0 return.. (diff)
downloadrekonq-c7fa09a7b96e239ff6e7349c9d90e7409d7bbcb3.tar.xz
fixing new mainWindow() behaviour, porting functions calling it
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index c4b0cfc2..10007140 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -36,7 +36,6 @@
// Local Includes
#include "tabbar.h"
#include "application.h"
-#include "mainwindow.h"
#include "history.h"
#include "urlbar.h"
#include "webview.h"
@@ -64,12 +63,13 @@
#include <QtGui/QWidget>
-MainView::MainView(QWidget *parent)
+MainView::MainView(MainWindow *parent)
: KTabWidget(parent)
, m_urlBar(new UrlBar(this))
, m_tabBar(new TabBar(this))
, m_addTabButton(new QToolButton(this))
, m_currentTabIndex(0)
+ , m_parentWindow(parent)
{
// setting tabbar
setTabBar(m_tabBar);
@@ -109,17 +109,8 @@ void MainView::postLaunch()
// Session Manager
connect (this, SIGNAL(tabsChanged()), Application::sessionManager(), SLOT(saveSession()));
- // Find the correct MainWindow of this tab button
- MainWindowList list = Application::instance()->mainWindowList();
- Q_FOREACH(QPointer<MainWindow> w, list)
- {
- if (w->isAncestorOf(this))
- {
- m_addTabButton->setDefaultAction(w->actionByName("new_tab"));
- break;
- }
- }
-
+ m_addTabButton->setDefaultAction(m_parentWindow->actionByName("new_tab"));
+
m_addTabButton->setAutoRaise(true);
m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
}
@@ -356,6 +347,7 @@ WebView *MainView::newWebView(bool focused, bool nearParent)
else
addTab(webView, i18n("(Untitled)"));
+ kDebug() << "newWebView";
updateTabBar();
if (focused)
@@ -375,13 +367,14 @@ void MainView::newTab()
switch(ReKonfig::newTabsBehaviour())
{
- case 0:
- if(Application::instance()->mainWindow()->homePage())
+ case 0: // new tab page
+ kDebug() << "newTab";
+ if(m_parentWindow->newTabPage())
break;
- case 1:
+ case 1: // blank page
urlBar()->setUrl(KUrl(""));
break;
- case 2:
+ case 2: // homepage
w->load( QUrl(ReKonfig::homePage()) );
break;
default:
@@ -414,7 +407,7 @@ void MainView::windowCloseRequested()
{
if (count() == 1)
{
- Application::instance()->mainWindow()->close();
+ m_parentWindow->close();
}
else
{
@@ -669,6 +662,7 @@ QList<HistoryItem> MainView::recentlyClosedTabs()
void MainView::resizeEvent(QResizeEvent *event)
{
+ kDebug() << "resizeEvent";
updateTabBar();
KTabWidget::resizeEvent(event);
}