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
13 #include <QtGui/QLineEdit>
14 #include <QtCore/QStringList>
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.
35 class PolicyDialog
: public KDialog
41 * Enumerates the possible return values for the "feature enabled"
44 enum FeatureEnabledPolicy
{ InheritGlobal
= 0, Accept
, Reject
};
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;
64 * @return the textual representation of the current "feature enabled"
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
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() );
86 * Sets the label for the "feature enabled" policy
87 * @param text label text
89 void setFeatureEnabledLabel(const QString
&text
);
92 * Sets the "What's This" text for the "feature enabled" policy
94 * @param text what's-this text
96 void setFeatureEnabledWhatsThis(const QString
&text
);
99 * Syncs the controls with the current content of the
100 * associated policies object.
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
);
118 virtual void accept();
119 void slotTextChanged( const QString
&text
);
125 QLineEdit
*le_domain
;
126 QLabel
*l_feature_policy
;
127 QComboBox
*cb_feature_policy
;
129 QStringList policy_values
;
130 QPushButton
*okButton
;