Skip to content

Commit

Permalink
Merge pull request #3459 from MerginMaps/photo-editor-fixes
Browse files Browse the repository at this point in the history
Photo editor fixes
  • Loading branch information
tomasMizera authored May 27, 2024
2 parents 739bb48 + 117db08 commit 1c82014
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
4 changes: 4 additions & 0 deletions app/qml/form/components/photo/MMPhotoAttachment.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideMiddle

visible: root.enabled
}
}

Expand Down Expand Up @@ -95,6 +97,8 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideMiddle

visible: root.enabled
}
}

Expand Down
23 changes: 11 additions & 12 deletions app/qml/form/editors/MMFormPhotoEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ MMFormPhotoViewer {
photoUrl: internal.absoluteImagePath
hasCameraCapability: __androidUtils.isAndroid || __iosUtils.isIos

on_FieldValueChanged: internal.calculateAbsoluteImagePath()
on_FieldValueChanged: internal.setAbsoluteImagePath()
on_FieldValueIsNullChanged: internal.setAbsoluteImagePath()

onCapturePhotoClicked: internal.capturePhoto()
onChooseFromGalleryClicked: internal.chooseFromGallery()
Expand Down Expand Up @@ -200,27 +201,25 @@ MMFormPhotoViewer {

property string imageSourceToDelete // used to postpone image deletion to when the form is saved

function calculateAbsoluteImagePath() {
//
// Sets path of the assigned photo to the absoluteImagePath.
// - absoluteImagePath is the actual path on the device and is used by QML Image to show the image
//
function setAbsoluteImagePath() {
let absolutePath = __inputUtils.getAbsolutePath( root._fieldValue, internal.prefixToRelativePath )

if ( root.photoComponent.status === Image.Error ) {
root.photoState = "notAvailable"
if ( !root._fieldValue || root._fieldValueIsNull ) {
root.photoState = "notSet"
absoluteImagePath = ""
return
}
else if ( root._fieldValue && __inputUtils.fileExists( absolutePath ) ) {
root.photoState = "valid"
absoluteImagePath = "file://" + absolutePath
return
}
else if ( !root._fieldValue || root._fieldValueIsNullfield ) {
root.photoState = "notSet"
else {
root.photoState = "notAvailable"
absoluteImagePath = ""
return
}

root.photoState = "notAvailable"
absoluteImagePath = "file://" + absolutePath
}

/**
Expand Down

1 comment on commit 1c82014

@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.5.624611 just submitted!

Please sign in to comment.