Skip to content

Commit

Permalink
Fixing "Unique" and "Enforce Unique constraint" error message (#3520)
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Jul 1, 2024
1 parent b9d080f commit 49e8ecc
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 26 deletions.
5 changes: 3 additions & 2 deletions app/qml/components/private/MMBaseInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Item {
property alias checkboxChecked: checkbox.checked

property bool readOnly: false
property bool shouldShowValidation: true

property string errorMsg: ""
property string warningMsg: ""
Expand Down Expand Up @@ -64,7 +65,7 @@ Item {
states: [
State {
name: "valid"
when: !warningMsg && !errorMsg
when: !shouldShowValidation || ( !warningMsg && !errorMsg )
},
State {
name: "error"
Expand Down Expand Up @@ -170,7 +171,7 @@ Item {
width: parent.width
height: validationMessagegroup.implicitHeight

visible: root.validationState !== "valid" && root.editState === "enabled"
visible: root.validationState !== "valid" && root.shouldShowValidation

RowLayout {
id: validationMessagegroup
Expand Down
4 changes: 3 additions & 1 deletion app/qml/form/MMFormPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ Page {
property var fieldWidget: model.EditorWidget
property var fieldConfig: model.EditorWidgetConfig

property bool fieldIsReadOnly: root.state === "readOnly" || !AttributeEditable
property bool fieldFormIsReadOnly: root.state === "readOnly"
property bool fieldIsEditable: AttributeEditable

property bool fieldShouldShowTitle: model.ShowName

property string fieldTitle: model.Name
Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormCalendarEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
property bool _fieldValueIsNull: parent.fieldValueIsNull

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property string _fieldTitle: parent.fieldTitle
property string _fieldErrorMessage: parent.fieldErrorMessage
Expand All @@ -58,7 +59,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
hasCheckbox: _fieldRememberValueSupported
checkboxChecked: _fieldRememberValueState

readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

onCheckboxCheckedChanged: {
root.rememberValueBoxClicked( checkboxChecked )
Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormNumberEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
property bool _fieldValueIsNull: parent.fieldValueIsNull

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property string _fieldTitle: parent.fieldTitle
property string _fieldErrorMessage: parent.fieldErrorMessage
Expand All @@ -41,7 +42,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
signal rememberValueBoxClicked( bool state )

title: _fieldShouldShowTitle ? _fieldTitle : ""
readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

errorMsg: _fieldErrorMessage
warningMsg: _fieldWarningMessage
Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormPhotoEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ MMFormPhotoViewer {
property var _fieldFeatureLayerPair: parent.fieldFeatureLayerPair

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property string _fieldTitle: parent.fieldTitle
property string _fieldErrorMessage: parent.fieldErrorMessage
Expand All @@ -80,7 +81,8 @@ MMFormPhotoViewer {
warningMsg: photoState === "notAvailable" ? qsTr( "Photo is missing." ) : _fieldWarningMessage
errorMsg: _fieldErrorMessage

readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

hasCheckbox: _fieldRememberValueSupported
checkboxChecked: _fieldRememberValueState
Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormRelationReferenceEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
property var _fieldConfig: parent.fieldConfig
property var _fieldActiveProject: parent.fieldActiveProject

property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property string _fieldTitle: parent.fieldTitle
Expand All @@ -45,7 +46,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
errorMsg: _fieldErrorMessage
warningMsg: _fieldWarningMessage

readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

hasCheckbox: _fieldRememberValueSupported
checkboxChecked: _fieldRememberValueState
Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormScannerEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
property bool _fieldValueIsNull: parent.fieldValueIsNull

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property string _fieldTitle: parent.fieldTitle
property string _fieldErrorMessage: parent.fieldErrorMessage
Expand All @@ -45,7 +46,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
warningMsg: _fieldWarningMessage
errorMsg: _fieldErrorMessage

readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

hasCheckbox: _fieldRememberValueSupported
checkboxChecked: _fieldRememberValueState
Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormSliderEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
property var _fieldConfig: parent.fieldConfig

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property string _fieldTitle: parent.fieldTitle
property string _fieldErrorMessage: parent.fieldErrorMessage
Expand All @@ -45,7 +46,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
warningMsg: _fieldWarningMessage
errorMsg: _fieldErrorMessage

readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

hasCheckbox: _fieldRememberValueSupported
checkboxChecked: _fieldRememberValueState
Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormSwitchEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ MMSwitchInput {
property var _fieldConfig: parent.fieldConfig

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property string _fieldTitle: parent.fieldTitle
property string _fieldErrorMessage: parent.fieldErrorMessage
Expand All @@ -45,7 +46,8 @@ MMSwitchInput {
warningMsg: _fieldWarningMessage
errorMsg: _fieldErrorMessage

readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

hasCheckbox: _fieldRememberValueSupported
checkboxChecked: _fieldRememberValueState
Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormTextEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ MMPrivateComponents.MMBaseSingleLineInput {
property bool _fieldValueIsNull: parent.fieldValueIsNull

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property string _fieldTitle: parent.fieldTitle
property string _fieldErrorMessage: parent.fieldErrorMessage
Expand All @@ -43,7 +44,8 @@ MMPrivateComponents.MMBaseSingleLineInput {

text: _fieldValue === undefined || _fieldValueIsNull ? '' : _fieldValue

readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

title: _fieldShouldShowTitle ? _fieldTitle : ""

Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormTextMultilineEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ MMPrivateComponents.MMBaseInput {
property bool _fieldValueIsNull: parent.fieldValueIsNull

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property string _fieldTitle: parent.fieldTitle
property string _fieldErrorMessage: parent.fieldErrorMessage
Expand All @@ -49,7 +50,8 @@ MMPrivateComponents.MMBaseInput {
warningMsg: _fieldWarningMessage
errorMsg: _fieldErrorMessage

readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

hasCheckbox: _fieldRememberValueSupported
checkboxChecked: _fieldRememberValueState
Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormValueMapEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ MMFormComboboxBaseEditor {
property bool _fieldValueIsNull: parent.fieldValueIsNull

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property string _fieldTitle: parent.fieldTitle
property string _fieldErrorMessage: parent.fieldErrorMessage
Expand All @@ -47,7 +48,8 @@ MMFormComboboxBaseEditor {
errorMsg: _fieldErrorMessage
warningMsg: _fieldWarningMessage

readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

hasCheckbox: _fieldRememberValueSupported
checkboxChecked: _fieldRememberValueState
Expand Down
6 changes: 4 additions & 2 deletions app/qml/form/editors/MMFormValueRelationEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ MMFormComboboxBaseEditor {
property var _fieldFeatureLayerPair: parent.fieldFeatureLayerPair

property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle
property bool _fieldIsReadOnly: parent.fieldIsReadOnly
property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly
property bool _fieldIsEditable: parent.fieldIsEditable

property string _fieldTitle: parent.fieldTitle
property string _fieldErrorMessage: parent.fieldErrorMessage
Expand All @@ -48,7 +49,8 @@ MMFormComboboxBaseEditor {
errorMsg: _fieldErrorMessage
warningMsg: _fieldWarningMessage

readOnly: _fieldIsReadOnly
readOnly: _fieldFormIsReadOnly || !_fieldIsEditable
shouldShowValidation: !_fieldFormIsReadOnly

hasCheckbox: _fieldRememberValueSupported
checkboxChecked: _fieldRememberValueState
Expand Down
3 changes: 2 additions & 1 deletion gallery/qml/components/EditorItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Item {
property string fieldValue: ""
property var fieldConfig: ({UseHtml: true})
property bool fieldShouldShowTitle: checkboxTitle.checked
property bool fieldIsReadOnly: !checkbox.checked
property bool fieldFormIsReadOnly: !checkbox.checked
property bool fieldIsEditable: checkboxEditable.checked
property string fieldErrorMessage: checkboxError.checked ? "error" : ""
property string fieldWarningMessage: checkboxWarning.checked ? "warning" : ""
property bool fieldRememberValueSupported: checkboxRemember.checked
Expand Down
6 changes: 6 additions & 0 deletions gallery/qml/pages/EditorsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ ScrollView {
checked: false
}

MMCheckBox {
id: checkboxEditable
text: checked ? "attribute editable: yes" : "attribute editable: no"
checked: true
}

GalleryComponents.EditorItem {
width: parent.width
height: relationEditor.height
Expand Down

1 comment on commit 49e8ecc

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 24.7.638611 just submitted!

Please sign in to comment.