Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konqueror / settings / konqhtml / pluginopts.h
blobedc0308ecdfea87cdfee077b9c92ec9430bfbfd5
1 /*
2 * Plugin Options
4 * Copyright (c) 2002 Leo Savernik, per-domain settings
5 * Copyright (c) 2001, Daniel Naber, based on javaopts.h
6 * Copyright (c) 2000, Stefan Schimanski <1Stein@gmx.de>
7 * Netscape parts
9 */
11 #ifndef PLUGINOPTS_H
12 #define PLUGINOPTS_H
14 #include <QtGui/QWidget>
16 #include "domainlistview.h"
17 #include "policies.h"
19 class QCheckBox;
21 #include <kcmodule.h>
22 #include <kconfig.h>
23 #include "ui_nsconfigwidget.h"
25 class QBoxLayout;
26 class QLabel;
27 class KProgressDialog;
28 class QSlider;
29 class KDialog;
30 class KPluginOptions;
31 class KProcess;
32 namespace Ui {
33 class NSConfigWidget;
36 /** policies with plugin-specific constructor
38 class PluginPolicies : public Policies {
39 public:
40 /**
41 * constructor
42 * @param config configuration to initialize this instance from
43 * @param group config group to use if this instance contains the global
44 * policies (global == true)
45 * @param global true if this instance contains the global policy settings,
46 * false if this instance contains policies specific for a domain.
47 * @param domain name of the domain this instance is used to configure the
48 * policies for (case insensitive, ignored if global == true)
50 PluginPolicies(KSharedConfig::Ptr config, const QString &group, bool global,
51 const QString &domain = QString());
53 virtual ~PluginPolicies();
56 /** Plugin-specific enhancements to the domain list view
58 class PluginDomainListView : public DomainListView {
59 Q_OBJECT
60 public:
61 PluginDomainListView(KSharedConfig::Ptr config,const QString &group,KPluginOptions *opt,
62 QWidget *parent);
63 virtual ~PluginDomainListView();
65 protected:
66 virtual PluginPolicies *createPolicies();
67 virtual PluginPolicies *copyPolicies(Policies *pol);
68 virtual void setupPolicyDlg(PushButton trigger,PolicyDialog &pDlg,
69 Policies *copy);
71 private:
72 QString group;
73 KPluginOptions *options;
76 /**
77 * dialog for embedding a PluginDomainListView widget
79 class PluginDomainDialog : public QWidget {
80 Q_OBJECT
81 public:
83 PluginDomainDialog(QWidget *parent);
84 virtual ~PluginDomainDialog();
86 void setMainWidget(QWidget *widget);
88 private Q_SLOTS:
89 virtual void slotClose();
91 private:
92 PluginDomainListView *domainSpecific;
93 QBoxLayout *thisLayout;
96 class KPluginOptions : public KCModule
98 Q_OBJECT
100 public:
101 KPluginOptions( QWidget* parent, const QVariantList& );
103 virtual void load();
104 virtual void save();
105 virtual void defaults();
106 QString quickHelp() const;
108 private Q_SLOTS:
109 void slotChanged();
110 void slotTogglePluginsEnabled();
111 void slotShowDomainDlg();
113 private:
115 KSharedConfig::Ptr m_pConfig;
116 QString m_groupname;
117 KProcess *nspluginscan;
118 QByteArray m_output;
120 QCheckBox *enablePluginsGloballyCB, *enableHTTPOnly, *enableUserDemand;
123 protected Q_SLOTS:
124 void progress();
125 void updatePLabel(int);
126 void change() { change( true ); }
127 void change( bool c ) { emit changed(c); m_changed = c; }
129 void scan();
130 void scanDone();
132 private:
133 Ui::NSConfigWidget *m_widget;
134 bool m_changed;
135 KProgressDialog *m_progress;
136 QSlider *priority;
137 QLabel *priorityLabel;
138 PluginPolicies global_policies;
139 PluginDomainListView *domainSpecific;
140 KDialog *domainSpecificDlg;
142 /******************************************************************************/
143 protected:
144 void dirInit();
145 void dirLoad( KSharedConfig::Ptr config, bool useDefault= false );
146 void dirSave( KSharedConfig::Ptr config );
148 protected Q_SLOTS:
149 void dirNew();
150 void dirRemove();
151 void dirUp();
152 void dirDown();
153 void dirEdited(const QString &);
154 void dirSelect( QListWidgetItem * );
156 /******************************************************************************/
157 protected:
158 void pluginInit();
159 void pluginLoad( KSharedConfig::Ptr config );
160 void pluginSave( KSharedConfig::Ptr config );
162 friend class PluginDomainListView;
165 #endif // __PLUGINOPTS_H__