summaryrefslogtreecommitdiff
path: root/client/widgets/widget.h
diff options
context:
space:
mode:
authordeva <deva>2011-04-13 12:16:56 +0000
committerdeva <deva>2011-04-13 12:16:56 +0000
commit175d195c0ed56487322a03939a1c60cb05cb3f8e (patch)
tree0524e21caa29cc68dded49ae68a62d0e603df797 /client/widgets/widget.h
parentcb6c72436d96cc85d3442aeaf25ead4245420f8d (diff)
Introduce new committable/preCommit methods, that can be used to block a commit from inside the widgets.
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;