From 15fa02f9fe0c2043ba229b7a8e265e8b74dd1410 Mon Sep 17 00:00:00 2001 From: Domrachev Alexandr Date: Sun, 13 Sep 2009 21:52:45 +0400 Subject: Open links in new tab located near currently active tab --- src/application.cpp | 5 +++-- src/mainview.cpp | 7 +++++-- src/mainview.h | 3 ++- src/rekonq.kcfg | 3 +++ src/settings_general.ui | 11 +++++++++-- 5 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index ab4b3edf..4c819aba 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -355,7 +355,8 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) switch(type) { case Rekonq::SettingOpenTab: - webView = w->mainView()->newWebView(!ReKonfig::openTabsBack()); + webView = w->mainView()->newWebView(!ReKonfig::openTabsBack(), + ReKonfig::openTabsNearCurrent()); if (!ReKonfig::openTabsBack()) { w->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl()); @@ -366,7 +367,7 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) w->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl()); break; case Rekonq::NewBackTab: - webView = w->mainView()->newWebView(false); + webView = w->mainView()->newWebView(false, ReKonfig::openTabsNearCurrent()); break; case Rekonq::NewWindow: case Rekonq::CurrentTab: diff --git a/src/mainview.cpp b/src/mainview.cpp index 7c91b992..c28953d7 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -256,7 +256,7 @@ WebView *MainView::webView(int index) const } -WebView *MainView::newWebView(bool focused) +WebView *MainView::newWebView(bool focused, bool nearParent) { WebView *webView = new WebView; // should be deleted on tab close? @@ -274,7 +274,10 @@ WebView *MainView::newWebView(bool focused) connect(webView->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *))); - addTab(webView, i18n("(Untitled)")); + if (nearParent) + insertTab(currentIndex() + 1, webView, i18n("(Untitled)")); + else + addTab(webView, i18n("(Untitled)")); if (focused) { diff --git a/src/mainview.h b/src/mainview.h index c59cca1a..4eb1d4bd 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -84,9 +84,10 @@ public: * with a webview inside * @param focused decide if you wannna give focus * (or not) to this new tab (default true) + * @param nearParent decide if you wanna create new tab near current or not * @return the webview embedded in the new tab */ - WebView *newWebView(bool focused = true); + WebView *newWebView(bool focused = true, bool nearParent = false); signals: // tab widget signals diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 401ce58c..04115ac8 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -35,6 +35,9 @@ false + + false + diff --git a/src/settings_general.ui b/src/settings_general.ui index fe1ec457..6de49e64 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -6,8 +6,8 @@ 0 0 - 442 - 369 + 438 + 371 @@ -139,6 +139,13 @@ + + + + Open new tabs near currently active + + + -- cgit v1.2.1