Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konqueror / settings / konqhtml / policydlg.h
blobe09a92a8c9507f51b69b8a8ecb471db6f9e729aa
1 /*
2 * Copyright (C) < 2002 to whoever created and edited this file before
3 * Copyright (C) 2002 Leo Savernik <l.savernik@aon.at>
4 * Generalizing the policy dialog
6 */
8 #ifndef _POLICYDLG_H
9 #define _POLICYDLG_H
11 #include <kdialog.h>
13 #include <QtGui/QLineEdit>
14 #include <QtCore/QStringList>
16 class QLabel;
17 class QComboBox;
18 class QString;
19 class QVBoxLayout;
20 class QPushButton;
22 class Policies;
24 /**
25 * A dialog for editing domain-specific policies.
27 * Each dialog must be associated with a relevant Policies instance which
28 * will be updated within this dialog appropriately.
30 * Additionally you can insert your own widget containing controls for
31 * specific policies with addPolicyPanel.
33 * @author unknown
35 class PolicyDialog : public KDialog
37 Q_OBJECT
39 public:
40 /**
41 * Enumerates the possible return values for the "feature enabled"
42 * policy
44 enum FeatureEnabledPolicy { InheritGlobal = 0, Accept, Reject };
46 /** constructor
47 * @param policies policies object this dialog will write the settings
48 * into. Note that it always reflects the current settings,
49 * even if the dialog has been canceled.
50 * @param parent parent widget this belongs to
51 * @param name internal name
53 explicit PolicyDialog(Policies *policies, QWidget *parent = 0, const char *name = 0 );
55 virtual ~PolicyDialog() {}
58 * @return whether this feature should be activated, deactivated or
59 * inherited from the respective global policy.
61 FeatureEnabledPolicy featureEnabledPolicy() const;
63 /**
64 * @return the textual representation of the current "feature enabled"
65 * policy
67 QString featureEnabledPolicyText() const;
70 * @return the hostname for which the policy is being set
72 QString domain() const { return le_domain->text(); }
75 * Sets the line-edit to be enabled/disabled.
77 * This method will set the text in the lineedit if the
78 * value is not null.
80 * @param state @p true to enable the line-edit, otherwise disabled.
81 * @param text the text to be set in the line-edit. Default is NULL.
83 void setDisableEdit( bool /*state*/, const QString& text = QString() );
85 /**
86 * Sets the label for the "feature enabled" policy
87 * @param text label text
89 void setFeatureEnabledLabel(const QString &text);
91 /**
92 * Sets the "What's This" text for the "feature enabled" policy
93 * combo box.
94 * @param text what's-this text
96 void setFeatureEnabledWhatsThis(const QString &text);
98 /**
99 * Syncs the controls with the current content of the
100 * associated policies object.
102 void refresh();
105 * Adds another panel which contains controls for more policies.
107 * The widget is inserted between the "feature enabled" combo box and
108 * the dialog buttons at the bottom.
110 * Currently at most one widget can be added.
111 * @param panel pointer to widget to insert. The dialog takes ownership
112 * of it, but does not reparent it.
114 void addPolicyPanel(QWidget *panel);
116 protected Q_SLOTS:
118 virtual void accept();
119 void slotTextChanged( const QString &text);
121 private:
122 Policies *policies;
123 QVBoxLayout *topl;
124 int insertIdx;
125 QLineEdit *le_domain;
126 QLabel *l_feature_policy;
127 QComboBox *cb_feature_policy;
128 QWidget *panel;
129 QStringList policy_values;
130 QPushButton *okButton;
133 #endif