From d2fd625ee596faca255ad5ac5e186dbf625a3394 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Tue, 31 Aug 2021 13:53:43 +0200 Subject: [PATCH] feat(StatusSearchPopup): add function hook to allow timestamp formatting This introduces a new API to allow users to provide a function that formats timestamps in the search results. ```qml StatusSearchPopup { formatTimestampFn: function (ts) { return // formatted ts } } ``` Closes #363 --- ui/StatusQ/src/StatusQ/Popups/StatusSearchPopup.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/StatusQ/src/StatusQ/Popups/StatusSearchPopup.qml b/ui/StatusQ/src/StatusQ/Popups/StatusSearchPopup.qml index acf14f9644..c1a012f0ca 100644 --- a/ui/StatusQ/src/StatusQ/Popups/StatusSearchPopup.qml +++ b/ui/StatusQ/src/StatusQ/Popups/StatusSearchPopup.qml @@ -28,6 +28,10 @@ StatusModal { signal resultItemClicked(string itemId) signal resultItemTitleClicked(string titleId) + property var formatTimestampFn: function (ts) { + return ts + } + function setSearchSelection(text = "", secondaryText = "", imageSource = "", @@ -291,7 +295,7 @@ StatusModal { statusListItemSubTitle.color: Theme.palette.black icon.isLetterIdenticon: (model.image === "") icon.background.color: model.color - titleAsideText: model.time + titleAsideText: root.formatTimestampFn(model.time) image.source: model.image badge.primaryText: model.badgePrimaryText badge.secondaryText: model.badgeSecondaryText