diff options
author | Domrachev Alexandr <alexandr.domrachev@gmail.com> | 2009-09-13 21:52:45 +0400 |
---|---|---|
committer | Domrachev Alexandr <alexandr.domrachev@gmail.com> | 2009-09-13 21:52:45 +0400 |
commit | 15fa02f9fe0c2043ba229b7a8e265e8b74dd1410 (patch) | |
tree | 38564f66fe23ddba40aff62a91466c3d5bf577cc | |
parent | Bugfix: when trying to open link in new tab & network request fails (no (diff) | |
download | rekonq-15fa02f9fe0c2043ba229b7a8e265e8b74dd1410.tar.xz |
Open links in new tab located near currently active tab
-rw-r--r-- | src/application.cpp | 5 | ||||
-rw-r--r-- | src/mainview.cpp | 7 | ||||
-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, 7 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 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 @@ <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> |