diff options
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r-- | src/mainview.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 2b5a8202..1ad452ea 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -59,19 +59,18 @@ //Hack: QString temporaryUglyHackString = ""; -MainView::MainView(MainWindow *parent) +MainView::MainView(QWidget *parent) : KTabWidget(parent) , m_widgetBar(new StackedUrlBar(this)) - , m_originalWidthHint(0) , m_addTabButton(0) , m_currentTabIndex(0) - , m_parentWindow(parent) { // setting tabbar TabBar *tabBar = new TabBar(this); m_addTabButton = new QToolButton(this); setTabBar(tabBar); + tabBar->show(); // set mouse tracking for tab previews setMouseTracking(true); @@ -96,12 +95,6 @@ MainView::MainView(MainWindow *parent) connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); connect(this, SIGNAL(currentChanged(int)), rApp->sessionManager(), SLOT(saveSession())); - QTimer::singleShot(0, this, SLOT(postLaunch())); -} - - -void MainView::postLaunch() -{ QList<TabHistory> list = rApp->sessionManager()->closedSites(); Q_FOREACH(const TabHistory & tab, list) { @@ -110,12 +103,15 @@ void MainView::postLaunch() m_recentlyClosedTabs.removeAll(tab); m_recentlyClosedTabs.prepend(tab); } +} - m_addTabButton->setDefaultAction(m_parentWindow->actionByName("new_tab")); + +void MainView::addNewTabButton(QAction *newTabAction) +{ + m_addTabButton->setDefaultAction(newTabAction); m_addTabButton->setAutoRaise(true); m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); - m_originalWidthHint = sizeHint().width(); } @@ -370,7 +366,8 @@ void MainView::windowCloseRequested() { if (count() == 1) { - m_parentWindow->close(); + MainWindow *w = qobject_cast<MainWindow *>(parent()); + w->close(); } else { @@ -426,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; } @@ -598,12 +596,8 @@ void MainView::webViewUrlChanged(const QUrl &url) { WebView *view = qobject_cast<WebView *>(sender()); int index = indexOf(view->parentWidget()); - if (-1 != index) - { - tabBar()->setTabData(index, url); - } if (ReKonfig::hoveringTabOption() == 2) - tabBar()->setTabToolTip(index, webTab(index)->url().toMimeDataString()); + tabBar()->setTabToolTip(index, url.toString()); } |