[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    PATCH: disabling plugins
From:       Daniel Naber <daniel.naber () t-online ! de>
Date:       2001-01-03 23:09:29
[Download RAW message or body]

Hi,

can I apply this patch? It adds a "Enable Plugins" Checkbox in the 
konqueror configuration. It's important to have an easy way to disable 
this, as there is a buffer overflow in the flash plugin (fixes my report 
#17992). I could only test this with flash.

It now defaults to false. Why doesn't it have a server-specific settings? 
Well, the problem is that we're heading in the wrong direction with our 
"server specific" UI, IMHO. The normal use case is to trust as server, 
i.e. enable Java, Javascript, Plugins *and* Cookies. With the current UI, 
you have to add the server several times. It would be better to add the 
server to only one list, and then have those settings for that server in 
one place. But I currently don't have time for that and it's a kind of new 
feature anyway.

Regards
 Daniel

-- 
Daniel Naber, Paul-Gerhardt-Str. 2, 33332 Guetersloh, Germany
Tel. 05241-59371, Mobil 0170-4819674

["config-plugin.diff" (text/plain)]

Index: khtml_settings.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_settings.h,v
retrieving revision 1.19
diff -u -r1.19 khtml_settings.h
--- khtml_settings.h	2000/12/10 15:02:23	1.19
+++ khtml_settings.h	2001/01/03 22:53:59
@@ -143,6 +143,7 @@
     bool m_bAutoLoadImages;
     bool m_bEnableJava;
     bool m_bEnableJavaScript;
+    bool m_bEnablePlugins;
     bool m_bEnableCSS;
     QMap<QString,KJavaScriptAdvice> javaDomainPolicy;
     QMap<QString,KJavaScriptAdvice> javaScriptDomainPolicy;
Index: khtml_settings.cc
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_settings.cc,v
retrieving revision 1.45
diff -u -r1.45 khtml_settings.cc
--- khtml_settings.cc	2000/12/22 17:19:53	1.45
+++ khtml_settings.cc	2001/01/03 22:54:58
@@ -215,6 +215,10 @@
     if ( reset || config->hasKey( "EnableJavaScript" ) )
       m_bEnableJavaScript = config->readBoolEntry( "EnableJavaScript", false );
 
+        // The global setting for Plugins (there's no local setting yet)
+    if ( reset || config->hasKey( "EnablePlugins" ) )
+      m_bEnablePlugins = config->readBoolEntry( "EnablePlugins", false );
+
     // The domain-specific settings.
     bool check_old_java = true;
 	if( reset || config->hasKey( "JavaDomainSettings" ) ){
@@ -340,8 +344,8 @@
 
 bool KHTMLSettings::isPluginsEnabled( const QString& hostname )
 {
-  // FIXME: After 2.1 this new feature can be implemented (malte)
-  return true;
+  // FIXME: hostname is ignored (dnaber, 2001-01-03)
+  return m_bEnablePlugins;
 }
 
 bool KHTMLSettings::isCSSEnabled( const QString& /*hostname*/ )
Index: Makefile.am
===================================================================
RCS file: /home/kde/kdebase/kcontrol/konqhtml/Makefile.am,v
retrieving revision 1.12
diff -u -r1.12 Makefile.am
--- Makefile.am	2000/12/22 17:12:48	1.12
+++ Makefile.am	2001/01/03 22:55:24
@@ -6,7 +6,7 @@
 kde_module_LTLIBRARIES = libkcm_konqhtml.la
 
 libkcm_konqhtml_la_SOURCES = htmlopts.cpp jsopts.cpp \
-			     javaopts.cpp appearance.cpp \
+			     javaopts.cpp pluginopts.cpp appearance.cpp \
 			     khttpoptdlg.cpp policydlg.cpp main.cpp
 
 libkcm_konqhtml_la_LDFLAGS  = $(all_libraries) -module -avoid-version -no-undefined
Index: main.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/konqhtml/main.cpp,v
retrieving revision 1.15
diff -u -r1.15 main.cpp
--- main.cpp	2000/12/22 17:12:48	1.15
+++ main.cpp	2001/01/03 22:57:52
@@ -41,6 +41,7 @@
 #include "khttpoptdlg.h"
 #include "jsopts.h"
 #include "javaopts.h"
+#include "pluginopts.h"
 #include "appearance.h"
 #include "htmlopts.h"
 
@@ -74,6 +75,10 @@
   tab->addTab( javascript, i18n( "Java&Script" ) );
   connect( javascript, SIGNAL( changed( bool ) ), this, SLOT( moduleChanged( bool ) ) );
 
+  plugin = new KPluginOptions( m_localConfig, "Java/JavaScript Settings", this );
+  tab->addTab( plugin, i18n( "&Plugins" ) );
+  connect( plugin, SIGNAL( changed( bool ) ), this, SLOT( moduleChanged( bool ) ) );
+
 }
 
 KonqHTMLModule::~KonqHTMLModule()
@@ -87,6 +92,7 @@
   appearance->load();
   javascript->load();
   java->load();
+  plugin->load();
   misc->load();
 }
 
@@ -96,6 +102,7 @@
   appearance->save();
   javascript->save();
   java->save();
+  plugin->save();
   misc->save();
 
   // Send signal to konqueror
@@ -112,6 +119,7 @@
   appearance->defaults();
   javascript->defaults();
   java->defaults();
+  plugin->defaults();
   misc->defaults();
 }
 
