From 8133bde2b48b8a9881812e9d04e58ae41697698f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 24 Jul 2009 10:32:27 +0200 Subject: Trivial fix. Yesterday was late night ;) This patch lets rekonq to load url in.. the current page instead of loading infinite new tabs... :) --- src/application.cpp | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'src/application.cpp') diff --git a/src/application.cpp b/src/application.cpp index e7ea9f23..8581c56d 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -97,12 +97,13 @@ int Application::newInstance() { for (int i = 0; i < args->count(); ++i) { - loadUrl(args->arg(i), Rekonq::New); + loadUrl(args->arg(i), Rekonq::NewTab); } args->clear(); } else { + m_mainWindow->mainView()->newTab(); m_mainWindow->slotHome(); } @@ -310,25 +311,35 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) loadingUrl.setUrl( QString("http://en.wikipedia.org/wiki/%1").arg(str) ); } - - WebView *webView = m_mainWindow->mainView()->newTab(); - m_mainWindow->mainView()->currentUrlBar()->setUrl(loadingUrl.prettyUrl()); - - switch(type) + WebView *webView; + if( type == Rekonq::CurrentTab ) + { + webView = m_mainWindow->currentTab(); + m_mainWindow->mainView()->currentUrlBar()->setUrl(loadingUrl.prettyUrl()); + } + else { - case Rekonq::Default: - if (!ReKonfig::openTabsBack()) + webView = m_mainWindow->mainView()->newTab(); + 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::New: - m_mainWindow->mainView()->setCurrentWidget(webView); // this method does NOT take ownership of webView - break; - case Rekonq::Background: - break; - }; - + 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(); -- cgit v1.2.1