summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <[email protected]>2015-06-03 09:05:39 +0200
committerRalf Habacker <[email protected]>2015-06-04 08:34:57 +0200
commit35ade8503277976de03d9a51f9d3928bd975d3ee (patch)
tree05ea9f9a5096e3b8175b01838af3868774a3a400
parentef150157dd9bc961dd3bcd02ba5d408a193ddf22 (diff)
Move dialog validation support used by ParameterPropertiesDialog into base class SinglePageDialogBase.
-rw-r--r--umbrello/dialogs/parameterpropertiesdialog.cpp14
-rw-r--r--umbrello/dialogs/parameterpropertiesdialog.h7
-rw-r--r--umbrello/dialogs/singlepagedialogbase.cpp14
-rw-r--r--umbrello/dialogs/singlepagedialogbase.h1
4 files changed, 16 insertions, 20 deletions
diff --git a/umbrello/dialogs/parameterpropertiesdialog.cpp b/umbrello/dialogs/parameterpropertiesdialog.cpp
index dd7a9b5..1053393 100644
--- a/umbrello/dialogs/parameterpropertiesdialog.cpp
+++ b/umbrello/dialogs/parameterpropertiesdialog.cpp
@@ -217,20 +217,6 @@ bool ParameterPropertiesDialog::validate()
return true;
}
-/**
- * Activated when a button is clicked
- * @param button The button that was clicked
- */
-void ParameterPropertiesDialog::slotButtonClicked(int button)
-{
- if (button == KDialog::Ok) {
- if (!validate()) {
- return;
- }
- }
- KDialog::slotButtonClicked(button);
-}
-
bool ParameterPropertiesDialog::apply()
{
if (m_pAtt != NULL) {
diff --git a/umbrello/dialogs/parameterpropertiesdialog.h b/umbrello/dialogs/parameterpropertiesdialog.h
index 25fb59f..348a91c 100644
--- a/umbrello/dialogs/parameterpropertiesdialog.h
+++ b/umbrello/dialogs/parameterpropertiesdialog.h
@@ -59,12 +59,7 @@ protected:
Uml::ParameterDirection::Enum getParmKind();
void insertTypesSorted(const QString& type = QString());
-
- bool validate();
-
-protected slots:
-
- virtual void slotButtonClicked(int button);
+ virtual bool validate();
private:
QGroupBox * m_pParmGB;
diff --git a/umbrello/dialogs/singlepagedialogbase.cpp b/umbrello/dialogs/singlepagedialogbase.cpp
index 6dc1afe..f9d76d1 100644
--- a/umbrello/dialogs/singlepagedialogbase.cpp
+++ b/umbrello/dialogs/singlepagedialogbase.cpp
@@ -160,6 +160,8 @@ void SinglePageDialogBase::slotApply()
*/
void SinglePageDialogBase::slotOk()
{
+ if (!validate())
+ return;
if (apply()) {
done(Ok);
}
@@ -196,4 +198,16 @@ void SinglePageDialogBase::enableButtonOk(bool enable)
m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
}
+/**
+ * Return state of dialog input validation.
+ *
+ * The false state is used to prevent closing the dialog.
+ *
+ * @return true if dialog entries are valid
+ */
+bool SinglePageDialogBase::validate()
+{
+ return true;
+}
+
#endif
diff --git a/umbrello/dialogs/singlepagedialogbase.h b/umbrello/dialogs/singlepagedialogbase.h
index 3487ecf..17863cc 100644
--- a/umbrello/dialogs/singlepagedialogbase.h
+++ b/umbrello/dialogs/singlepagedialogbase.h
@@ -64,6 +64,7 @@ protected:
QWidget *m_mainWidget;
void enableButtonOk(bool enable);
#endif
+ virtual bool validate();
};
#endif