Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konqueror / settings / konqhtml / main.cpp
blob0b34466b76229e46c6546c9f9d62a1cb8dec3477
1 /*
2 * main.cpp
4 * Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
5 * Copyright (c) 2000 Daniel Molkentin <molkentin@kde.org>
7 * Requires the Qt widget libraries, available at no cost at
8 * http://www.troll.no/
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 // Own
26 #include "main.h"
28 // std
29 #include <unistd.h>
31 // Qt
32 #include <QtGui/QTabWidget>
33 #include <QtGui/QLayout>
34 #include <QtDBus/QtDBus>
36 // KDE
37 #include <kapplication.h>
38 #include <kaboutdata.h>
39 #include <KPluginFactory>
40 #include <KPluginLoader>
42 // Local
43 #include "jsopts.h"
44 #include "javaopts.h"
45 #include "pluginopts.h"
46 #include "appearance.h"
47 #include "htmlopts.h"
48 #include "filteropts.h"
49 #include "generalopts.h"
51 K_PLUGIN_FACTORY(KcmKonqHtmlFactory,
52 registerPlugin<KJSParts>("khtml_java_js");
53 registerPlugin<KPluginOptions>("khtml_plugins");
54 registerPlugin<KMiscHTMLOptions>("khtml_behavior");
55 registerPlugin<KKonqGeneralOptions>("khtml_general");
56 registerPlugin<KCMFilter>("khtml_filter");
57 registerPlugin<KAppearanceOptions>("khtml_appearance");
59 K_EXPORT_PLUGIN(KcmKonqHtmlFactory("kcmkonqhtml"))
61 KJSParts::KJSParts(QWidget *parent, const QVariantList&)
62 : KCModule(KcmKonqHtmlFactory::componentData(), parent)
64 mConfig = KSharedConfig::openConfig("konquerorrc", KConfig::NoGlobals);
65 KAboutData *about =
66 new KAboutData(I18N_NOOP("kcmkonqhtml"), 0, ki18n("Konqueror Browsing Control Module"),
67 0, KLocalizedString(), KAboutData::License_GPL,
68 ki18n("(c) 1999 - 2001 The Konqueror Developers"));
70 about->addAuthor(ki18n("Waldo Bastian"),KLocalizedString(),"bastian@kde.org");
71 about->addAuthor(ki18n("David Faure"),KLocalizedString(),"faure@kde.org");
72 about->addAuthor(ki18n("Matthias Kalle Dalheimer"),KLocalizedString(),"kalle@kde.org");
73 about->addAuthor(ki18n("Lars Knoll"),KLocalizedString(),"knoll@kde.org");
74 about->addAuthor(ki18n("Dirk Mueller"),KLocalizedString(),"mueller@kde.org");
75 about->addAuthor(ki18n("Daniel Molkentin"),KLocalizedString(),"molkentin@kde.org");
76 about->addAuthor(ki18n("Wynn Wilkes"),KLocalizedString(),"wynnw@caldera.com");
78 about->addCredit(ki18n("Leo Savernik"),ki18n("JavaScript access controls\n"
79 "Per-domain policies extensions"),
80 "l.savernik@aon.at");
82 setAboutData( about );
84 QVBoxLayout *layout = new QVBoxLayout(this);
85 tab = new QTabWidget(this);
86 layout->addWidget(tab);
88 // ### the groupname is duplicated in KJSParts::save
89 java = new KJavaOptions( mConfig, "Java/JavaScript Settings", componentData(), this );
90 tab->addTab( java, i18n( "&Java" ) );
91 connect( java, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
93 javascript = new KJavaScriptOptions( mConfig, "Java/JavaScript Settings", componentData(), this );
94 tab->addTab( javascript, i18n( "Java&Script" ) );
95 connect( javascript, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
98 void KJSParts::load()
100 javascript->load();
101 java->load();
105 void KJSParts::save()
107 javascript->save();
108 java->save();
110 // delete old keys after they have been migrated
111 if (javascript->_removeJavaScriptDomainAdvice
112 || java->_removeJavaScriptDomainAdvice) {
113 mConfig->group("Java/JavaScript Settings").deleteEntry("JavaScriptDomainAdvice");
114 javascript->_removeJavaScriptDomainAdvice = false;
115 java->_removeJavaScriptDomainAdvice = false;
118 mConfig->sync();
120 // Send signal to konqueror
121 // Warning. In case something is added/changed here, keep kfmclient in sync
122 QDBusMessage message =
123 QDBusMessage::createSignal("/KonqMain", "org.kde.Konqueror.Main", "reparseConfiguration");
124 QDBusConnection::sessionBus().send(message);
128 void KJSParts::defaults()
130 javascript->defaults();
131 java->defaults();
134 QString KJSParts::quickHelp() const
136 return i18n("<h2>JavaScript</h2>On this page, you can configure "
137 "whether JavaScript programs embedded in web pages should "
138 "be allowed to be executed by Konqueror."
139 "<h2>Java</h2>On this page, you can configure "
140 "whether Java applets embedded in web pages should "
141 "be allowed to be executed by Konqueror."
142 "<br /><br /><b>Note:</b> Active content is always a "
143 "security risk, which is why Konqueror allows you to specify very "
144 "fine-grained from which hosts you want to execute Java and/or "
145 "JavaScript programs." );
148 #include "main.moc"