From e81948d7b150c47e6776d87f8095de52a340b02d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 5 Dec 2012 18:09:44 +0100 Subject: Fix open external link on web app --- src/application.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/application.cpp') diff --git a/src/application.cpp b/src/application.cpp index 409e2a1d..0f15c3e8 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -36,10 +36,14 @@ // Local Includes #include "searchengine.h" + #include "tabbar.h" #include "tabwindow.h" + #include "webwindow.h" #include "webtab.h" +#include "webpage.h" + #include "urlresolver.h" // Local Manager(s) Includes @@ -134,6 +138,7 @@ int Application::newInstance() kDebug() << "URL: " << u; WebTab *tab = newWebApp(); + connect(tab->page(), SIGNAL(pageCreated(WebPage *)), this, SLOT(pageCreated(WebPage *))); tab->view()->load(u); if (isFirstLoad) @@ -830,3 +835,31 @@ void Application::newPrivateBrowsingWindow() // NOTE: what about an "about:incognito" page? loadUrl(KUrl("about:home"), Rekonq::NewPrivateWindow); } + + +void Application::pageCreated(WebPage *pg) +{ + if (m_tabWindows.isEmpty()) + { + // NOTE: This is "adjusted" from newTabWindow() code... + TabWindow *w = new TabWindow(pg); + + // set object name + int n = m_tabWindows.count() + 1; + w->setObjectName(QL1S("win") + QString::number(n)); + + // This is used to track which window was activated most recently + w->installEventFilter(this); + + m_tabWindows.prepend(w); + w->show(); + + return; + } + + TabWindow *tw = tabWindow(); + tw->newTab(pg); + + tw->activateWindow(); + tw->raise(); +} -- cgit v1.2.1