diff options
author | megabigbug <megabigbug@arrakis.(none)> | 2009-07-31 21:43:28 +0200 |
---|---|---|
committer | megabigbug <megabigbug@arrakis.(none)> | 2009-07-31 21:43:28 +0200 |
commit | 8ee38c561d2fd4d19de8c916139f7c88736636c2 (patch) | |
tree | eced0b78d349ae7ad9c758661272abeec71d117f /src | |
parent | This commit removes rekonq KDEnetwork dependencies. (diff) | |
download | rekonq-8ee38c561d2fd4d19de8c916139f7c88736636c2.tar.xz |
Fix tab in background feature
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 44 | ||||
-rw-r--r-- | src/mainview.cpp | 6 | ||||
-rw-r--r-- | src/mainview.h | 2 | ||||
-rw-r--r-- | src/webpage.cpp | 2 |
4 files changed, 22 insertions, 32 deletions
diff --git a/src/application.cpp b/src/application.cpp index 623c3034..06e67218 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -283,35 +283,25 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) // this should let rekonq to support the beautiful KDE web browsing shortcuts loadingUrl = KUriFilter::self()->filteredUri(loadingUrl); - WebView *webView; - if( type == Rekonq::CurrentTab ) - { - webView = m_mainWindow->currentTab(); - m_mainWindow->mainView()->currentUrlBar()->setUrl(loadingUrl.prettyUrl()); - } - else + WebView *webView=m_mainWindow->mainView()->currentWebView(); + + switch(type) { - webView = m_mainWindow->mainView()->newTab(); - m_mainWindow->mainView()->currentUrlBar()->setUrl(loadingUrl.prettyUrl()); + case Rekonq::SettingOpenTab: + webView = m_mainWindow->mainView()->newTab(!ReKonfig::openTabsBack()); + break; + case Rekonq::NewTab: + webView = m_mainWindow->mainView()->newTab(true); + break; + case Rekonq::BackgroundTab: + webView = m_mainWindow->mainView()->newTab(false); + break; + case Rekonq::CurrentTab: // nothing to do here.. just to save a warning!! + break; + }; + + m_mainWindow->mainView()->currentUrlBar()->setUrl(loadingUrl.prettyUrl()); - switch(type) - { - case Rekonq::SettingOpenTab: - if (!ReKonfig::openTabsBack()) - { - m_mainWindow->mainView()->setCurrentWidget(webView); // this method does NOT take ownership of webView - } - break; - case Rekonq::NewTab: - m_mainWindow->mainView()->setCurrentWidget(webView); // this method does NOT take ownership of webView - break; - case Rekonq::BackgroundTab: // no need for focus here - break; - case Rekonq::CurrentTab: // nothing to do here.. just to save a warning!! - break; - }; - } - if (webView) { webView->setFocus(); diff --git a/src/mainview.cpp b/src/mainview.cpp index 22a03242..8c1de1f6 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -350,7 +350,7 @@ WebView *MainView::webView(int index) const } -WebView *MainView::newTab() +WebView *MainView::newTab(bool focus) { // line edit UrlBar *urlBar = new UrlBar; // Ownership of widget is passed on to the QStackedWidget (addWidget method). @@ -380,8 +380,8 @@ WebView *MainView::newTab() connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *))); addTab(webView, i18n("(Untitled)")); + if (focus) setCurrentWidget(webView); - setCurrentWidget(webView); // this method does NOT take ownership of webView urlBar->setFocus(); emit tabsChanged(); @@ -662,7 +662,7 @@ QLabel *MainView::animatedLoading(int index, bool addMovie) } -void MainView::mouseDoubleClickEvent(QMouseEvent *event) +void MainView::mouseDoubleClickEvent(QMouseEvent *event) //WARNING Need to be fix { if (!childAt(event->pos())) { diff --git a/src/mainview.h b/src/mainview.h index 49000434..99693ed6 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -102,7 +102,7 @@ public slots: * * @return a pointer to the new WebView */ - WebView *newTab(); + WebView *newTab(bool focus = true); void slotCloneTab(int index = -1); void slotCloseTab(int index = -1); diff --git a/src/webpage.cpp b/src/webpage.cpp index 771b7f04..7938208a 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -90,7 +90,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r { if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton) { - Application::instance()->loadUrl(request.url(), Rekonq::NewTab); + Application::instance()->loadUrl(request.url(), Rekonq::SettingOpenTab); m_keyboardModifiers = Qt::NoModifier; m_pressedButtons = Qt::NoButton; return false; |