From 95a76299c6f92de7cd512f90a5d6f59f44256138 Mon Sep 17 00:00:00 2001 From: Richard Kello Date: Fri, 28 Aug 2026 12:29:43 +0200 Subject: [PATCH 1/2] Add check so unlink button won't show on a new feature --- app/attributes/attributecontroller.h | 3 +++ app/qml/dialogs/MMRemovePhotoDialog.qml | 3 +++ app/qml/form/editors/MMFormPhotoEditor.qml | 1 + 3 files changed, 7 insertions(+) diff --git a/app/attributes/attributecontroller.h b/app/attributes/attributecontroller.h index 9915b3e46..59535feb5 100644 --- a/app/attributes/attributecontroller.h +++ b/app/attributes/attributecontroller.h @@ -60,6 +60,9 @@ class AttributeController : public QObject */ Q_PROPERTY( FeatureLayerPair featureLayerPair READ featureLayerPair WRITE setFeatureLayerPair NOTIFY featureLayerPairChanged ) + //! Returns TRUE if the feature has not been saved yet (has a new/null feature id) + Q_PROPERTY( bool isNewFeature READ isNewFeature NOTIFY featureLayerPairChanged ) + // this is never nullptr (a form with no tabs will be parsed as having a single tab) Q_PROPERTY( AttributeTabProxyModel *attributeTabProxyModel READ attributeTabProxyModel NOTIFY attributeTabProxyModelChanged ) diff --git a/app/qml/dialogs/MMRemovePhotoDialog.qml b/app/qml/dialogs/MMRemovePhotoDialog.qml index 20885cbdd..e8f9e57ff 100644 --- a/app/qml/dialogs/MMRemovePhotoDialog.qml +++ b/app/qml/dialogs/MMRemovePhotoDialog.qml @@ -18,6 +18,7 @@ MMDrawerDialog { signal unlinkImage() property string imagePath + property string featureState: "" imageSource: __style.negativeMMSymbolImage title: qsTr( "Delete photo?" ) @@ -35,6 +36,8 @@ MMDrawerDialog { secondaryButton { text: qsTr( "Unlink photo" ) + visible: root.featureState !== "add" + fontColor: __style.grapeColor fontColorHover: __style.negativeColor } diff --git a/app/qml/form/editors/MMFormPhotoEditor.qml b/app/qml/form/editors/MMFormPhotoEditor.qml index 621559d4e..d2dc9fc80 100644 --- a/app/qml/form/editors/MMFormPhotoEditor.qml +++ b/app/qml/form/editors/MMFormPhotoEditor.qml @@ -129,6 +129,7 @@ MMFormPhotoViewer { id: imageDeleteDialog property string imagePath + featureState: root._fieldController.isNewFeature ? "add" : "" onDeleteImage: { // schedule the image for deletion From 63753deaff2769be7453f55e6c912e0f60cad440 Mon Sep 17 00:00:00 2001 From: Richard Kello Date: Fri, 4 Sep 2026 16:12:21 +0200 Subject: [PATCH 2/2] Update code --- app/qml/dialogs/MMRemovePhotoDialog.qml | 6 +++--- app/qml/form/editors/MMFormPhotoEditor.qml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/qml/dialogs/MMRemovePhotoDialog.qml b/app/qml/dialogs/MMRemovePhotoDialog.qml index e8f9e57ff..f0d321d79 100644 --- a/app/qml/dialogs/MMRemovePhotoDialog.qml +++ b/app/qml/dialogs/MMRemovePhotoDialog.qml @@ -18,11 +18,11 @@ MMDrawerDialog { signal unlinkImage() property string imagePath - property string featureState: "" + property bool offerUnlinkOption: true imageSource: __style.negativeMMSymbolImage title: qsTr( "Delete photo?" ) - description: qsTr( "Would you like to delete or unlink the photo? Deleting removes the photo from your project entirely, while unlinking keeps the photo in your project but removes it from this specific feature." ) + description: root.offerUnlinkOption ? qsTr( "Would you like to delete or unlink the photo? Deleting removes the photo from your project entirely, while unlinking keeps the photo in your project but removes it from this specific feature." ) : qsTr( "Would you like to delete the photo?" ) primaryButton { text: qsTr( "Delete photo" ) @@ -36,7 +36,7 @@ MMDrawerDialog { secondaryButton { text: qsTr( "Unlink photo" ) - visible: root.featureState !== "add" + visible: root.offerUnlinkOption fontColor: __style.grapeColor fontColorHover: __style.negativeColor diff --git a/app/qml/form/editors/MMFormPhotoEditor.qml b/app/qml/form/editors/MMFormPhotoEditor.qml index d2dc9fc80..71dc72730 100644 --- a/app/qml/form/editors/MMFormPhotoEditor.qml +++ b/app/qml/form/editors/MMFormPhotoEditor.qml @@ -129,7 +129,7 @@ MMFormPhotoViewer { id: imageDeleteDialog property string imagePath - featureState: root._fieldController.isNewFeature ? "add" : "" + offerUnlinkOption: !root._fieldController.isNewFeature onDeleteImage: { // schedule the image for deletion