summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-04-07 17:42:38 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-04-07 17:42:38 +0200
commitde678704a0b62e2d6ddf6968f78c145b8e00b749 (patch)
tree56553dc088800f13c086e230737f11a70a74cab7
parentAdd bool info in WebTab about being a web app (diff)
downloadrekonq-de678704a0b62e2d6ddf6968f78c145b8e00b749.tar.xz
Clean up url loading
-rw-r--r--src/application.cpp5
-rw-r--r--src/searchengine.cpp2
-rw-r--r--src/urlresolver.cpp13
-rw-r--r--src/webtab/webview.cpp25
4 files changed, 25 insertions, 20 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 3a76a6de..172a0e22 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -565,6 +565,11 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
else
{
w = rekonqWindow();
+ if (!w)
+ {
+ w = newWindow();
+ newType = Rekonq::CurrentTab;
+ }
}
w->loadUrl(url, newType);
diff --git a/src/searchengine.cpp b/src/searchengine.cpp
index 21a9f92d..40e26f42 100644
--- a/src/searchengine.cpp
+++ b/src/searchengine.cpp
@@ -158,6 +158,8 @@ QString SearchEngine::buildQuery(const QString &text)
return query;
}
+
+
QString SearchEngine::buildQuery(KService::Ptr engine, const QString &text)
{
if (!engine)
diff --git a/src/urlresolver.cpp b/src/urlresolver.cpp
index 6b245c0c..3e764159 100644
--- a/src/urlresolver.cpp
+++ b/src/urlresolver.cpp
@@ -49,14 +49,11 @@ KUrl UrlResolver::urlFromTextTyped(const QString &typedText)
QString typedString = typedText.trimmed();
// Url from KService
- KService::Ptr engine = SearchEngine::fromString(typedString);
- if (engine)
- {
- QString url = SearchEngine::buildQuery(typedString);
-
- kDebug() << "Url from service: " << url;
- return KUrl(url);
- }
+ QString urlString = SearchEngine::buildQuery(typedString);
+ kDebug() << "Url from service: " << urlString;
+ KUrl u(urlString);
+ if (u.isValid())
+ return u;
// Url from User Input
QUrl urlFromUserInput = QUrl::fromUserInput(typedString);
diff --git a/src/webtab/webview.cpp b/src/webtab/webview.cpp
index 2d8d0e77..91bd838c 100644
--- a/src/webtab/webview.cpp
+++ b/src/webtab/webview.cpp
@@ -285,7 +285,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
}
WebWindow *webwin = m_parentTab->webWindow();
-
+
KMenu menu(this);
KAction *sendByMailAction = new KAction(&menu);
@@ -400,7 +400,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(a);
}
- if (webwin)
+ if (!m_parentTab->isWebApp())
{
a = new KAction(KIcon("view-media-artist"), i18n("Open in Private &Window"), &menu);
a->setData(m_contextMenuHitResult.linkUrl());
@@ -535,10 +535,13 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
searchMenu->addAction(a);
}
- a = new KAction(KIcon("edit-find"), i18n("On Current Page"), &menu);
- connect(a, SIGNAL(triggered()), webwin, SLOT(findSelectedText()));
- searchMenu->addAction(a);
-
+ if (webwin)
+ {
+ a = new KAction(KIcon("edit-find"), i18n("On Current Page"), &menu);
+ connect(a, SIGNAL(triggered()), webwin, SLOT(findSelectedText()));
+ searchMenu->addAction(a);
+ }
+
if (!searchMenu->menu()->isEmpty())
{
menu.addAction(searchMenu);
@@ -556,7 +559,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
}
else
{
- if (webwin)
+ if (!m_parentTab->isWebApp() && webwin)
{
a = webwin->actionByName(KStandardAction::name(KStandardAction::AddBookmark));
menu.addAction(a);
@@ -803,12 +806,10 @@ void WebView::openLinkInNewTab()
KAction *a = qobject_cast<KAction*>(sender());
KUrl url(a->data().toUrl());
- WebWindow *webwin = m_parentTab->webWindow();
-
- if (webwin)
- emit loadUrl(url, Rekonq::NewTab);
- else
+ if (m_parentTab->isWebApp())
emit loadUrl(url, Rekonq::NewFocusedTab);
+ else
+ emit loadUrl(url, Rekonq::NewTab);
}