src/dbconfigureform.h
changeset 0 04114bce8fd0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/dbconfigureform.h	Thu May 18 23:05:01 2006 +0200
@@ -0,0 +1,51 @@
+#include <qdialog.h>
+#include <tdbconfig.h>
+
+class InputField;
+class InputCombo;
+
+/*!
+  DataBase configuration form, which asks for enough information to connect to a
+  database.
+  The information is stored in a structure given in the constructor.
+  \sa DBConfigureForm()
+  */
+class DBConfigureForm : public QDialog
+{
+	Q_OBJECT
+
+private:
+	InputField *host, *username, *database, *password;
+	InputCombo *driver;
+	Tdb_config *db_config;
+	QPushButton *apply_button;
+
+public slots:
+	/*!
+	  Accept the changes made in the form. It also closes the dialog.
+	  */
+	void acceptChanges();
+	/*!
+	  Updates the contents of the #db_config structure using the actual
+	  values of the input fields
+	  Returns 0 if no error, error happened otherwise.
+	  */
+	int updateVariables();
+	/*!
+	  Sets the state of the Apply button to Enabled
+	  */
+	void setFormChanged();
+	/*!
+	  Sets the state of the Apply button to Disabled
+	  */
+	void setFormNoChanged();
+
+public:
+	/*!
+	  Constructs the configuration form using #mydbconfig for storing
+	  the form values.
+	  \param mydbconfig The structure used to store the database information
+	  */
+	DBConfigureForm(Tdb_config *mydbconfig,
+		QWidget *parent=0, const char *name=0);
+};