diff --git a/src/lib/webtab/tabbedwebview.cpp b/src/lib/webtab/tabbedwebview.cpp index 989b47562..9cea02c65 100644 --- a/src/lib/webtab/tabbedwebview.cpp +++ b/src/lib/webtab/tabbedwebview.cpp @@ -90,12 +90,6 @@ WebTab* TabbedWebView::webTab() const return m_webTab; } -TabWidget* TabbedWebView::tabWidget() const -{ - // FIXME:!! - return m_window ? m_window->tabWidget() : 0; -} - QString TabbedWebView::getIp() const { return m_currentIp; @@ -222,13 +216,15 @@ void TabbedWebView::closeView() void TabbedWebView::openNewTab() { - tabWidget()->addView(QUrl()); + if (m_window) { + m_window->tabWidget()->addView(QUrl()); + } } void TabbedWebView::loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position) { if (m_window) { - int index = tabWidget()->addView(QUrl(), position); + int index = m_window->tabWidget()->addView(QUrl(), position); m_window->weView(index)->webTab()->locationBar()->showUrl(req.url()); m_window->weView(index)->load(req); } @@ -236,7 +232,9 @@ void TabbedWebView::loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags void TabbedWebView::setAsCurrentTab() { - tabWidget()->setCurrentWidget(m_webTab); + if (m_window) { + m_window->tabWidget()->setCurrentWidget(m_webTab); + } } void TabbedWebView::mouseMoveEvent(QMouseEvent* event) diff --git a/src/lib/webtab/tabbedwebview.h b/src/lib/webtab/tabbedwebview.h index b3bc45d61..55c949139 100644 --- a/src/lib/webtab/tabbedwebview.h +++ b/src/lib/webtab/tabbedwebview.h @@ -38,11 +38,11 @@ public: void setWebPage(WebPage* page); + // BrowserWindow can be null! BrowserWindow* browserWindow() const; void setBrowserWindow(BrowserWindow* window); WebTab* webTab() const; - TabWidget* tabWidget() const; QString getIp() const; int tabIndex() const; diff --git a/src/plugins/MouseGestures/mousegestures.cpp b/src/plugins/MouseGestures/mousegestures.cpp index 1a865162a..e4bed93b6 100644 --- a/src/plugins/MouseGestures/mousegestures.cpp +++ b/src/plugins/MouseGestures/mousegestures.cpp @@ -244,31 +244,33 @@ void MouseGestures::upDownGestured() void MouseGestures::upLeftGestured() { TabbedWebView* view = qobject_cast(m_view.data()); - if (!view) { + if (!view) return; - } - if (QApplication::isRightToLeft()) { - view->tabWidget()->nextTab(); - } - else { - view->tabWidget()->previousTab(); - } + BrowserWindow* window = view->browserWindow(); + if (!window) + return; + + if (QApplication::isRightToLeft()) + window->tabWidget()->nextTab(); + else + window->tabWidget()->previousTab(); } void MouseGestures::upRightGestured() { TabbedWebView* view = qobject_cast(m_view.data()); - if (!view) { + if (!view) return; - } - if (QApplication::isRightToLeft()) { - view->tabWidget()->previousTab(); - } - else { - view->tabWidget()->nextTab(); - } + BrowserWindow* window = view->browserWindow(); + if (!window) + return; + + if (QApplication::isRightToLeft()) + window->tabWidget()->previousTab(); + else + window->tabWidget()->nextTab(); } void MouseGestures::init()