Index: main.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/konqhtml/main.h,v
retrieving revision 1.9
diff -u -r1.9 main.h
--- main.h	2000/12/22 17:12:48	1.9
+++ main.h	2001/01/03 22:58:06
@@ -31,6 +31,7 @@
 class KAppearanceOptions;
 class KJavaOptions;
 class KJavaScriptOptions;
+class KPluginOptions;
 class KHTTPOptions;
 class KMiscHTMLOptions;
 class KRootOptions;
@@ -67,6 +68,7 @@
   KAppearanceOptions *appearance;
   KJavaScriptOptions *javascript;
   KJavaOptions       *java;
+  KPluginOptions     *plugin;
 
   KConfig *m_globalConfig;
   KConfig *m_localConfig;

["pluginopts.h" (text/x-c++)]

//-----------------------------------------------------------------------------
//
// Plugin Options
//
// (c) 2001, Daniel Naber, based on javaopts.h
//
//-----------------------------------------------------------------------------

#ifndef __PLUGINOPTS_H__
#define __PLUGINOPTS_H__

#include <kcmodule.h>
#include <qmap.h>

class KConfig;
class QCheckBox;

class KPluginOptions : public KCModule
{
    Q_OBJECT

public:
    KPluginOptions( KConfig* config, QString group, QWidget* parent = 0, const char* name = 0 );

    virtual void load();
    virtual void save();
    virtual void defaults();

private slots:
    void changed();

private:

    KConfig* m_pConfig;
    QString  m_groupname;

    QCheckBox*    enablePluginsGloballyCB;
};

#endif		// __PLUGINOPTS_H__

["pluginopts.cpp" (text/x-c++)]

// (c) 2001, Daniel Naber, based on javaopts.cpp

#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlayout.h>
#include <qwhatsthis.h>
#include <qvgroupbox.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kconfig.h>
#include <kmessagebox.h>
#include <kdebug.h>
#include <X11/Xlib.h>

#include "htmlopts.h"
#include "pluginopts.h"

#include <konq_defaults.h> // include default values directly from konqueror
#include <klocale.h>
#include <khtml_settings.h>
#include <khtmldefaults.h>

#include "pluginopts.moc"

KPluginOptions::KPluginOptions( KConfig* config, QString group, QWidget *parent,
                            const char *name )
    : KCModule( parent, name ),
      m_pConfig( config ),
      m_groupname( group )
{
    QVBoxLayout* toplevel = new QVBoxLayout( this, 10, 5 );

    /***************************************************************************
     ********************* Global Settings *************************************
     **************************************************************************/
    QVGroupBox* globalGB = new QVGroupBox( i18n( "Global Settings" ), this );
    toplevel->addWidget( globalGB );
    enablePluginsGloballyCB = new QCheckBox( i18n( "Enable &Plugins globally" ), globalGB );
    connect( enablePluginsGloballyCB, SIGNAL( clicked() ), this, SLOT( changed() ) );


    /***************************************************************************
     ********************** WhatsThis? items ***********************************
     **************************************************************************/
    QWhatsThis::add( enablePluginsGloballyCB, i18n("Enables the execution of plugins "
          "that can be contained in HTML pages, e.g. Macromedia Flash. "
          "Note that, as with any browser, enabling active contents can be a security problem.") );

    // Finally do the loading
    load();
}


void KPluginOptions::load()
{
    // *** load ***
    m_pConfig->setGroup(m_groupname);
    bool bPluginGlobal = m_pConfig->readBoolEntry( "EnablePlugins", false);

    // *** apply to GUI ***
    enablePluginsGloballyCB->setChecked( bPluginGlobal );
}

void KPluginOptions::defaults()
{
    enablePluginsGloballyCB->setChecked( false );
}

void KPluginOptions::save()
{
    m_pConfig->setGroup(m_groupname);
    m_pConfig->writeEntry( "EnablePlugins", enablePluginsGloballyCB->isChecked());
}

void KPluginOptions::changed()
{
    emit KCModule::changed(true);
}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic