From b45aba4be88fbdd4adf901b90dbe07c93c98aaea 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 --- src/StatusQ/Popups/StatusSearchPopup.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/StatusQ/Popups/StatusSearchPopup.qml b/src/StatusQ/Popups/StatusSearchPopup.qml index acf14f96..c1a012f0 100644 --- a/src/StatusQ/Popups/StatusSearchPopup.qml +++ b/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