refactor: add fake category type
This commit is contained in:
parent
0065f5cae5
commit
24fa56e3b8
|
@ -18,6 +18,7 @@ type
|
|||
Active
|
||||
Position
|
||||
SubItems
|
||||
IsCategory
|
||||
|
||||
QtObject:
|
||||
type
|
||||
|
@ -77,6 +78,7 @@ QtObject:
|
|||
ModelRole.Active.int:"active",
|
||||
ModelRole.Position.int:"position",
|
||||
ModelRole.SubItems.int:"subItems",
|
||||
ModelRole.IsCategory.int:"isCategory"
|
||||
}.toTable
|
||||
|
||||
method data(self: Model, index: QModelIndex, role: int): QVariant =
|
||||
|
@ -118,6 +120,8 @@ QtObject:
|
|||
result = newQVariant(item.position)
|
||||
of ModelRole.SubItems:
|
||||
result = newQVariant(item.subItems)
|
||||
of ModelRole.IsCategory:
|
||||
result = newQVariant(item.`type` == ChatType.Category.int)
|
||||
|
||||
proc appendItem*(self: Model, item: Item) =
|
||||
let parentModelIndex = newQModelIndex()
|
||||
|
|
|
@ -186,7 +186,7 @@ proc buildCommunityUI(self: Module, events: EventEmitter,
|
|||
selectedItemId = cat.id
|
||||
selectedSubItemId = channelItem.id
|
||||
|
||||
var categoryItem = initItem(cat.id, cat.name, "", false, "", "", ChatType.Unknown.int, false,
|
||||
var categoryItem = initItem(cat.id, cat.name, "", false, "", "", ChatType.Category.int, false,
|
||||
hasNotificationPerCategory, notificationsCountPerCategory, false, false, cat.position)
|
||||
categoryItem.prependSubItems(categoryChannels)
|
||||
self.view.chatsModel().appendItem(categoryItem)
|
||||
|
|
|
@ -12,6 +12,7 @@ type ChatType* {.pure.}= enum
|
|||
Profile = 4,
|
||||
Timeline = 5
|
||||
CommunityChat = 6
|
||||
Category = 9999
|
||||
|
||||
type ChatMember* = object
|
||||
id*: string
|
||||
|
|
|
@ -53,6 +53,7 @@ QtObject {
|
|||
readonly property int profile: 4
|
||||
readonly property int timeline: 5
|
||||
readonly property int communityChat: 6
|
||||
readonly property int category: 9999
|
||||
}
|
||||
|
||||
readonly property QtObject messageContentType: QtObject {
|
||||
|
|
Loading…
Reference in New Issue