summaryrefslogtreecommitdiff
path: root/src/webview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-02-13 22:48:51 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-03-13 10:24:42 +0100
commit908a1dbfb08c30ae2a92ce7f6e36a9e88e8b5d09 (patch)
treec9bcf7d01b3553ad934bea9e1279a02e409accfb /src/webview.cpp
parentAdd adblock icon to inform users that some contents was hidden (diff)
downloadrekonq-908a1dbfb08c30ae2a92ce7f6e36a9e88e8b5d09.tar.xz
Let rekonq block sparse images (this idea has been copied from Arora)
Diffstat (limited to 'src/webview.cpp')
-rw-r--r--src/webview.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index 80f021fc..3d4d7dcf 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -34,6 +34,7 @@
// Local Includes
#include "application.h"
+#include "adblockmanager.h"
#include "bookmarkmanager.h"
#include "iconmanager.h"
#include "mainview.h"
@@ -285,6 +286,14 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
a->setData(result.imageUrl());
connect(a, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(slotCopyImageLocation()));
menu.addAction(a);
+
+ if (rApp->adblockManager()->isEnabled())
+ {
+ a = new KAction(KIcon("preferences-web-browser-adblock"), i18n("Block image"), this);
+ a->setData(result.imageUrl());
+ connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(blockImage()));
+ menu.addAction(a);
+ }
}
// ACTIONS FOR TEXT SELECTION -----------------------------------------------------
@@ -1213,3 +1222,13 @@ void WebView::sendByMail()
KToolInvocation::invokeMailer("", "", "", "", url);
}
+
+void WebView::blockImage()
+{
+ QAction *action = qobject_cast<QAction*>(sender());
+ if (!action)
+ return;
+
+ QString imageUrl = action->data().toString();
+ rApp->adblockManager()->addCustomRule(imageUrl);
+}