summaryrefslogtreecommitdiffstats
path: root/disableplugins.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'disableplugins.cpp')
-rw-r--r--disableplugins.cpp22
1 files changed, 22 insertions, 0 deletions
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 <stdio.h>
+#include <dlfcn.h>
+#include <QWebSettings>
+
+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;
+}
+