parent
d9acab566f
commit
2da05c0025
|
@ -8,6 +8,7 @@ type
|
|||
type
|
||||
Item* = object
|
||||
id: int64
|
||||
timestamp: string
|
||||
title: string
|
||||
durationInMs: int
|
||||
subTitle: string
|
||||
|
@ -28,6 +29,7 @@ proc initItem*(id: int64,
|
|||
details: NotificationDetails): Item =
|
||||
result = Item()
|
||||
result.id = id
|
||||
result.timestamp = $id
|
||||
result.durationInMs = durationInMs
|
||||
result.title = title
|
||||
result.subTitle = subTitle
|
||||
|
@ -40,6 +42,9 @@ proc initItem*(id: int64,
|
|||
proc id*(self: Item): int64 =
|
||||
self.id
|
||||
|
||||
proc timestamp*(self: Item): string =
|
||||
self.timestamp
|
||||
|
||||
proc title*(self: Item): string =
|
||||
self.title
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import ephemeral_notification_item
|
|||
type
|
||||
ModelRole {.pure.} = enum
|
||||
Id = UserRole + 1
|
||||
Timestamp
|
||||
DurationInMs
|
||||
Title
|
||||
SubTitle
|
||||
|
@ -33,6 +34,7 @@ QtObject:
|
|||
method roleNames(self: Model): Table[int, string] =
|
||||
{
|
||||
ModelRole.Id.int:"id",
|
||||
ModelRole.Timestamp.int:"timestamp",
|
||||
ModelRole.DurationInMs.int:"durationInMs",
|
||||
ModelRole.Title.int:"title",
|
||||
ModelRole.SubTitle.int:"subTitle",
|
||||
|
@ -53,6 +55,8 @@ QtObject:
|
|||
case enumRole:
|
||||
of ModelRole.Id:
|
||||
result = newQVariant(item.id)
|
||||
of ModelRole.Timestamp:
|
||||
result = newQVariant(item.timestamp)
|
||||
of ModelRole.DurationInMs:
|
||||
result = newQVariant(item.durationInMs)
|
||||
of ModelRole.Title:
|
||||
|
|
|
@ -1199,7 +1199,7 @@ Item {
|
|||
linkUrl: model.url
|
||||
duration: model.durationInMs
|
||||
onClicked: {
|
||||
appMain.rootStore.mainModuleInst.ephemeralNotificationClicked(model.id)
|
||||
appMain.rootStore.mainModuleInst.ephemeralNotificationClicked(model.timestamp)
|
||||
this.open = false
|
||||
}
|
||||
onLinkActivated: {
|
||||
|
@ -1207,7 +1207,7 @@ Item {
|
|||
}
|
||||
|
||||
onClose: {
|
||||
appMain.rootStore.mainModuleInst.removeEphemeralNotification(model.id)
|
||||
appMain.rootStore.mainModuleInst.removeEphemeralNotification(model.timestamp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue