summaryrefslogtreecommitdiffstats
path: root/disableplugins.cpp
blob: 04976de22dcc2f9f8edf18cb985ff0bbfbbf69e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
}