From 0af8f45a5f2867b90f5262ec0f1da70c12fa3283 Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Mon, 2 Jun 2014 00:28:41 +0430 Subject: [PATCH] [MouseGestures] Honor to user settings for 'New Tab' url, - Closes #1380 --- src/lib/popupwindow/popupwebview.cpp | 12 ++++++++++++ src/lib/popupwindow/popupwebview.h | 1 + src/lib/webkit/webview.h | 2 +- src/lib/webtab/tabbedwebview.cpp | 4 ++-- src/lib/webtab/tabbedwebview.h | 2 +- src/main/main.cpp | 2 +- src/plugins/MouseGestures/mousegestures.cpp | 2 +- 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/lib/popupwindow/popupwebview.cpp b/src/lib/popupwindow/popupwebview.cpp index c6b5b9901..356179247 100644 --- a/src/lib/popupwindow/popupwebview.cpp +++ b/src/lib/popupwindow/popupwebview.cpp @@ -75,6 +75,18 @@ void PopupWebView::loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags } } +void PopupWebView::openNewTab(Qz::NewTabPositionFlags position) +{ + Q_UNUSED(position) + + BrowserWindow* window = mApp->getWindow(); + + if (window) { + window->tabWidget()->addView(QUrl(), Qz::NT_SelectedTab); + window->raise(); + } +} + void PopupWebView::closeView() { parentWidget()->close(); diff --git a/src/lib/popupwindow/popupwebview.h b/src/lib/popupwindow/popupwebview.h index 2b016f479..e1df6acef 100644 --- a/src/lib/popupwindow/popupwebview.h +++ b/src/lib/popupwindow/popupwebview.h @@ -36,6 +36,7 @@ public: QWidget* overlayWidget(); void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position); + void openNewTab(Qz::NewTabPositionFlags position); signals: diff --git a/src/lib/webkit/webview.h b/src/lib/webkit/webview.h index 7b6df948f..a33a6807e 100644 --- a/src/lib/webkit/webview.h +++ b/src/lib/webkit/webview.h @@ -107,7 +107,7 @@ public slots: void openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position); virtual void closeView() = 0; - virtual void openNewTab() { } + virtual void openNewTab(Qz::NewTabPositionFlags position) { Q_UNUSED(position) } virtual void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position) = 0; protected slots: diff --git a/src/lib/webtab/tabbedwebview.cpp b/src/lib/webtab/tabbedwebview.cpp index 9cea02c65..f79184d1a 100644 --- a/src/lib/webtab/tabbedwebview.cpp +++ b/src/lib/webtab/tabbedwebview.cpp @@ -214,10 +214,10 @@ void TabbedWebView::closeView() emit wantsCloseTab(tabIndex()); } -void TabbedWebView::openNewTab() +void TabbedWebView::openNewTab(Qz::NewTabPositionFlags position) { if (m_window) { - m_window->tabWidget()->addView(QUrl()); + m_window->tabWidget()->addView(QUrl(), position); } } diff --git a/src/lib/webtab/tabbedwebview.h b/src/lib/webtab/tabbedwebview.h index 55c949139..c45895d98 100644 --- a/src/lib/webtab/tabbedwebview.h +++ b/src/lib/webtab/tabbedwebview.h @@ -59,7 +59,7 @@ public slots: void userLoadAction(const LoadRequest &req); void closeView(); - void openNewTab(); + void openNewTab(Qz::NewTabPositionFlags position); void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position); private slots: diff --git a/src/main/main.cpp b/src/main/main.cpp index d7ea1a454..4d18f2e2e 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -170,7 +170,7 @@ int main(int argc, char* argv[]) // Hack to fix QT_STYLE_OVERRIDE with QProxyStyle const QByteArray style = qgetenv("QT_STYLE_OVERRIDE"); if (!style.isEmpty()) { - char **args = (char**) malloc(sizeof(char*) * (argc + 1)); + char** args = (char**) malloc(sizeof(char*) * (argc + 1)); for (int i = 0; i < argc; ++i) args[i] = argv[i]; diff --git a/src/plugins/MouseGestures/mousegestures.cpp b/src/plugins/MouseGestures/mousegestures.cpp index e4bed93b6..481776e26 100644 --- a/src/plugins/MouseGestures/mousegestures.cpp +++ b/src/plugins/MouseGestures/mousegestures.cpp @@ -183,7 +183,7 @@ void MouseGestures::downGestured() return; } - m_view.data()->openUrlInNewTab(QUrl(), Qz::NT_SelectedNewEmptyTab); + m_view.data()->openNewTab(Qz::NT_SelectedNewEmptyTab); } void MouseGestures::leftGestured()