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
This commit is contained in:
Pascal Precht 2021-08-31 13:53:43 +02:00 committed by Michał Cieślak
parent 1af17548ba
commit d2fd625ee5
1 changed files with 5 additions and 1 deletions

View File

@ -28,6 +28,10 @@ StatusModal {
signal resultItemClicked(string itemId) signal resultItemClicked(string itemId)
signal resultItemTitleClicked(string titleId) signal resultItemTitleClicked(string titleId)
property var formatTimestampFn: function (ts) {
return ts
}
function setSearchSelection(text = "", function setSearchSelection(text = "",
secondaryText = "", secondaryText = "",
imageSource = "", imageSource = "",
@ -291,7 +295,7 @@ StatusModal {
statusListItemSubTitle.color: Theme.palette.black statusListItemSubTitle.color: Theme.palette.black
icon.isLetterIdenticon: (model.image === "") icon.isLetterIdenticon: (model.image === "")
icon.background.color: model.color icon.background.color: model.color
titleAsideText: model.time titleAsideText: root.formatTimestampFn(model.time)
image.source: model.image image.source: model.image
badge.primaryText: model.badgePrimaryText badge.primaryText: model.badgePrimaryText
badge.secondaryText: model.badgeSecondaryText badge.secondaryText: model.badgeSecondaryText