fix: show a channel by default if there is at least one

This commit is contained in:
Jonathan Rainville 2020-07-09 15:50:54 -04:00 committed by Iuri Matias
parent 1b3314ea9a
commit 29b2bbf13e
2 changed files with 4 additions and 1 deletions

View File

@ -128,6 +128,9 @@ QtObject:
proc upsertChannel(self: ChatsView, channel: string) =
if not self.messageList.hasKey(channel):
self.messageList[channel] = newChatMessageList(channel, self.status)
# If there is only one channel, set is as active
if (self.activeChannel.chatItem == nil and self.chats.rowCount() == 1):
self.setActiveChannelByIndex(0)
proc messagePushed*(self: ChatsView) {.signal.}

View File

@ -38,7 +38,7 @@ QtObject:
return ens.userNameOrAlias(self.status.chat.contacts[pubKey])
generateAlias(pubKey)
method rowCount(self: ChannelsList, index: QModelIndex = nil): int = self.chats.len
method rowCount*(self: ChannelsList, index: QModelIndex = nil): int = self.chats.len
proc renderBlock(self: ChannelsList, message: Message): string