summaryrefslogtreecommitdiff
path: root/client/widgets/widget.h
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/widget.h')
-rw-r--r--client/widgets/widget.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/client/widgets/widget.h b/client/widgets/widget.h
index bb37c51..3de148f 100644
--- a/client/widgets/widget.h
+++ b/client/widgets/widget.h
@@ -52,6 +52,9 @@
* value.
* @att help This attribute contains a help text for this widget. It will be
* shown to the user when the mouse is hovering over the widget.
+ * @att local This attribute is a boolean telling wether the field can be stored
+ * in the database on commits. It can be either 'true' or 'false'. The default
+ * is 'false'.
*/
class QLayout;
@@ -75,6 +78,9 @@ public:
bool valid(bool deep = false);
void setValid(bool valid, bool deep = false);
+ // Make sanity check before commit.
+ bool committable(bool deep = false);
+
// Implement in subclasses to contribute to the validation.
virtual bool preValid() { return true; }
@@ -95,7 +101,8 @@ public:
Widget *findWidget(QString name, bool deep = false);
QVector< Widget* > widgetList(bool deep = false);
void addChild(Widget *widget);
- void setValues();
+
+ virtual void setValues();
signals:
void wasChanged();
@@ -115,6 +122,11 @@ protected:
QWidget *widget;
bool hideChildren;
+ // Implement in subclasses to be able to block commits.
+ virtual bool preCommit() { return true; }
+
+ // Overload this to avoid children 'wasChanged' connection.
+ virtual void connectChild(Widget *child);
void addChildren(QDomNode &xml_node, QLayout *layout);
LUA *lua;