File indexing completed on 2024-05-05 05:00:09

0001 //-----------------------------------------------------------------------------
0002 //
0003 // HTML Options
0004 //
0005 // (c) Martin R. Jones 1996
0006 //
0007 // Port to KControl
0008 // (c) Torben Weis 1998
0009 
0010 #ifndef JSOPTS_H
0011 #define JSOPTS_H
0012 
0013 #include <kcmodule.h>
0014 #include <KSharedConfig>
0015 #include "domainlistview.h"
0016 #include "jspolicies.h"
0017 
0018 class QCheckBox;
0019 
0020 class PolicyDialog;
0021 
0022 class KJavaScriptOptions;
0023 
0024 /** JavaScript-specific enhancements to the domain list view
0025   */
0026 class JSDomainListView : public DomainListView
0027 {
0028     Q_OBJECT
0029 public:
0030     JSDomainListView(KSharedConfig::Ptr config, const QString &group, KJavaScriptOptions *opt,
0031                      QWidget *parent);
0032     ~JSDomainListView() override;
0033 
0034     /** remnant for importing pre KDE 3.2 settings
0035       */
0036     void updateDomainListLegacy(const QStringList &domainConfig);
0037 
0038 protected:
0039     JSPolicies *createPolicies() override;
0040     JSPolicies *copyPolicies(Policies *pol) override;
0041     void setupPolicyDlg(PushButton trigger, PolicyDialog &pDlg,
0042                                 Policies *copy) override;
0043 
0044 private:
0045     QString group;
0046     KJavaScriptOptions *options;
0047 };
0048 
0049 class KJavaScriptOptions : public KCModule
0050 {
0051     Q_OBJECT
0052 public:
0053     KJavaScriptOptions(KSharedConfig::Ptr config, const QString &group, QWidget *parent);
0054 
0055     void load() override;
0056     void save() override;
0057     void defaults() override;
0058 
0059     bool _removeJavaScriptDomainAdvice;
0060 
0061 #if QT_VERSION_MAJOR < 6
0062     void setNeedsSave(bool needs) {emit changed(needs);}
0063 #endif
0064 
0065 private Q_SLOTS:
0066     void slotChangeJSEnabled();
0067 
0068 private:
0069 
0070     KSharedConfig::Ptr m_pConfig;
0071     QString m_groupname;
0072     JSPolicies js_global_policies;
0073     QCheckBox *enableJavaScriptGloballyCB;
0074     QCheckBox *reportErrorsCB;
0075     QCheckBox *jsDebugWindow;
0076     JSPoliciesFrame *js_policies_frame;
0077     bool _removeECMADomainSettings;
0078 
0079     JSDomainListView *domainSpecific;
0080 
0081     friend class JSDomainListView;
0082 };
0083 
0084 #endif      // JSOPTS_H
0085