From 870695c758a213a54aa2b2db9ba8bb9de83724ba Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 23 Nov 2011 12:51:58 +0200 Subject: Initial commit --- disableplugins.cpp | 22 ++++++++++++++++++++++ disableplugins.pro | 8 ++++++++ 2 files changed, 30 insertions(+) create mode 100644 disableplugins.cpp create mode 100644 disableplugins.pro diff --git a/disableplugins.cpp b/disableplugins.cpp new file mode 100644 index 0000000..04976de --- /dev/null +++ b/disableplugins.cpp @@ -0,0 +1,22 @@ +#include +#include +#include + +typedef QWebSettings*(*func_t)(); +QWebSettings *QWebSettings::globalSettings(){ + void *handle = NULL; + const char library[] = "/usr/lib64/libQtWebKit.so.4.9.0"; + static func_t real_func = NULL; + handle = dlopen(library, RTLD_LAZY); + + if (handle == NULL) { + fprintf(stderr, "Failed to dlopen %s\n", library); + fprintf(stderr, "dlerror says: %s\n", dlerror()); + return NULL; + } + real_func = (func_t)dlsym(handle, "_ZN12QWebSettings14globalSettingsEv"); + QWebSettings *s = real_func(); + s->setAttribute(QWebSettings::PluginsEnabled, false); + return s; +} + diff --git a/disableplugins.pro b/disableplugins.pro new file mode 100644 index 0000000..d884283 --- /dev/null +++ b/disableplugins.pro @@ -0,0 +1,8 @@ +QT += webkit +TEMPLATE = lib +TARGET = disableplugins +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += disableplugins.cpp -- cgit