Skip to content

Feature/clear button for calendar drawers#4572

Open
xkello wants to merge 4 commits into
masterfrom
feature/clear-button-for-calendar-drawers
Open

Feature/clear button for calendar drawers#4572
xkello wants to merge 4 commits into
masterfrom
feature/clear-button-for-calendar-drawers

Conversation

@xkello

@xkello xkello commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Problem

  1. There was no way to remove value/set it as null for date field in calendar drawers. Users had to reopen the drawer by creating exactly the same point on the map for example.

  2. Clearing the date field is causing runtime error.


Solution

  1. Added a clear button in the drawer in header space.

  2. Added guards which check for undefined and null _fieldValue before assigning dateTime in calendar drawer.


Behavior

  • When user opens calendar drawer, there is a Clear button in the top left corner, which both closes the calendar drawer and resets the value of date field when used.
  • When calendar date value is empty, the clear button is not vissible.

Images for part 1

  • Tall and wide screen behavior with filled date field:
image
  • Screen behavior when date field is empty:
image

Video for part 1

Screencast.From.2026-06-30.17-43-27.webm

@xkello
xkello requested a review from tomasMizera June 30, 2026 15:45
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29329505714

Coverage decreased (-0.1%) to 58.992%

Details

  • Coverage decreased (-0.1%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 22 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

22 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
mm/core/merginapi.cpp 13 74.79%
mm/core/merginuserauth.cpp 9 67.86%

Coverage Stats

Coverage Status
Relevant Lines: 15636
Covered Lines: 9224
Line Coverage: 58.99%
Coverage Strength: 97.73 hits per line

💛 - Coveralls

@github-actions

Copy link
Copy Markdown

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 70021 dmg Expires: 28/09/2026 #7002
linux Build 📬 Mergin Maps 70281 x86_64 Expires: 28/09/2026 #7028
win64 Build 📬 Mergin Maps 62001 win64 Expires: 28/09/2026 #6200
Android Build 📬 Mergin Maps 831251 APK [arm64-v8a] Expires: 28/09/2026 #8312
📬 Mergin Maps 831251 APK [arm64-v8a] Google Play Store #8312
Android Build 📬 Mergin Maps 831211 APK [armeabi-v7a] Expires: 28/09/2026 #8312
📬 Mergin Maps 831211 APK [armeabi-v7a] Google Play Store #8312
iOS Build 📬 Build number: 26.06.925411 #9254

@Withalion Withalion linked an issue Jul 1, 2026 that may be closed by this pull request

@Withalion Withalion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Welcome to the jungle!

Comment thread app/qml/form/components/MMCalendarDrawer.qml Outdated
Comment thread app/qml/form/components/MMCalendarDrawer.qml
Comment thread app/qml/form/components/MMCalendarDrawer.qml Outdated
Comment thread app/qml/form/components/MMCalendarDrawer.qml
Comment thread app/qml/form/editors/MMFormCalendarEditor.qml Outdated
Comment thread app/qml/form/editors/MMFormCalendarEditor.qml Outdated
@Withalion

Copy link
Copy Markdown
Collaborator

Also the the clear text is not horizontally aligned with the rest of header and the text color is wrong

@xkello
xkello requested a review from Withalion July 14, 2026 11:37
@github-actions

Copy link
Copy Markdown

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 70231 dmg Expires: 12/10/2026 #7023
linux Build 📬 Mergin Maps 70491 x86_64 Expires: 12/10/2026 #7049
win64 Build 📬 Mergin Maps 62251 win64 Expires: 12/10/2026 #6225
Android Build 📬 Mergin Maps 833351 APK [arm64-v8a] Expires: 12/10/2026 #8333
📬 Mergin Maps 833351 APK [arm64-v8a] Google Play Store #8333
Android Build 📬 Mergin Maps 833311 APK [armeabi-v7a] Expires: 12/10/2026 #8333
📬 Mergin Maps 833311 APK [armeabi-v7a] Google Play Store #8333
iOS Build 📬 Build number: 26.07.927511 #9275

@Withalion Withalion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The clear button doesn't work for calendar drawers in filters, but that might be intentional.

Please also rebase on current master

function hasValidFieldValue() {
return root._fieldValueIsNull
|| root._fieldHasMixedValues
|| (root._fieldValue ?? null) === null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
|| (root._fieldValue ?? null) === null
|| root._fieldValue ?? true

this should be the same

}
}

function hasValidFieldValue() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would make more sense to call it invalid values

}

onClearButtonClicked: {
root.editorValueChanged( undefined, true )

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is there a reason we can't use null? If not then let's prefer using null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can you as well purge the openCalendar() method only keep forceActiveFocus() and then from openPicker() take the contents and put everything in openCalendar(). Remove openPicker()

dim: true

drawerHeader.title: root.title
drawerHeader.topLeftItem.visible: !root.showClearButton

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the logic of visibility is opposite to the naming of the variable, it should match

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add clear button for date and date-time form editor drawer

2 participants