diff options
-rw-r--r-- | src/application.cpp | 5 | ||||
-rw-r--r-- | src/mainview.cpp | 8 | ||||
-rw-r--r-- | src/mainview.h | 3 | ||||
-rw-r--r-- | src/rekonq.kcfg | 3 | ||||
-rw-r--r-- | src/settings_general.ui | 11 |
5 files changed, 22 insertions, 8 deletions
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 accc1610..a662bbb0 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -258,7 +258,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? @@ -276,8 +276,10 @@ WebView *MainView::newWebView(bool focused) connect(webView->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *))); - // opening tab NEAR the previous - insertTab(currentIndex() + 1, 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 8a5c5cfa..297871b0 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -86,9 +86,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 16a77d2c..3de675f8 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -49,6 +49,9 @@ <entry name="openTabsBack" type="Bool"> <default>false</default> </entry> + <entry name="openTabsNearCurrent" type="Bool"> + <default>false</default> + </entry> </group> <!-- Fonts Settings --> 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 @@ <rect> <x>0</x> <y>0</y> - <width>442</width> - <height>369</height> + <width>438</width> + <height>371</height> </rect> </property> <property name="windowTitle"> @@ -139,6 +139,13 @@ </property> </widget> </item> + <item> + <widget class="QCheckBox" name="kcfg_openTabsNearCurrent"> + <property name="text"> + <string>Open new tabs near currently active</string> + </property> + </widget> + </item> </layout> </widget> </item> |