summaryrefslogtreecommitdiff
path: root/src/webview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-01-23 23:23:51 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-01-23 23:23:51 +0100
commitade414e7ec17d267ba2382fadd6be2ed9ea89a45 (patch)
tree465388204a3fdf507df263f3c58e8d67e58be637 /src/webview.cpp
parentBe sure you need to resolv url... (diff)
downloadrekonq-ade414e7ec17d267ba2382fadd6be2ed9ea89a45.tar.xz
Here we are, with this commit I removed a lot of direct calls to
Application::loadUrl slot and changed it to signals emitted there. This to let rekonq managing them and faster return to the main event loop (and hopefully don't freeze). Next step here is change loadUrl slot to a multithreaded one.
Diffstat (limited to 'src/webview.cpp')
-rw-r--r--src/webview.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index c2183749..3936ed3c 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -33,7 +33,6 @@
#include "rekonq.h"
// Local Includes
-#include "application.h"
#include "mainwindow.h"
#include "mainview.h"
#include "webpage.h"
@@ -69,8 +68,18 @@ WebView::WebView(QWidget* parent)
setPage(m_page);
// download system
- connect(this, SIGNAL(linkShiftClicked(const KUrl &)), m_page, SLOT(downloadUrl(const KUrl &)));
- connect(m_page, SIGNAL(downloadRequested(const QNetworkRequest &)), m_page, SLOT(downloadRequest(const QNetworkRequest &)));
+ connect(this, SIGNAL(linkShiftClicked(const KUrl &)),
+ m_page, SLOT(downloadUrl(const KUrl &)));
+ connect(m_page, SIGNAL(downloadRequested(const QNetworkRequest &)),
+ m_page, SLOT(downloadRequest(const QNetworkRequest &)));
+
+ // middle click || ctrl + click signal
+ connect(this, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)),
+ this, SLOT(loadUrlInNewTab(const KUrl &)) );
+
+ // loadUrl signal
+ connect(this, SIGNAL(loadUrl(const KUrl &, const Rekonq::OpenType &)),
+ Application::instance(), SLOT(loadUrl(const KUrl &, const Rekonq::OpenType &)));
}
@@ -341,7 +350,8 @@ void WebView::search()
KAction *a = qobject_cast<KAction*>(sender());
QString search = a->data().toString() + selectedText();
KUrl urlSearch = KUrl::fromEncoded(search.toUtf8());
- Application::instance()->loadUrl(urlSearch, Rekonq::NewCurrentTab);
+
+ emit loadUrl(urlSearch, Rekonq::NewCurrentTab);
}
@@ -358,11 +368,11 @@ void WebView::viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifier
if (modifiers & Qt::ControlModifier || buttons == Qt::MidButton)
{
- Application::instance()->loadUrl(url, Rekonq::SettingOpenTab);
+ emit loadUrl(url, Rekonq::SettingOpenTab);
}
else
{
- Application::instance()->loadUrl(url, Rekonq::CurrentTab);
+ emit loadUrl(url, Rekonq::CurrentTab);
}
}
@@ -371,7 +381,8 @@ void WebView::openLinkInNewWindow()
{
KAction *a = qobject_cast<KAction*>(sender());
KUrl url(a->data().toUrl());
- Application::instance()->loadUrl(url, Rekonq::NewWindow);
+
+ emit loadUrl(url, Rekonq::NewWindow);
}
@@ -379,7 +390,8 @@ void WebView::openLinkInNewTab()
{
KAction *a = qobject_cast<KAction*>(sender());
KUrl url(a->data().toUrl());
- Application::instance()->loadUrl(url, Rekonq::SettingOpenTab);
+
+ emit loadUrl(url, Rekonq::SettingOpenTab);
}
@@ -407,3 +419,9 @@ void WebView::inspect()
if(a && !a->isChecked())
a->trigger();
}
+
+
+void WebView::loadUrlInNewTab(const KUrl &url)
+{
+ emit loadUrl(url, Rekonq::SettingOpenTab);
+}