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

0001 /*
0002     SPDX-FileCopyrightText: 1996 Martin R. Jones
0003     HTML Options
0004     SPDX-FileCopyrightText: 1998 Torben Weis
0005     Port to KControl
0006     SPDX-FileCopyrightText: 2000 Daniel Molkentin
0007     Redesign and cleanup
0008 
0009 */
0010 
0011 #ifndef JAVAOPTS_H
0012 #define JAVAOPTS_H
0013 
0014 #include <kcmodule.h>
0015 
0016 #include "domainlistview.h"
0017 #include "policies.h"
0018 #include <KSharedConfig>
0019 
0020 class KUrlRequester;
0021 
0022 class QCheckBox;
0023 class QLineEdit;
0024 class KPluralHandlingSpinBox;
0025 
0026 class KJavaOptions;
0027 
0028 /** policies with java-specific constructor
0029   */
0030 class JavaPolicies : public Policies
0031 {
0032 public:
0033     /**
0034      * constructor
0035      * @param config configuration to initialize this instance from
0036      * @param group config group to use if this instance contains the global
0037      *    policies (global == true)
0038      * @param global true if this instance contains the global policy settings,
0039      *    false if this instance contains policies specific for a domain.
0040      * @param domain name of the domain this instance is used to configure the
0041      *    policies for (case insensitive, ignored if global == true)
0042      */
0043     JavaPolicies(const KSharedConfig::Ptr &config, const QString &group, bool global,
0044                  const QString &domain = QString());
0045 
0046     /** empty constructor to make QMap happy
0047      * don't use for constructing a policies instance.
0048      * @internal
0049      */
0050     //JavaPolicies();
0051 
0052     ~JavaPolicies() override;
0053 };
0054 
0055 /** Java-specific enhancements to the domain list view
0056   */
0057 class JavaDomainListView : public DomainListView
0058 {
0059     Q_OBJECT
0060 public:
0061     JavaDomainListView(KSharedConfig::Ptr config, const QString &group, KJavaOptions *opt,
0062                        QWidget *parent);
0063     ~JavaDomainListView() override;
0064 
0065     /** remnant for importing pre KDE 3.2 settings
0066       */
0067     void updateDomainListLegacy(const QStringList &domainConfig);
0068 
0069 protected:
0070     JavaPolicies *createPolicies() override;
0071     JavaPolicies *copyPolicies(Policies *pol) override;
0072     void setupPolicyDlg(PushButton trigger, PolicyDialog &pDlg,
0073                                 Policies *copy) override;
0074 
0075 private:
0076     QString group;
0077     KJavaOptions *options;
0078 };
0079 
0080 class KJavaOptions : public KCModule
0081 {
0082     Q_OBJECT
0083 
0084 public:
0085     KJavaOptions(const KSharedConfig::Ptr &config, const QString &group, QWidget *parent);
0086 
0087     void load() override;
0088     void save() override;
0089     void defaults() override;
0090 
0091     bool _removeJavaScriptDomainAdvice;
0092 
0093 #if QT_VERSION_MAJOR < 6
0094     void setNeedsSave(bool needs) {emit changed(needs);}
0095 #endif
0096 
0097 private Q_SLOTS:
0098     void slotChanged();
0099     void toggleJavaControls();
0100 
0101 private:
0102 
0103     KSharedConfig::Ptr m_pConfig;
0104     QString  m_groupname;
0105     JavaPolicies java_global_policies;
0106 
0107     QCheckBox     *enableJavaGloballyCB;
0108     QCheckBox     *javaSecurityManagerCB;
0109     QCheckBox     *useKioCB;
0110     QCheckBox     *enableShutdownCB;
0111     KPluralHandlingSpinBox *serverTimeoutSB;
0112     QLineEdit     *addArgED;
0113     KUrlRequester *pathED;
0114     bool           _removeJavaDomainSettings;
0115 
0116     JavaDomainListView *domainSpecific;
0117 
0118     friend class JavaDomainListView;
0119 };
0120 
0121 #endif      // HTML_OPTIONS_H
0122