1
// (C) < 2002 to whoever created and edited this file before
2
// (C) 2002 Leo Savernik <l.savernik@aon.at>
3
// Generalizing the policy dialog
8
#include <kdialogbase.h>
10
#include <qlineedit.h>
11
#include <qstringlist.h>
22
* A dialog for editing domain-specific policies.
24
* Each dialog must be associated with a relevant Policies instance which
25
* will be updated within this dialog appropriately.
27
* Additionally you can insert your own widget containing controls for
28
* specific policies with addPolicyPanel.
32
class PolicyDialog : public KDialogBase
38
* Enumerates the possible return values for the "feature enabled"
41
enum FeatureEnabledPolicy { InheritGlobal = 0, Accept, Reject };
44
* @param policies policies object this dialog will write the settings
45
* into. Note that it always reflects the current settings,
46
* even if the dialog has been cancelled.
47
* @param parent parent widget this belongs to
48
* @param name internal name
50
PolicyDialog(Policies *policies, QWidget *parent = 0, const char *name = 0 );
52
virtual ~PolicyDialog() {};
55
* @return whether this feature should be activated, deactivated or
56
* inherited from the respective global policy.
58
FeatureEnabledPolicy featureEnabledPolicy() const;
61
* @return the textual representation of the current "feature enabled"
64
QString featureEnabledPolicyText() const;
67
* @return the hostname for which the policy is being set
69
QString domain() const { return le_domain->text(); }
72
* Sets the line-edit to be enabled/disabled.
74
* This method will set the text in the lineedit if the
77
* @param state @p true to enable the line-edit, otherwise disabled.
78
* @param text the text to be set in the line-edit. Default is NULL.
80
void setDisableEdit( bool /*state*/, const QString& text = QString::null );
83
* Sets the label for the "feature enabled" policy
84
* @param text label text
86
void setFeatureEnabledLabel(const QString &text);
89
* Sets the "What's This" text for the "feature enabled" policy
91
* @param text what's-this text
93
void setFeatureEnabledWhatsThis(const QString &text);
96
* Syncs the controls with the current content of the
97
* associated policies object.
102
* Adds another panel which contains controls for more policies.
104
* The widget is inserted between the "feature enabled" combo box and
105
* the dialog buttons at the bottom.
107
* Currently at most one widget can be added.
108
* @param panel pointer to widget to insert. The dialog takes ownership
109
* of it, but does not reparent it.
111
void addPolicyPanel(QWidget *panel);
115
virtual void accept();
116
void slotTextChanged( const QString &text);
122
QLineEdit *le_domain;
123
QLabel *l_feature_policy;
124
QComboBox *cb_feature_policy;
126
QStringList policy_values;
127
QPushButton *okButton;