summaryrefslogtreecommitdiff
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
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.
-rw-r--r--src/previewimage.cpp8
-rw-r--r--src/previewimage.h4
-rw-r--r--src/webtab.cpp8
-rw-r--r--src/webtab.h4
-rw-r--r--src/webview.cpp34
-rw-r--r--src/webview.h9
6 files changed, 45 insertions, 22 deletions
diff --git a/src/previewimage.cpp b/src/previewimage.cpp
index 80757ca2..9c8bb194 100644
--- a/src/previewimage.cpp
+++ b/src/previewimage.cpp
@@ -29,7 +29,6 @@
#include "previewimage.moc"
// Local Includes
-#include "application.h"
#include "historymanager.h"
#include "rekonq.h"
#include "mainwindow.h"
@@ -103,6 +102,9 @@ PreviewImage::PreviewImage(const QUrl &url, const QString &title, int index, boo
layout()->setAlignment(Qt::AlignCenter);
layout()->addWidget(m_previewLabel);
+ connect(this, SIGNAL(loadUrl(const KUrl &, const Rekonq::OpenType &)),
+ Application::instance(), SLOT(loadUrl(const KUrl &, const Rekonq::OpenType &)));
+
loadUrlPreview(url);
}
@@ -260,12 +262,12 @@ void PreviewImage::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::LeftButton)
{
- Application::instance()->loadUrl(m_url);
+ emit loadUrl(m_url, Rekonq::CurrentTab);
return;
}
else if(event->button() == Qt::MidButton)
{
- Application::instance()->loadUrl(m_url, Rekonq::SettingOpenTab);
+ emit loadUrl(m_url, Rekonq::SettingOpenTab);
return;
}
diff --git a/src/previewimage.h b/src/previewimage.h
index e9504210..4dd8df3b 100644
--- a/src/previewimage.h
+++ b/src/previewimage.h
@@ -29,6 +29,7 @@
// Local Includes
#include "websnap.h"
+#include "application.h"
// KDE Includes
#include <KActionMenu>
@@ -58,6 +59,9 @@ public slots:
void setUrlFromAction();
void refreshPreview();
+signals:
+ void loadUrl(const KUrl &, const Rekonq::OpenType &);
+
protected:
void contextMenuEvent(QContextMenuEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
diff --git a/src/webtab.cpp b/src/webtab.cpp
index 908fc7a3..3ff69a2f 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -91,8 +91,6 @@ WebTab::WebTab(QWidget* parent)
connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int)));
connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
-
- connect(m_view, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)), this, SLOT(loadInNewTab(const KUrl &)) );
}
@@ -150,12 +148,6 @@ void WebTab::loadFinished(bool)
}
-void WebTab::loadInNewTab(const KUrl &url)
-{
- Application::instance()->loadUrl(url, Rekonq::SettingOpenTab);
-}
-
-
void WebTab::createWalletBar(const QString &key, const QUrl &url)
{
KWebWallet *wallet = page()->wallet();
diff --git a/src/webtab.h b/src/webtab.h
index 2eb8d733..ecf8e5b3 100644
--- a/src/webtab.h
+++ b/src/webtab.h
@@ -57,10 +57,8 @@ private slots:
void updateProgress(int progress);
void loadFinished(bool);
- void loadInNewTab(const KUrl &url);
-
void createWalletBar(const QString &, const QUrl &);
-
+
private:
WebView *const m_view;
int m_progress;
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);
+}
diff --git a/src/webview.h b/src/webview.h
index d34d108b..263b2ec4 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -28,12 +28,16 @@
#ifndef WEBVIEW_H
#define WEBVIEW_H
+// Local Includes
+#include "application.h"
+
// KDE Includes
#include <KWebView>
// Forward Declarations
class WebPage;
+
class WebView : public KWebView
{
Q_OBJECT
@@ -56,11 +60,16 @@ private slots:
void printFrame();
+ void loadUrlInNewTab(const KUrl &);
void openLinkInNewWindow();
void openLinkInNewTab();
+
void viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
void inspect();
+signals:
+ void loadUrl(const KUrl &, const Rekonq::OpenType &);
+
private:
WebPage *const m_page;
QPoint m_mousePos;