From 33c3e5147d3fb1a0949e800049eb9db0852bd3c3 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 11 Jan 2010 16:46:50 +0000 Subject: [PATCH] Added missing adblock plugin files git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1073116 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- konq-plugins/adblock/Makefile.am | 15 + konq-plugins/adblock/Makefile.in | 812 ++++++++++++++++++++ konq-plugins/adblock/adblock.cpp | 268 +++++++ konq-plugins/adblock/adblock.h | 99 +++ konq-plugins/adblock/adblockdialogue.cpp | 163 ++++ konq-plugins/adblock/adblockdialogue.h | 76 ++ konq-plugins/adblock/plugin_adblock.desktop | 16 + konq-plugins/adblock/plugin_adblock.rc | 3 + 8 files changed, 1452 insertions(+) create mode 100644 konq-plugins/adblock/Makefile.am create mode 100644 konq-plugins/adblock/Makefile.in create mode 100644 konq-plugins/adblock/adblock.cpp create mode 100644 konq-plugins/adblock/adblock.h create mode 100644 konq-plugins/adblock/adblockdialogue.cpp create mode 100644 konq-plugins/adblock/adblockdialogue.h create mode 100644 konq-plugins/adblock/plugin_adblock.desktop create mode 100644 konq-plugins/adblock/plugin_adblock.rc diff --git a/konq-plugins/adblock/Makefile.am b/konq-plugins/adblock/Makefile.am new file mode 100644 index 0000000..47c4074 --- /dev/null +++ b/konq-plugins/adblock/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = libadblock.la + +libadblock_la_SOURCES = adblock.cpp adblockdialogue.cpp +libadblock_la_LIBADD = $(LIB_KHTML) -lkonq +libadblock_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +pluginsdir = $(kde_datadir)/khtml/kpartplugins +plugins_DATA = plugin_adblock.rc plugin_adblock.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/adblockplugin.pot diff --git a/konq-plugins/adblock/Makefile.in b/konq-plugins/adblock/Makefile.in new file mode 100644 index 0000000..4b7ece5 --- /dev/null +++ b/konq-plugins/adblock/Makefile.in @@ -0,0 +1,812 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision: 483858 $ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +ARTSCCONFIG = @ARTSCCONFIG@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BERKELEY_DB_LIBS = @BERKELEY_DB_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DCOPIDL = @DCOPIDL@ +DCOPIDL2CPP = @DCOPIDL2CPP@ +DCOPIDLNG = @DCOPIDLNG@ +DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_PERMISSIVE_FLAG = @ENABLE_PERMISSIVE_FLAG@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +HAVE_GCC_VISIBILITY = @HAVE_GCC_VISIBILITY@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KCFG_DEPENDENCIES = @KCFG_DEPENDENCIES@ +KCONFIG_COMPILER = @KCONFIG_COMPILER@ +KDECONFIG = @KDECONFIG@ +KDE_CHECK_PLUGIN = @KDE_CHECK_PLUGIN@ +KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ +KDE_INCLUDES = @KDE_INCLUDES@ +KDE_LDFLAGS = @KDE_LDFLAGS@ +KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@ +KDE_MT_LIBS = @KDE_MT_LIBS@ +KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_RPATH = @KDE_RPATH@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +KDE_USE_FPIE = @KDE_USE_FPIE@ +KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@ +KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@ +KDE_USE_PIE = @KDE_USE_PIE@ +KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ +LDFLAGS = @LDFLAGS@ +LDFLAGS_AS_NEEDED = @LDFLAGS_AS_NEEDED@ +LDFLAGS_NEW_DTAGS = @LDFLAGS_NEW_DTAGS@ +LIBCOMPAT = @LIBCOMPAT@ +LIBCRYPT = @LIBCRYPT@ +LIBDL = @LIBDL@ +LIBJPEG = @LIBJPEG@ +LIBKSTAT = @LIBKSTAT@ +LIBOBJS = @LIBOBJS@ +LIBPNG = @LIBPNG@ +LIBPTHREAD = @LIBPTHREAD@ +LIBRESOLV = @LIBRESOLV@ +LIBS = @LIBS@ +LIBSM = @LIBSM@ +LIBSOCKET = @LIBSOCKET@ +LIBSSL = @LIBSSL@ +LIBTOOL = @LIBTOOL@ +LIBUCB = @LIBUCB@ +LIBUTIL = @LIBUTIL@ +LIBZ = @LIBZ@ +LIB_KAB = @LIB_KAB@ +LIB_KABC = @LIB_KABC@ +LIB_KDECORE = @LIB_KDECORE@ +LIB_KDED = @LIB_KDED@ +LIB_KDEPIM = @LIB_KDEPIM@ +LIB_KDEPRINT = @LIB_KDEPRINT@ +LIB_KDEUI = @LIB_KDEUI@ +LIB_KDNSSD = @LIB_KDNSSD@ +LIB_KFILE = @LIB_KFILE@ +LIB_KFM = @LIB_KFM@ +LIB_KHTML = @LIB_KHTML@ +LIB_KIMPROXY = @LIB_KIMPROXY@ +LIB_KIO = @LIB_KIO@ +LIB_KJS = @LIB_KJS@ +LIB_KNEWSTUFF = @LIB_KNEWSTUFF@ +LIB_KPARTS = @LIB_KPARTS@ +LIB_KSPELL = @LIB_KSPELL@ +LIB_KSYCOCA = @LIB_KSYCOCA@ +LIB_KUNITTEST = @LIB_KUNITTEST@ +LIB_KUTILS = @LIB_KUTILS@ +LIB_POLL = @LIB_POLL@ +LIB_QPE = @LIB_QPE@ +LIB_QT = @LIB_QT@ +LIB_SMB = @LIB_SMB@ +LIB_X11 = @LIB_X11@ +LIB_XEXT = @LIB_XEXT@ +LIB_XRENDER = @LIB_XRENDER@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MAKEKDEWIDGETS = @MAKEKDEWIDGETS@ +MCOPIDL = @MCOPIDL@ +MEINPROC = @MEINPROC@ +MOC = @MOC@ +MSGFMT = @MSGFMT@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +QTE_NORTTI = @QTE_NORTTI@ +QT_INCLUDES = @QT_INCLUDES@ +QT_LDFLAGS = @QT_LDFLAGS@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_INCLUDES = @SSL_INCLUDES@ +SSL_LDFLAGS = @SSL_LDFLAGS@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +UIC = @UIC@ +UIC_TR = @UIC_TR@ +USER_INCLUDES = @USER_INCLUDES@ +USER_LDFLAGS = @USER_LDFLAGS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +USE_THREADS = @USE_THREADS@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +XGETTEXT = @XGETTEXT@ +XMKMF = @XMKMF@ +XMLLINT = @XMLLINT@ +XMMS_INCLUDES = @XMMS_INCLUDES@ +XMMS_LIBS = @XMMS_LIBS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_INCLUDES = @X_INCLUDES@ +X_LDFLAGS = @X_LDFLAGS@ +X_PRE_LIBS = @X_PRE_LIBS@ +X_RPATH = @X_RPATH@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +atlantikdesigner_SUBDIR_included_FALSE = @atlantikdesigner_SUBDIR_included_FALSE@ +atlantikdesigner_SUBDIR_included_TRUE = @atlantikdesigner_SUBDIR_included_TRUE@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +doc_SUBDIR_included_FALSE = @doc_SUBDIR_included_FALSE@ +doc_SUBDIR_included_TRUE = @doc_SUBDIR_included_TRUE@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +include_ARTS_FALSE = @include_ARTS_FALSE@ +include_ARTS_TRUE = @include_ARTS_TRUE@ +include_BERKELEY_DB_FALSE = @include_BERKELEY_DB_FALSE@ +include_BERKELEY_DB_TRUE = @include_BERKELEY_DB_TRUE@ +include_SDL_FALSE = @include_SDL_FALSE@ +include_SDL_TRUE = @include_SDL_TRUE@ +include_kfileplugin_cert_SUBDIR_FALSE = @include_kfileplugin_cert_SUBDIR_FALSE@ +include_kfileplugin_cert_SUBDIR_TRUE = @include_kfileplugin_cert_SUBDIR_TRUE@ +include_noatunplugin_FALSE = @include_noatunplugin_FALSE@ +include_noatunplugin_TRUE = @include_noatunplugin_TRUE@ +include_x11_FALSE = @include_x11_FALSE@ +include_x11_TRUE = @include_x11_TRUE@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +kaddressbook_plugins_SUBDIR_included_FALSE = @kaddressbook_plugins_SUBDIR_included_FALSE@ +kaddressbook_plugins_SUBDIR_included_TRUE = @kaddressbook_plugins_SUBDIR_included_TRUE@ +kate_SUBDIR_included_FALSE = @kate_SUBDIR_included_FALSE@ +kate_SUBDIR_included_TRUE = @kate_SUBDIR_included_TRUE@ +kde_appsdir = @kde_appsdir@ +kde_bindir = @kde_bindir@ +kde_confdir = @kde_confdir@ +kde_datadir = @kde_datadir@ +kde_htmldir = @kde_htmldir@ +kde_icondir = @kde_icondir@ +kde_includes = @kde_includes@ +kde_kcfgdir = @kde_kcfgdir@ +kde_libraries = @kde_libraries@ +kde_libs_htmldir = @kde_libs_htmldir@ +kde_libs_prefix = @kde_libs_prefix@ +kde_locale = @kde_locale@ +kde_mimedir = @kde_mimedir@ +kde_moduledir = @kde_moduledir@ +kde_qtver = @kde_qtver@ +kde_servicesdir = @kde_servicesdir@ +kde_servicetypesdir = @kde_servicetypesdir@ +kde_sounddir = @kde_sounddir@ +kde_styledir = @kde_styledir@ +kde_templatesdir = @kde_templatesdir@ +kde_wallpaperdir = @kde_wallpaperdir@ +kde_widgetdir = @kde_widgetdir@ +kdeinitdir = @kdeinitdir@ +kfile_plugins_SUBDIR_included_FALSE = @kfile_plugins_SUBDIR_included_FALSE@ +kfile_plugins_SUBDIR_included_TRUE = @kfile_plugins_SUBDIR_included_TRUE@ +kicker_applets_SUBDIR_included_FALSE = @kicker_applets_SUBDIR_included_FALSE@ +kicker_applets_SUBDIR_included_TRUE = @kicker_applets_SUBDIR_included_TRUE@ +knewsticker_scripts_SUBDIR_included_FALSE = @knewsticker_scripts_SUBDIR_included_FALSE@ +knewsticker_scripts_SUBDIR_included_TRUE = @knewsticker_scripts_SUBDIR_included_TRUE@ +konq_plugins_SUBDIR_included_FALSE = @konq_plugins_SUBDIR_included_FALSE@ +konq_plugins_SUBDIR_included_TRUE = @konq_plugins_SUBDIR_included_TRUE@ +ksig_SUBDIR_included_FALSE = @ksig_SUBDIR_included_FALSE@ +ksig_SUBDIR_included_TRUE = @ksig_SUBDIR_included_TRUE@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +noatun_plugins_SUBDIR_included_FALSE = @noatun_plugins_SUBDIR_included_FALSE@ +noatun_plugins_SUBDIR_included_TRUE = @noatun_plugins_SUBDIR_included_TRUE@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +qt_includes = @qt_includes@ +qt_libraries = @qt_libraries@ +renamedlgplugins_SUBDIR_included_FALSE = @renamedlgplugins_SUBDIR_included_FALSE@ +renamedlgplugins_SUBDIR_included_TRUE = @renamedlgplugins_SUBDIR_included_TRUE@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +unsermake_enable_pch_FALSE = @unsermake_enable_pch_FALSE@ +unsermake_enable_pch_TRUE = @unsermake_enable_pch_TRUE@ +x_includes = @x_includes@ +x_libraries = @x_libraries@ +xdg_appsdir = @xdg_appsdir@ +xdg_directorydir = @xdg_directorydir@ +xdg_menudir = @xdg_menudir@ +INCLUDES = $(all_includes) +#>- METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = libadblock.la + +libadblock_la_SOURCES = adblock.cpp adblockdialogue.cpp +libadblock_la_LIBADD = $(LIB_KHTML) -lkonq +libadblock_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +pluginsdir = $(kde_datadir)/khtml/kpartplugins +plugins_DATA = plugin_adblock.rc plugin_adblock.desktop +subdir = konq-plugins/adblock +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(kde_module_LTLIBRARIES) + +libadblock_la_DEPENDENCIES = +am_libadblock_la_OBJECTS = adblock.lo adblockdialogue.lo +#>- libadblock_la_OBJECTS = $(am_libadblock_la_OBJECTS) +#>+ 4 +libadblock_la_final_OBJECTS = libadblock_la.all_cpp.lo +libadblock_la_nofinal_OBJECTS = adblock.lo adblockdialogue.lo +@KDE_USE_FINAL_FALSE@libadblock_la_OBJECTS = $(libadblock_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libadblock_la_OBJECTS = $(libadblock_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/adblock.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/adblockdialogue.Plo +#>+ 4 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libadblock_la.all_cpp.P ./$(DEPDIR)/adblock.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/adblockdialogue.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/adblock.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/adblockdialogue.Plo +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libadblock_la_SOURCES) +DATA = $(plugins_DATA) + +DIST_COMMON = $(srcdir)/Makefile.in Makefile.am +SOURCES = $(libadblock_la_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --foreign konq-plugins/adblock/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign konq-plugins/adblock/Makefile + cd $(top_srcdir) && perl admin/am_edit konq-plugins/adblock/Makefile.in +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +kde_moduleLTLIBRARIES_INSTALL = $(INSTALL) +install-kde_moduleLTLIBRARIES: $(kde_module_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(kde_moduledir) + @list='$(kde_module_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(kde_moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(kde_moduledir)/$$f"; \ + $(LIBTOOL) --mode=install $(kde_moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(kde_moduledir)/$$f; \ + else :; fi; \ + done + +uninstall-kde_moduleLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(kde_module_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(kde_moduledir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(kde_moduledir)/$$p; \ + done + +clean-kde_moduleLTLIBRARIES: + -test -z "$(kde_module_LTLIBRARIES)" || rm -f $(kde_module_LTLIBRARIES) + @list='$(kde_module_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +#>- libadblock.la: $(libadblock_la_OBJECTS) $(libadblock_la_DEPENDENCIES) +#>+ 2 +@KDE_USE_CLOSURE_TRUE@libadblock.la: libadblock.la.closure $(libadblock_la_OBJECTS) $(libadblock_la_DEPENDENCIES) +@KDE_USE_CLOSURE_FALSE@libadblock.la: $(libadblock_la_OBJECTS) $(libadblock_la_DEPENDENCIES) + $(CXXLINK) -rpath $(kde_moduledir) $(libadblock_la_LDFLAGS) $(libadblock_la_OBJECTS) $(libadblock_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adblock.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adblockdialogue.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +pluginsDATA_INSTALL = $(INSTALL_DATA) +install-pluginsDATA: $(plugins_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(pluginsdir) + @list='$(plugins_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(pluginsDATA_INSTALL) $$d$$p $(DESTDIR)$(pluginsdir)/$$f"; \ + $(pluginsDATA_INSTALL) $$d$$p $(DESTDIR)$(pluginsdir)/$$f; \ + done + +uninstall-pluginsDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugins_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(pluginsdir)/$$f"; \ + rm -f $(DESTDIR)$(pluginsdir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 1 +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(kde_moduledir) $(DESTDIR)$(pluginsdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-kde_moduleLTLIBRARIES clean-libtool \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-metasources clean-closures clean-bcheck clean-final clean-generic clean-kde_moduleLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +#>- install-data-am: install-kde_moduleLTLIBRARIES install-pluginsDATA +#>+ 1 +install-data-am: install-pluginsDATA + +#>- install-exec-am: +#>+ 1 +install-exec-am: install-kde_moduleLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-kde_moduleLTLIBRARIES \ + uninstall-pluginsDATA + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-kde_moduleLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am \ + install-kde_moduleLTLIBRARIES install-man install-pluginsDATA \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ + pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am \ + uninstall-kde_moduleLTLIBRARIES uninstall-pluginsDATA + + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/adblockplugin.pot +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 8 +libadblock.la.closure: $(libadblock_la_OBJECTS) $(libadblock_la_DEPENDENCIES) + @echo "int main() {return 0;}" > libadblock_la_closure.cpp + @$(LTCXXCOMPILE) -c libadblock_la_closure.cpp + $(CXXLINK) libadblock_la_closure.lo $(libadblock_la_LDFLAGS) $(libadblock_la_OBJECTS) $(libadblock_la_LIBADD) $(LIBS) + @rm -f libadblock_la_closure.* libadblock.la.closure + @echo "timestamp" > libadblock.la.closure + + +#>+ 3 +adblock.moc: $(srcdir)/adblock.h + $(MOC) $(srcdir)/adblock.h -o adblock.moc + +#>+ 2 +mocs: adblock.moc + +#>+ 3 +adblockdialogue.moc: $(srcdir)/adblockdialogue.h + $(MOC) $(srcdir)/adblockdialogue.h -o adblockdialogue.moc + +#>+ 2 +mocs: adblockdialogue.moc + +#>+ 3 +clean-metasources: + -rm -f adblock.moc adblockdialogue.moc + +#>+ 2 +KDE_DIST=plugin_adblock.rc adblock.h Makefile.in plugin_adblock.desktop adblockdialogue.h + +#>+ 3 +clean-closures: + -rm -f libadblock.la.closure + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign konq-plugins/adblock/Makefile + cd $(top_srcdir) && perl admin/am_edit konq-plugins/adblock/Makefile.in + + +#>+ 21 +clean-bcheck: + rm -f *.bchecktest.cc *.bchecktest.cc.class a.out + +bcheck: bcheck-am + +bcheck-am: + @for i in ; do \ + if test $(srcdir)/$$i -nt $$i.bchecktest.cc; then \ + echo "int main() {return 0;}" > $$i.bchecktest.cc ; \ + echo "#include \"$$i\"" >> $$i.bchecktest.cc ; \ + echo "$$i"; \ + if ! $(CXXCOMPILE) --dump-class-hierarchy -c $$i.bchecktest.cc; then \ + rm -f $$i.bchecktest.cc; exit 1; \ + fi ; \ + echo "" >> $$i.bchecktest.cc.class; \ + perl $(top_srcdir)/admin/bcheck.pl $$i.bchecktest.cc.class || { rm -f $$i.bchecktest.cc; exit 1; }; \ + rm -f a.out; \ + fi ; \ + done + + +#>+ 11 +libadblock_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/adblock.cpp $(srcdir)/adblockdialogue.cpp adblock.moc adblockdialogue.moc + @echo 'creating libadblock_la.all_cpp.cpp ...'; \ + rm -f libadblock_la.all_cpp.files libadblock_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libadblock_la.all_cpp.final; \ + for file in adblock.cpp adblockdialogue.cpp ; do \ + echo "#include \"$$file\"" >> libadblock_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libadblock_la.all_cpp.final; \ + done; \ + cat libadblock_la.all_cpp.final libadblock_la.all_cpp.files > libadblock_la.all_cpp.cpp; \ + rm -f libadblock_la.all_cpp.final libadblock_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libadblock_la.all_cpp.cpp + +#>+ 3 +final: + $(MAKE) libadblock_la_OBJECTS="$(libadblock_la_final_OBJECTS)" all-am + +#>+ 3 +final-install: + $(MAKE) libadblock_la_OBJECTS="$(libadblock_la_final_OBJECTS)" install-am + +#>+ 3 +no-final: + $(MAKE) libadblock_la_OBJECTS="$(libadblock_la_nofinal_OBJECTS)" all-am + +#>+ 3 +no-final-install: + $(MAKE) libadblock_la_OBJECTS="$(libadblock_la_nofinal_OBJECTS)" install-am + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo + +#>+ 7 +nmcheck: +adblockdialogue.o: adblockdialogue.moc +nmcheck-am: nmcheck +adblock.lo: adblock.moc +adblock.o: adblock.moc +adblockdialogue.lo: adblockdialogue.moc diff --git a/konq-plugins/adblock/adblock.cpp b/konq-plugins/adblock/adblock.cpp new file mode 100644 index 0000000..30878fd --- /dev/null +++ b/konq-plugins/adblock/adblock.cpp @@ -0,0 +1,268 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + Copyright (C) 2006 Daniele Galdi + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +/* Project related */ +#include "adblock.h" +#include "adblockdialogue.h" + +/* Kde related */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace DOM; + +#include +#include +#include + +typedef KGenericFactory AdBlockFactory; +K_EXPORT_COMPONENT_FACTORY( libadblock, AdBlockFactory( "adblock" ) ) + +AdBlock::AdBlock(QObject *parent, const char *name, const QStringList &) : + KParts::Plugin(parent, name), + m_label(0), m_menu(0) +{ + m_part = dynamic_cast(parent); + if(!m_part) { kdDebug() << "couldn't get KHTMLPart" << endl; return; } + + m_menu = new KPopupMenu(m_part->widget()); + m_menu->insertTitle(i18n("Adblock")); + m_menu->insertItem(i18n("Configure"), this, SLOT(showKCModule())); + m_menu->insertItem(i18n("Show Elements"), this, SLOT(showDialogue())); + + connect(m_part, SIGNAL(completed()), this, SLOT(initLabel())); +} + +AdBlock::~AdBlock() +{ + KParts::StatusBarExtension *statusBarEx = KParts::StatusBarExtension::childObject(m_part); + + if (!statusBarEx) { kdDebug() << "couldn't get KParts::StatusBarExtension" << endl; return; } + + statusBarEx->removeStatusBarItem(m_label); + + delete m_menu; +} + +void AdBlock::initLabel() +{ + if (m_label) return; + + KParts::StatusBarExtension *statusBarEx = KParts::StatusBarExtension::childObject(m_part); + + if (!statusBarEx) { kdDebug() << "couldn't get KParts::StatusBarExtension" << endl; return; } + + m_label = new KURLLabel(statusBarEx->statusBar()); + + KIconLoader *loader = instance()->iconLoader(); + + m_label->setFixedHeight(loader->currentSize(KIcon::Small)); + m_label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); + m_label->setUseCursor(false); + m_label->setPixmap(loader->loadIcon("filter", KIcon::Small)); + + statusBarEx->addStatusBarItem(m_label, 0, false); + + connect(m_label, SIGNAL(leftClickedURL()), this, SLOT(showDialogue())); + connect(m_label, SIGNAL(rightClickedURL()), this, SLOT(contextMenu())); +} + +void AdBlock::showDialogue() +{ + if (!m_part->settings()->isAdFilterEnabled()) + { + KMessageBox::error(0, + i18n("Please enable Konqueror's Adblock"), + i18n("Adblock disabled")); + + return; + } + + AdElementList elements; + fillBlockableElements(elements); + + AdBlockDlg *dialogue = new AdBlockDlg(m_part->widget(), elements); + connect(dialogue, SIGNAL( notEmptyFilter(const QString&) ), this, SLOT( addAdFilter(const QString&) )); + connect(dialogue, SIGNAL( cancelClicked() ), dialogue, SLOT( delayedDestruct() )); + connect(dialogue, SIGNAL( closeClicked() ), dialogue, SLOT( delayedDestruct() )); + dialogue->show(); +} + +void AdBlock::showKCModule() +{ + KCMultiDialog* dialogue = new KCMultiDialog(m_part->widget()); + dialogue->addModule("khtml_filter"); + connect(dialogue, SIGNAL( cancelClicked() ), dialogue, SLOT( delayedDestruct() )); + connect(dialogue, SIGNAL( closeClicked() ), dialogue, SLOT( delayedDestruct() )); + dialogue->show(); +} + +void AdBlock::contextMenu() +{ + m_menu->popup(QCursor::pos()); +} + +void AdBlock::fillBlockableElements(AdElementList &elements) +{ + fillWithHtmlTag(elements, "script", "src", "SCRIPT"); + fillWithHtmlTag(elements, "embed" , "src", "OBJECT"); + fillWithHtmlTag(elements, "object", "src", "OBJECT"); + fillWithImages(elements); + + const KHTMLSettings *settings = m_part->settings(); + + AdElementList::iterator it; + for ( it = elements.begin(); it != elements.end(); ++it ) + { + AdElement &element = (*it); + if (settings->isAdFiltered( element.url() )) + { + element.setBlocked(true); + } + } +} + +void AdBlock::fillWithImages(AdElementList &elements) +{ + HTMLDocument htmlDoc = m_part->htmlDocument(); + + HTMLCollection images = htmlDoc.images(); + + for (unsigned int i = 0; i < images.length(); i++) + { + HTMLImageElement image = static_cast( images.item(i) ); + + DOMString src = image.src(); + + QString url = htmlDoc.completeURL(src).string(); + if (!url.isEmpty() && url != m_part->baseURL().url()) + { + AdElement element(url, "image", "IMG", false); + if (!elements.contains( element )) + elements.append( element); + } + } +} + +void AdBlock::fillWithHtmlTag(AdElementList &elements, + const DOMString &tagName, + const DOMString &attrName, + const QString &category) +{ + Document doc = m_part->document(); + + NodeList nodes = doc.getElementsByTagName(tagName); + + for (unsigned int i = 0; i < nodes.length(); i++) + { + Node node = nodes.item(i); + Node attr = node.attributes().getNamedItem(attrName); + + DOMString src = attr.nodeValue(); + if (src.isNull()) continue; + + QString url = doc.completeURL(src).string(); + if (!url.isEmpty() && url != m_part->baseURL().url()) + { + AdElement element(url, tagName.string(), category, false); + if (!elements.contains( element )) + elements.append( element); + } + } +} + +void AdBlock::addAdFilter(const QString &url) +{ + //FIXME hackish + KHTMLSettings *settings = const_cast(m_part->settings()); + settings->addAdFilter(url); +} + +// ---------------------------------------------------------------------------- + +AdElement::AdElement() : + m_url(0), m_category(0), m_type(0), m_blocked(false) {} + +AdElement::AdElement(const QString &url, const QString &category, + const QString &type, bool blocked) : + m_url(url), m_category(category), m_type(type), m_blocked(blocked) {} + +AdElement &AdElement::operator=(const AdElement &obj) +{ + m_blocked = obj.m_blocked; + m_url = obj.m_url; + m_category = obj.m_category; + m_type = obj.m_type; + + return *this; +} + +bool AdElement::operator==(const AdElement &obj) +{ + return m_url == obj.m_url; +} + +bool AdElement::isBlocked() const +{ + return m_blocked; +} + +void AdElement::setBlocked(bool blocked) +{ + m_blocked = blocked; +} + +const QString &AdElement::url() const +{ + return m_url; +} + +const QString &AdElement::category() const +{ + return m_category; +} + +const QString &AdElement::type() const +{ + return m_type; +} + +#include "adblock.moc" diff --git a/konq-plugins/adblock/adblock.h b/konq-plugins/adblock/adblock.h new file mode 100644 index 0000000..4b6154e --- /dev/null +++ b/konq-plugins/adblock/adblock.h @@ -0,0 +1,99 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + Copyright (C) 2006 Daniele Galdi + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +#ifndef KONQ_ADBLOCK_H +#define KONQ_ADBLOCK_H + +#include +#include +#include + +class KHTMLPart; +class KURLLabel; +class KHTMLSettings; +class AdElement; +class KPopupMenu; + +namespace KParts +{ + class StatusBarExtension; +} + +namespace DOM +{ + class DOMString; +} + +typedef QValueList AdElementList; + +class AdBlock : public KParts::Plugin +{ + Q_OBJECT + +public: + AdBlock(QObject *parent, const char *name, const QStringList &); + ~AdBlock(); + +private: + QGuardedPtr m_part; + KURLLabel *m_label; + KPopupMenu *m_menu; + + void fillBlockableElements(AdElementList &elements); + void fillWithImages(AdElementList &elements); + void fillWithHtmlTag(AdElementList &elements, + const DOM::DOMString &tagName, + const DOM::DOMString &attrName, + const QString &category); + +private slots: + void initLabel(); + void showDialogue(); + void addAdFilter(const QString &url); + void contextMenu(); + void showKCModule(); +}; + +// ---------------------------------------------------------------------------- + +class AdElement +{ +private: + QString m_url; + QString m_category; + QString m_type; + bool m_blocked; + +public: + AdElement(); + AdElement(const QString &url, const QString &category, + const QString &type, bool blocked); + + AdElement &operator=(const AdElement &); + bool operator==(const AdElement &e1); + + bool isBlocked() const; + void setBlocked(bool blocked); + const QString &url() const; + const QString &category() const; + const QString &type() const; +}; + +#endif diff --git a/konq-plugins/adblock/adblockdialogue.cpp b/konq-plugins/adblock/adblockdialogue.cpp new file mode 100644 index 0000000..5de6efa --- /dev/null +++ b/konq-plugins/adblock/adblockdialogue.cpp @@ -0,0 +1,163 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + Copyright (C) 2006 Daniele Galdi + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 51 + Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "adblock.h" +#include "adblockdialogue.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +AdBlockDlg::AdBlockDlg(QWidget *parent, AdElementList &elements) : + KDialogBase( parent, "Adblock dialogue", true, "Adblock - able Items", Ok|Cancel, Ok, true ) +{ + QVBox *page = makeVBoxMainWidget(); + m_label1 = new QLabel( i18n("All blockable items in this page:"), page, "label1" ); + + m_list = new QListView(page); + m_list->setAllColumnsShowFocus( true ); + + m_list->addColumn( i18n("Source") ); + m_list->addColumn( i18n("Category") ); + m_list->addColumn( i18n("Node Name") ); + + m_list->setColumnWidthMode(0, QListView::Manual); + m_list->setColumnWidthMode(1, QListView::Manual); + m_list->setColumnWidthMode(2, QListView::Manual); + + m_list->setColumnWidth(0, 600); + m_list->setColumnWidth(1, 90); + m_list->setColumnWidth(2, 90); + + AdElementList::iterator it; + for ( it = elements.begin(); it != elements.end(); ++it ) + { + AdElement &element = (*it); + + QString url = element.url(); + + ListViewItem *item = new ListViewItem( m_list, url, element.category(), element.type() ); + item->setBlocked(element.isBlocked()); + } + + m_label2 = new QLabel( i18n("New filter (use * as a wildcard):"), page, "label2" ); + + m_filter = new QLineEdit( "", page, "lineedit" ); + + connect(this, SIGNAL( okClicked() ), this, SLOT( validateFilter() )); + connect(m_list, SIGNAL( doubleClicked(QListViewItem *, const QPoint &, int) ), this, SLOT(updateFilter(QListViewItem *)) ); + + m_menu = new KPopupMenu(this); + m_menu->insertItem(i18n("Filter this item"), this, SLOT(filterItem())); + m_menu->insertItem(i18n("Filter all items at same path"), this, SLOT(filterPath())); + + connect(m_list, + SIGNAL( contextMenuRequested( QListViewItem *, const QPoint& , int ) ), + this, + SLOT( showContextMenu(QListViewItem *, const QPoint &) ) ); +} + +void AdBlockDlg::updateFilter(QListViewItem *selected) +{ + ListViewItem *item = dynamic_cast(selected); + + if (item->isBlocked()) + { + m_filter->setText(""); + return; + } + + m_filter->setText( item->text(0) ); +} + +void AdBlockDlg::validateFilter() +{ + const QString text = m_filter->text().stripWhiteSpace(); + + if (!text.isEmpty()) + emit notEmptyFilter(text); + + delayedDestruct(); +} + +void AdBlockDlg::showContextMenu(QListViewItem *item, const QPoint &point) +{ + if (!item) return; + m_menu->popup(point); +} + +void AdBlockDlg::filterItem() +{ + QListViewItem* item = m_list->selectedItem(); + m_filter->setText( item->text(0) ); +} + +void AdBlockDlg::filterPath() +{ + QListViewItem* item = m_list->selectedItem(); + QString value = item->text(0); + m_filter->setText( value.section( '/', 0, -2 ).append("/*") ); +} + +AdBlockDlg::~AdBlockDlg() +{ + delete m_label1; + delete m_label2; + delete m_filter; + delete m_list; +} + +// ---------------------------------------------------------------------------- + +void ListViewItem::paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align) +{ + p->save(); + QColorGroup g( cg ); + + if ( isBlocked() ) + { + g.setColor(QColorGroup::Text, red); + QFont font; + font.setItalic(true); + p->setFont(font); + } + + QListViewItem::paintCell(p, g, column, width, align); + p->restore(); +} + +inline bool ListViewItem::isBlocked() +{ + return m_blocked; +} + +inline void ListViewItem::setBlocked(bool blocked) +{ + m_blocked = blocked; +} + +#include "adblockdialogue.moc" diff --git a/konq-plugins/adblock/adblockdialogue.h b/konq-plugins/adblock/adblockdialogue.h new file mode 100644 index 0000000..ab41bc2 --- /dev/null +++ b/konq-plugins/adblock/adblockdialogue.h @@ -0,0 +1,76 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + Copyright (C) 2006 Daniele Galdi + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef KONQ_ADBLOCKDLG_H +#define KONQ_ADBLOCKDLG_H + +#include +#include + +class QLabel; +class QLineEdit; +class KPopupMenu; + +class AdBlockDlg : public KDialogBase +{ + Q_OBJECT + +private: + QLineEdit *m_filter; + QListView *m_list; + QLabel *m_label1; + QLabel *m_label2; + KPopupMenu *m_menu; + +public: + AdBlockDlg(QWidget *parent, AdElementList &elements); + ~AdBlockDlg(); + +private slots: + void validateFilter (); + void updateFilter(QListViewItem *item); + void showContextMenu(QListViewItem *item, const QPoint &point); + void filterPath(); + void filterItem(); + +signals: + void notEmptyFilter (const QString &url); +}; + +// ---------------------------------------------------------------------------- + +class ListViewItem : public QListViewItem +{ +private: + bool m_blocked; + +public: + ListViewItem(QListView *listView, + const QString &label1, + const QString &label2, + const QString &label3) : QListViewItem(listView, label1, label2, label3), + m_blocked(false){}; + + void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align); + + bool isBlocked(); + void setBlocked(bool blocked); +}; + +#endif diff --git a/konq-plugins/adblock/plugin_adblock.desktop b/konq-plugins/adblock/plugin_adblock.desktop new file mode 100644 index 0000000..1ac9afe --- /dev/null +++ b/konq-plugins/adblock/plugin_adblock.desktop @@ -0,0 +1,16 @@ +[Desktop Entry] +Name=Adblock Plugin +Icon=filter +Comment=Show all blockable html elements +Encoding=UTF-8 +Type=Service +X-KDE-Library=libadblock +X-KDE-PluginInfo-Author=Danie Galdi +X-KDE-PluginInfo-Email=daniele.galdi@gmail.com +X-KDE-PluginInfo-Name=adblock +X-KDE-PluginInfo-Version=0.0.5 +X-KDE-PluginInfo-Website=http://www.pigamo.com +X-KDE-PluginInfo-Category=Statusbar +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true +X-KDE-ParentApp=konqueror diff --git a/konq-plugins/adblock/plugin_adblock.rc b/konq-plugins/adblock/plugin_adblock.rc new file mode 100644 index 0000000..615d08b --- /dev/null +++ b/konq-plugins/adblock/plugin_adblock.rc @@ -0,0 +1,3 @@ + + + \ No newline at end of file