diff options
Diffstat (limited to 'src/webview.cpp')
-rw-r--r-- | src/webview.cpp | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/webview.cpp b/src/webview.cpp index 292eb364..232a2633 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" @@ -60,6 +59,7 @@ #include <QtDBus/QDBusReply> #include <QDir> + WebView::WebView(QWidget* parent) : KWebView(parent, false) , m_page( new WebPage(this) ) @@ -68,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 &))); } @@ -268,7 +278,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) if (ReKonfig::kgetList()) { - a = new KAction(KIcon("kget"), i18n("List all links"), this); + a = new KAction(KIcon("kget"), i18n("List All Links"), this); connect(a, SIGNAL(triggered(bool)), page(), SLOT(downloadAllContentsWithKGet())); menu.addAction(a); } @@ -340,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); } @@ -357,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); } } @@ -370,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); } @@ -378,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); } @@ -406,3 +419,9 @@ void WebView::inspect() if(a && !a->isChecked()) a->trigger(); } + + +void WebView::loadUrlInNewTab(const KUrl &url) +{ + emit loadUrl(url, Rekonq::SettingOpenTab); +} |