fix: fix calling setActiveChannel from QML
This commit is contained in:
parent
da77487746
commit
c57356235b
|
@ -226,7 +226,7 @@ QtObject:
|
||||||
if not response.hasKey("error"):
|
if not response.hasKey("error"):
|
||||||
self.chats.clearUnreadMessagesCount(channel)
|
self.chats.clearUnreadMessagesCount(channel)
|
||||||
|
|
||||||
proc setActiveChannelByIndex*(self: ChatsView, index: int, forceUpdate: bool = false) {.slot.} =
|
proc setActiveChannelByIndexWithForce*(self: ChatsView, index: int, forceUpdate: bool) {.slot.} =
|
||||||
if((self.communities.activeCommunity.active and self.communities.activeCommunity.chats.chats.len == 0) or (not self.communities.activeCommunity.active and self.chats.chats.len == 0)): return
|
if((self.communities.activeCommunity.active and self.communities.activeCommunity.chats.chats.len == 0) or (not self.communities.activeCommunity.active and self.chats.chats.len == 0)): return
|
||||||
let selectedChannel =
|
let selectedChannel =
|
||||||
if (self.communities.activeCommunity.active):
|
if (self.communities.activeCommunity.active):
|
||||||
|
@ -250,6 +250,9 @@ QtObject:
|
||||||
self.activeChannel.setChatItem(selectedChannel)
|
self.activeChannel.setChatItem(selectedChannel)
|
||||||
self.status.chat.setActiveChannel(selectedChannel.id)
|
self.status.chat.setActiveChannel(selectedChannel.id)
|
||||||
|
|
||||||
|
proc setActiveChannelByIndex*(self: ChatsView, index: int) {.slot.} =
|
||||||
|
self.setActiveChannelByIndexWithForce(index, false)
|
||||||
|
|
||||||
proc getActiveChannelIdx(self: ChatsView): int {.slot.} =
|
proc getActiveChannelIdx(self: ChatsView): int {.slot.} =
|
||||||
if (self.communities.activeCommunity.active):
|
if (self.communities.activeCommunity.active):
|
||||||
return self.communities.activeCommunity.chats.chats.findIndexById(self.activeChannel.id)
|
return self.communities.activeCommunity.chats.chats.findIndexById(self.activeChannel.id)
|
||||||
|
@ -305,7 +308,7 @@ QtObject:
|
||||||
|
|
||||||
proc restorePreviousActiveChannel*(self: ChatsView) {.slot.} =
|
proc restorePreviousActiveChannel*(self: ChatsView) {.slot.} =
|
||||||
if self.previousActiveChannelIndex != -1:
|
if self.previousActiveChannelIndex != -1:
|
||||||
self.setActiveChannelByIndex(self.previousActiveChannelIndex, true)
|
self.setActiveChannelByIndexWithForce(self.previousActiveChannelIndex, true)
|
||||||
|
|
||||||
proc getCurrentSuggestions(self: ChatsView): QVariant {.slot.} =
|
proc getCurrentSuggestions(self: ChatsView): QVariant {.slot.} =
|
||||||
return newQVariant(self.currentSuggestions)
|
return newQVariant(self.currentSuggestions)
|
||||||
|
|
Loading…
Reference in New Issue