summaryrefslogtreecommitdiffstats
path: root/kmymoney2/widgets/kguiutils.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 22:38:03 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 22:38:03 +0000
commitdadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (patch)
tree99e72842fe687baea16376a147619b6048d7e441 /kmymoney2/widgets/kguiutils.h
downloadkmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.tar.gz
kmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.zip
Added kmymoney
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/widgets/kguiutils.h')
-rw-r--r--kmymoney2/widgets/kguiutils.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/kmymoney2/widgets/kguiutils.h b/kmymoney2/widgets/kguiutils.h
new file mode 100644
index 0000000..9a7b603
--- /dev/null
+++ b/kmymoney2/widgets/kguiutils.h
@@ -0,0 +1,94 @@
+/***************************************************************************
+ kguiutils.h - description
+ -------------------
+ begin : Fri Jan 27 2006
+ copyright : (C) 2006 Tony Bloomfield
+ email : Tony Bloomfield <[email protected]>
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KGUIUTILS_H
+#define KGUIUTILS_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qobject.h>
+#include <qvaluelist.h>
+class QWidget;
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+#include <kcombobox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+/**
+ * @author Tony Bloomfield
+ */
+class kMandatoryFieldGroup : public QObject
+{
+ Q_OBJECT
+
+public:
+ kMandatoryFieldGroup(QObject *parent) :
+ QObject(parent), okButton(0), m_enabled(true) {}
+
+ /**
+ * This method adds a widget to the list of mandatory fields for the current dialog
+ *
+ * @param widget pointer to the widget to be added
+ */
+ void add(QWidget *widget);
+
+ /**
+ * This method removes a widget form the list of mandatory fields for the current dialog
+ *
+ * @param widget pointer to the widget to be removed
+ */
+ void remove(QWidget *widget);
+
+ /**
+ * This method designates the button to be enabled when all mandatory fields
+ * have been completed
+ *
+ * @param button pointer to the 'ok' button
+ */
+ void setOkButton(QPushButton *button);
+
+ /**
+ * This method returns if all requirements for the mandatory group
+ * have been fulfilled (@p true) or not (@p false).
+ */
+ bool isEnabled(void) const { return m_enabled; }
+
+public slots:
+ void clear(void);
+
+ /**
+ * Force update of ok button
+ */
+ void changed(void);
+
+signals:
+ void stateChanged(void);
+ void stateChanged(bool state);
+
+private:
+ QValueList<QWidget *> widgets;
+ QPushButton* okButton;
+ bool m_enabled;
+};
+
+#endif // KGUIUTILS_H