summaryrefslogtreecommitdiffstats
path: root/konq-plugins/khtmlsettingsplugin
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /konq-plugins/khtmlsettingsplugin
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/khtmlsettingsplugin')
-rw-r--r--konq-plugins/khtmlsettingsplugin/Makefile.am18
-rw-r--r--konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.desktop136
-rw-r--r--konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.lsm18
-rw-r--r--konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.rc11
-rw-r--r--konq-plugins/khtmlsettingsplugin/settingsplugin.cpp328
-rw-r--r--konq-plugins/khtmlsettingsplugin/settingsplugin.h56
6 files changed, 567 insertions, 0 deletions
diff --git a/konq-plugins/khtmlsettingsplugin/Makefile.am b/konq-plugins/khtmlsettingsplugin/Makefile.am
new file mode 100644
index 0000000..1c98400
--- /dev/null
+++ b/konq-plugins/khtmlsettingsplugin/Makefile.am
@@ -0,0 +1,18 @@
+INCLUDES = $(all_includes)
+
+kde_module_LTLIBRARIES = libkhtmlsettingsplugin.la
+
+libkhtmlsettingsplugin_la_SOURCES = settingsplugin.cpp
+libkhtmlsettingsplugin_la_LIBADD = $(LIB_KHTML)
+libkhtmlsettingsplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+pluginsdir = $(kde_datadir)/khtml/kpartplugins
+plugins_DATA = khtmlsettingsplugin.rc khtmlsettingsplugin.desktop
+
+appsdir = $(kde_appsdir)/.hidden
+apps_DATA = khtmlsettingsplugin.desktop
+
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/khtmlsettingsplugin.pot
diff --git a/konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.desktop b/konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.desktop
new file mode 100644
index 0000000..94ff35a
--- /dev/null
+++ b/konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.desktop
@@ -0,0 +1,136 @@
+[Desktop Entry]
+X-KDE-Library=khtmlsettingsplugin
+X-KDE-PluginInfo-Author=Carsten Pfeiffer
+X-KDE-PluginInfo-Email=pfeiffer@kde.org
+X-KDE-PluginInfo-Name=khtmlsettingsplugin
+X-KDE-PluginInfo-Version=3.3
+X-KDE-PluginInfo-Website=
+X-KDE-PluginInfo-Category=Tools
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+Name=KHTML Settings
+Name[af]=Khtml Instellings
+Name[ar]=اعدادات KHTML
+Name[az]=KHTML Qurğuları
+Name[bg]=Настройки на KHTML
+Name[br]=Dibarzhoù KHTML
+Name[bs]=KHTML postavke
+Name[ca]=Preferències KHTML
+Name[cs]=Nastavení KHTML
+Name[cy]=Gosodiadau KHTML
+Name[da]=KHTML-opsætning
+Name[de]=KHTML-Einstellungen
+Name[el]=Ρυθμίσεις KHTML
+Name[eo]=KHTML-agordo
+Name[es]=Preferencias de KHTML
+Name[et]=KHTML seadistused
+Name[eu]=KHTMLren ezarpenak
+Name[fa]=تنظیمات KHTML
+Name[fi]=KHTML-asetukset
+Name[fo]=KHTML-uppseting
+Name[fr]=Réglages KHTML
+Name[fy]=KHTML-ynstellingen
+Name[ga]=Socruithe KHTML
+Name[gl]=Configuración de KHTML
+Name[he]=הגדרות KHTML
+Name[hi]=के-एचटीएमएल विन्यास
+Name[hr]=KHTML postavke
+Name[hu]=KHTML-beállítások
+Name[it]=Impostazioni KHTML
+Name[ja]=KHTML 設定
+Name[ka]=KHTML პარამეტრები
+Name[kk]=KHTML параметрлері
+Name[km]=ការ​កំណត់​ KHTML
+Name[lt]=KHTML nustatymai
+Name[mk]=Поставувања за KHTML
+Name[ms]=Seting KHTML
+Name[nb]=KHTML-innstillinger
+Name[nds]=KHTML-Instellen
+Name[ne]=केएचटीएमएल सेटिङ
+Name[nl]=KHTML-instellingen
+Name[nn]=KHTML-innstillingar
+Name[pa]=KHTML ਸਥਾਪਨ
+Name[pl]=Ustawienia KHTML
+Name[pt]=Configuração do KHTML
+Name[pt_BR]=Configurações KHTML
+Name[ro]=Setări KHTML
+Name[ru]=Параметры KHTML
+Name[sk]=KHTML nastavenia
+Name[sl]=Nastavitve KHTML
+Name[sr]=Подешавања KHTML-а
+Name[sr@Latn]=Podešavanja KHTML-a
+Name[sv]=KHTML-inställningar
+Name[ta]=KHTML அமைப்புகள்
+Name[tg]=Танзимотҳои KHTML
+Name[tr]=KHTML Ayarları
+Name[uk]=Параметри KHTML
+Name[uz]=KHTML moslamalari
+Name[uz@cyrillic]=KHTML мосламалари
+Name[vi]=Thiết lập KHTML
+Name[xh]=Ucwangciso lwe KHTML
+Name[zh_CN]=KHTML 设置
+Name[zh_TW]=KHTML 設定
+Comment=Fast way to change the KHTML settings
+Comment[af]=Vinnige weg na verander die Khtml instellings
+Comment[ar]=طريقة سهلة لتغيير اعدادات KHTML
+Comment[az]=KHTML qurğularını dəyişdirmənin sür'ətli yolu
+Comment[bg]=Бърз начин да се променят някои от най-важните настройки на KHTML
+Comment[bs]=Brz način za mijenjanje KHTML postavki
+Comment[ca]=Per a canviar ràpidament les preferències de KHTML
+Comment[cs]=Rychlé přepínání nastavení KHTML
+Comment[cy]=Ffordd cyflym o newid y gosodiadau KHTML
+Comment[da]=Hurtig måde at ændre KHTML-opsætningen på
+Comment[de]=Schnelle Möglichkeiten zur Änderung der KHTML-Einstellungen
+Comment[el]=Γρήγορος τρόπος αλλαγής των ρυθμίσεων του KHTML
+Comment[eo]=Rapida kielo por ŝanĝi la KHTML-agordon
+Comment[es]=Una forma rápida de cambiar las preferencias de KHTML
+Comment[et]=Kiirmeetod muuta KHTML seadistusi
+Comment[eu]=KHTMLren ezarpenak aldatzeko bide azkarra
+Comment[fa]=روش سریع تغییر تنظیمات KHTML
+Comment[fi]=Nopea tapa muuttaa KHTML asetuksia
+Comment[fo]=Snarvegur uppsetingin av KHTML
+Comment[fr]=Méthode rapide pour configurer les réglages KHTML
+Comment[fy]=Snelle manier om de ynstellingen fan KHTML te wizigjen
+Comment[gl]=Unha forma rápida de alterar a configuración de KHTML
+Comment[he]=דרך מהירה לשנות את ההגדרות של KHTML
+Comment[hi]=के-एचटीएमएल विन्यास बदलने का तेज तरीका
+Comment[hr]=Brz način izmjene KHTML postavki
+Comment[hu]=A KHTML objektum beállításai
+Comment[is]=Fljótvirk leið til að stilla KHTML
+Comment[it]=Modo veloce per cambiare le impostazioni KHTML
+Comment[ja]=KHTML 設定を素早く変更します
+Comment[ka]=KHTML პარამეტრების შეცვლის სწრაფი გზა
+Comment[kk]=KHTML параметрлерін шұғыл өзгертудің жолы
+Comment[km]=​វិធី​ដ៏​​រហ័ស​ដើម្បី​ផ្លាស់ប្ដូរ​ការ​កំណត់ KHTML
+Comment[lt]=Greitas būdas KHTML parinktims pakeisti
+Comment[mk]=Брз начин за промена на поставувањата за KHTML
+Comment[ms]=Cara pantas untuk mengubah seting KHTML
+Comment[nb]=Rask måte å endre KHTML-innstillinger
+Comment[nds]=De KHTML-Instellen gau ännern
+Comment[ne]=केएचटीएमएल सेटिङ परिवर्तन गर्ने छिटो तरिका
+Comment[nl]=Snelle manier om de instellingen van KHTML te wijzigen
+Comment[nn]=Ein rask måte å endra KHTML-innstillingane
+Comment[pl]=Szybka zmiana ustawień KHTML
+Comment[pt]=Uma forma rápida de alterar a configuração do KHTML
+Comment[pt_BR]=Modo rápido de mudar as configurações do KHTML
+Comment[ro]=Configurează rapid şi uşor setările KHTML
+Comment[ru]=Быстрое изменение параметров KHTML
+Comment[sk]=Rýchla cesta ako zmeniť nastavenia KHTML
+Comment[sl]=Hiter način za spreminjanje nastavitev KHTML
+Comment[sr]=Брз начин за промену подешавања KHTML-а
+Comment[sr@Latn]=Brz način za promenu podešavanja KHTML-a
+Comment[sv]=Snabbt sätt att ändra KHTML-inställningarna
+Comment[ta]=KHTML அமைப்புகளை மாற்றுவதற்கான விரைவான வழி
+Comment[tg]=Тағйирёбии тези танзимотҳои KHTML
+Comment[tr]=KHTML ayarlarını değiştirmek için hızlı bir yol
+Comment[uk]=Швидкий шлях змінити параметри KHTML
+Comment[uz]=KHTML moslamalarini tez oʻzgartirish yoʻli
+Comment[uz@cyrillic]=KHTML мосламаларини тез ўзгартириш йўли
+Comment[vi]=Cách thay đổi nhanh thiết lập KHTML
+Comment[xh]=Indlela ekhawulezayo yokutshintsha ucwangciso lwe KHTML
+Comment[zh_CN]=改变 KHTML 设置的快速方式
+Comment[zh_TW]=快速變更 KHTML 設定的方法
+X-KDE-ParentApp=konqueror
+Icon=configure
+DocPath=konq-plugins/khtmlsettings/index.html
diff --git a/konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.lsm b/konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.lsm
new file mode 100644
index 0000000..29d3818
--- /dev/null
+++ b/konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.lsm
@@ -0,0 +1,18 @@
+Begin3
+Title: KHTMLSettingsPlugin -- Java/Javascript/Cookies settings
+Version: 0.1
+Entered-date: 01/28/2001
+Description: Puts a button with a dropdown menu with settings for
+ Java,Javascript,Cookies and Image-loading into Konqueror's
+ Extra-Toolbar
+Keywords: KDE Qt
+Author: Carsten Pfeiffer <pfeiffer@kde.org>
+Maintained-by: Carsten Pfeiffer <pfeiffer@kde.org>
+Home-page:
+Alternate-site: http://devel-home.kde.org/~pfeiffer/
+Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils
+ xxxxxx khtmlsettingsplugin-0.1.tar.gz
+ xxx khtmlsettingsplugin-0.1.lsm
+Platform: Linux. Needs Qt 2.2.x and KDE 2.0 (KDE 2.1 for Cookie config)
+Copying-policy: GPL
+End
diff --git a/konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.rc b/konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.rc
new file mode 100644
index 0000000..916a52e
--- /dev/null
+++ b/konq-plugins/khtmlsettingsplugin/khtmlsettingsplugin.rc
@@ -0,0 +1,11 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="khtmlsettingsplugin" library="libkhtmlsettingsplugin" version="3">
+<MenuBar>
+ <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="action menu"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="extraToolBar"><text>Extra Toolbar</text>
+ <Action name="action menu"/>
+</ToolBar>
+</kpartplugin>
diff --git a/konq-plugins/khtmlsettingsplugin/settingsplugin.cpp b/konq-plugins/khtmlsettingsplugin/settingsplugin.cpp
new file mode 100644
index 0000000..74f2613
--- /dev/null
+++ b/konq-plugins/khtmlsettingsplugin/settingsplugin.cpp
@@ -0,0 +1,328 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <dcopclient.h>
+
+#include <kapplication.h>
+#include <kaction.h>
+#include <kconfig.h>
+#include <kglobal.h>
+#include <khtml_part.h>
+#include <kinstance.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpopupmenu.h>
+#include <kprotocolmanager.h>
+#include <kgenericfactory.h>
+#include <kaboutdata.h>
+
+#include "settingsplugin.h"
+
+typedef KGenericFactory<SettingsPlugin> SettingsPluginFactory;
+static const KAboutData aboutdata("khtmlsettingsplugin", I18N_NOOP("HTML Settings") , "1.0" );
+K_EXPORT_COMPONENT_FACTORY( libkhtmlsettingsplugin,
+ SettingsPluginFactory( &aboutdata ) )
+
+SettingsPlugin::SettingsPlugin( QObject* parent, const char* name,
+ const QStringList & )
+ : KParts::Plugin( parent, name ), mConfig(0)
+{
+
+ setInstance(SettingsPluginFactory::instance());
+
+ if ( !kapp->dcopClient()->isAttached() )
+ kapp->dcopClient()->attach();
+
+ KActionMenu *menu = new KActionMenu( i18n("HTML Settings"), "configure",
+ actionCollection(), "action menu" );
+ menu->setDelayed( false );
+
+ KToggleAction *action;
+
+
+ action = new KToggleAction( i18n("Java&Script"), 0,
+ this, SLOT(toggleJavascript()),
+ actionCollection(), "javascript" );
+ menu->insert( action );
+
+ action = new KToggleAction( i18n("&Java"), 0,
+ this, SLOT(toggleJava()),
+ actionCollection(), "java" );
+ menu->insert( action );
+
+ action = new KToggleAction( i18n("&Cookies"), 0,
+ this, SLOT(toggleCookies()),
+ actionCollection(), "cookies" );
+ menu->insert( action );
+
+ action = new KToggleAction( i18n("&Plugins"), 0,
+ this, SLOT(togglePlugins()),
+ actionCollection(), "plugins" );
+ menu->insert( action );
+
+ action = new KToggleAction( i18n("Autoload &Images"), 0,
+ this, SLOT(toggleImageLoading()),
+ actionCollection(), "imageloading" );
+ menu->insert( action );
+
+ menu->insert( new KActionSeparator(actionCollection()) );
+
+ action = new KToggleAction( i18n("Enable Pro&xy"), 0,
+ this, SLOT(toggleProxy()),
+ actionCollection(), "useproxy" );
+ action->setCheckedState(i18n("Disable Pro&xy"));
+ menu->insert( action );
+
+ action = new KToggleAction( i18n("Enable Cac&he"), 0,
+ this, SLOT(toggleCache()),
+ actionCollection(), "usecache" );
+ action->setCheckedState(i18n("Disable Cac&he"));
+ menu->insert( action );
+
+
+ KSelectAction *sAction = new KSelectAction( i18n("Cache Po&licy"), 0,
+ 0, 0, actionCollection(),
+ "cachepolicy" );
+ QStringList policies;
+ policies += i18n( "&Keep Cache in Sync" );
+ policies += i18n( "&Use Cache if Possible" );
+ policies += i18n( "&Offline Browsing Mode" );
+ sAction->setItems( policies );
+ connect( sAction, SIGNAL( activated( int ) ), SLOT( cachePolicyChanged(int) ) );
+
+ menu->insert( sAction );
+
+ connect( menu->popupMenu(), SIGNAL( aboutToShow() ), SLOT( showPopup() ));
+}
+
+SettingsPlugin::~SettingsPlugin()
+{
+ delete mConfig;
+}
+
+void SettingsPlugin::showPopup()
+{
+ if( !parent() || !parent()->inherits("KHTMLPart"))
+ return;
+
+ if (!mConfig)
+ mConfig = new KConfig("settingspluginrc", false, false);
+
+ KHTMLPart *part = static_cast<KHTMLPart *>( parent() );
+
+ KProtocolManager::reparseConfiguration();
+ bool cookies = cookiesEnabled( part->url().url() );
+
+ ((KToggleAction*)actionCollection()->action("useproxy"))->setChecked(KProtocolManager::useProxy());
+ ((KToggleAction*)actionCollection()->action("java"))->setChecked( part->javaEnabled() );
+ ((KToggleAction*)actionCollection()->action("javascript"))->setChecked( part->jScriptEnabled() );
+ ((KToggleAction*)actionCollection()->action("cookies"))->setChecked( cookies );
+ ((KToggleAction*)actionCollection()->action("plugins"))->setChecked( part->pluginsEnabled() );
+ ((KToggleAction*)actionCollection()->action("imageloading"))->setChecked( part->autoloadImages() );
+ ((KToggleAction*)actionCollection()->action("usecache"))->setChecked(KProtocolManager::useCache());
+
+ KIO::CacheControl cc = KProtocolManager::cacheControl();
+ switch ( cc )
+ {
+ case KIO::CC_Verify:
+ ((KSelectAction*)actionCollection()->action("cachepolicy"))->setCurrentItem( 0 );
+ break;
+ case KIO::CC_CacheOnly:
+ ((KSelectAction*)actionCollection()->action("cachepolicy"))->setCurrentItem( 2 );
+ break;
+ case KIO::CC_Cache:
+ ((KSelectAction*)actionCollection()->action("cachepolicy"))->setCurrentItem( 1 );
+ break;
+ case KIO::CC_Reload: // nothing for now
+ case KIO::CC_Refresh:
+ default:
+ break;
+
+ }
+}
+
+void SettingsPlugin::toggleJava()
+{
+ if( parent() && parent()->inherits("KHTMLPart"))
+ {
+ KHTMLPart *part = static_cast<KHTMLPart *>(parent());
+ part->setJavaEnabled( ((KToggleAction*)actionCollection()->action("java"))->isChecked() );
+ }
+}
+
+void SettingsPlugin::toggleJavascript()
+{
+ if( parent() && parent()->inherits("KHTMLPart"))
+ {
+ KHTMLPart *part = static_cast<KHTMLPart *>(parent());
+ part->setJScriptEnabled( ((KToggleAction*)actionCollection()->action("javascript"))->isChecked() );
+ }
+}
+
+void SettingsPlugin::toggleCookies()
+{
+ if( !parent() || !parent()->inherits("KHTMLPart"))
+ return;
+
+ KHTMLPart *part = static_cast<KHTMLPart *>( parent() );
+
+ QString advice;
+ bool enable = ((KToggleAction*)actionCollection()->action("cookies"))->isChecked();
+ advice = enable ? "Accept" : "Reject";
+
+ QCString replyType;
+ QByteArray data, replyData;
+ QDataStream stream( data, IO_WriteOnly );
+ stream << part->url().url() << advice;
+ bool ok = kapp->dcopClient()->call( "kded", "kcookiejar",
+ "setDomainAdvice(QString,QString)",
+ data, replyType, replyData, true );
+
+ if ( !ok )
+ KMessageBox::sorry( part->widget(),
+ i18n("I can't enable cookies, because the "
+ "cookie daemon could not be started."),
+ i18n("Cookies Disabled"));
+}
+
+void SettingsPlugin::togglePlugins()
+{
+ if( parent() && parent()->inherits("KHTMLPart"))
+ {
+ KHTMLPart *part = static_cast<KHTMLPart *>(parent());
+ part->setPluginsEnabled( ((KToggleAction*)actionCollection()->action("plugins"))->isChecked() );
+ }
+}
+
+void SettingsPlugin::toggleImageLoading()
+{
+ if( parent() && parent()->inherits("KHTMLPart"))
+ {
+ KHTMLPart *part = static_cast<KHTMLPart *>(parent());
+ part->setAutoloadImages( ((KToggleAction*)actionCollection()->action("imageloading"))->isChecked() );
+ }
+}
+
+bool SettingsPlugin::cookiesEnabled( const QString& url )
+{
+ QByteArray data, reply;
+ QCString replyType;
+ QDataStream stream( data, IO_WriteOnly );
+ stream << url;
+ kapp->dcopClient()->call( "kcookiejar", "kcookiejar", "getDomainAdvice(QString)", data, replyType, reply, true );
+
+ bool enabled = false;
+
+ if ( replyType == "QString" )
+ {
+ QString advice;
+ QDataStream s( reply, IO_ReadOnly );
+ s >> advice;
+ enabled = ( advice == "Accept" );
+ if ( !enabled && advice == "Dunno" ) {
+ // TODO, check the global setting via dcop
+ KConfig kc( "kcookiejarrc", true, false );
+ kc.setGroup( "Cookie Policy" );
+ enabled =
+ (kc.readEntry( "CookieGlobalAdvice", "Reject" ) == "Accept");
+ }
+ }
+
+ return enabled;
+}
+
+
+//
+// sync with kcontrol/kio/ksaveioconfig.* !
+//
+
+void SettingsPlugin::toggleProxy()
+{
+ bool enable = ((KToggleAction*)actionCollection()->action("useproxy"))->isChecked();
+
+ int type;
+
+ if( enable )
+ type = mConfig->readNumEntry( "SavedProxyType", KProtocolManager::ManualProxy );
+ else
+ {
+ mConfig->writeEntry( "SavedProxyType", KProtocolManager::proxyType() );
+ type = KProtocolManager::NoProxy;
+ }
+
+ KConfig config("kioslaverc", false, false);
+ config.setGroup( "Proxy Settings" );
+ config.writeEntry( "ProxyType", type );
+
+ ((KToggleAction*)actionCollection()->action("useproxy"))->setChecked(enable);
+ updateIOSlaves();
+}
+
+
+void SettingsPlugin::toggleCache()
+{
+ bool usesCache = KProtocolManager::useCache();
+ KConfig config( "kio_httprc", false, false );
+ config.writeEntry( "UseCache", !usesCache );
+
+ ((KToggleAction*)actionCollection()->action("usecache"))->setChecked( !usesCache );
+
+ updateIOSlaves();
+}
+
+void SettingsPlugin::cachePolicyChanged( int p )
+{
+ QString policy;
+
+ switch ( p ) {
+ case 0:
+ policy = KIO::getCacheControlString( KIO::CC_Verify );
+ break;
+ case 1:
+ policy = KIO::getCacheControlString( KIO::CC_Cache );
+ break;
+ case 2:
+ policy = KIO::getCacheControlString( KIO::CC_CacheOnly );
+ break;
+ };
+
+ if ( !policy.isEmpty() ) {
+ KConfig config("kio_httprc", false, false);
+ config.writeEntry("cache", policy);
+
+ updateIOSlaves();
+ }
+}
+
+void SettingsPlugin::updateIOSlaves()
+{
+ QByteArray data;
+ QDataStream stream( data, IO_WriteOnly );
+
+ DCOPClient* client = kapp->dcopClient();
+ if ( !client->isAttached() )
+ client->attach();
+
+ QString protocol; // null -> all of them
+ stream << protocol;
+ client->send( "*", "KIO::Scheduler",
+ "reparseSlaveConfiguration(QString)", data );
+}
+
+#include "settingsplugin.moc"
diff --git a/konq-plugins/khtmlsettingsplugin/settingsplugin.h b/konq-plugins/khtmlsettingsplugin/settingsplugin.h
new file mode 100644
index 0000000..367846b
--- /dev/null
+++ b/konq-plugins/khtmlsettingsplugin/settingsplugin.h
@@ -0,0 +1,56 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef SETTINGS_PLUGIN
+#define SETTINGS_PLUGIN
+
+#include <kparts/plugin.h>
+#include <klibloader.h>
+
+class KConfig;
+
+class SettingsPlugin : public KParts::Plugin
+{
+ Q_OBJECT
+public:
+ SettingsPlugin( QObject* parent, const char* name,
+ const QStringList & );
+ virtual ~SettingsPlugin();
+
+private:
+ bool cookiesEnabled( const QString& url );
+ void updateIOSlaves();
+
+private slots:
+ void toggleJavascript();
+ void toggleJava();
+ void toggleCookies();
+ void togglePlugins();
+ void toggleImageLoading();
+ void toggleProxy();
+ void toggleCache();
+ void cachePolicyChanged( int p );
+
+ void showPopup();
+
+private:
+ KConfig* mConfig;
+};
+
+#endif // SETTINGS_PLUGIN