diff --git a/src/app/chat/views/user_list.nim b/src/app/chat/views/user_list.nim index d06cb4639f..501db110af 100644 --- a/src/app/chat/views/user_list.nim +++ b/src/app/chat/views/user_list.nim @@ -50,15 +50,15 @@ QtObject: if index.row < 0 or index.row >= self.users.len: return - let user = self.users[index.row] + let pubkey = self.users[index.row] case role.UserListRoles: - of UserListRoles.UserName: result = newQVariant(self.userDetails[user].userName) - of UserListRoles.LastSeen: result = newQVariant(self.userDetails[user].lastSeen) - of UserListRoles.Alias: result = newQVariant(self.userDetails[user].alias) - of UserListRoles.LocalName: result = newQVariant(self.userDetails[user].localName) - of UserListRoles.PublicKey: result = newQVariant(user) - of UserListRoles.Identicon: result = newQVariant(self.userdetails[user].identicon) + of UserListRoles.UserName: result = newQVariant(self.userDetails[pubkey].userName) + of UserListRoles.LastSeen: result = newQVariant(self.userDetails[pubkey].lastSeen) + of UserListRoles.Alias: result = newQVariant(self.userDetails[pubkey].alias) + of UserListRoles.LocalName: result = newQVariant(self.userDetails[pubkey].localName) + of UserListRoles.PublicKey: result = newQVariant(pubkey) + of UserListRoles.Identicon: result = newQVariant(self.userdetails[pubkey].identicon) method roleNames(self: UserListView): Table[int, string] = { diff --git a/src/status/provider.nim b/src/status/provider.nim index 0b92c99c1a..59f1abdaba 100644 --- a/src/status/provider.nim +++ b/src/status/provider.nim @@ -1,4 +1,4 @@ -import ens, wallet, permissions +import ens, wallet, permissions, utils import ../eventemitter import types import utils diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml index 03ac09c4a3..c11ad6a723 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml @@ -363,48 +363,8 @@ SplitView { } } - - Rectangle { + UserList { id: userList - visible: showUsers && chatsModel.channelView.activeChannel.chatType !== Constants.chatTypeOneToOne - - property int defaultWidth: 250 - - SplitView.preferredWidth: visible ? defaultWidth : 0 - SplitView.minimumWidth: 50 - - color: Style.current.secondaryMenuBackground - - anchors.top: parent.top - anchors.bottom: parent.bottom - - height: childrenRect.height - - ListView { - id: userListView - anchors.fill: parent - anchors.bottomMargin: Style.current.bigPadding - spacing: 0 - boundsBehavior: Flickable.StopAtBounds - model: userListDelegate - } - - DelegateModelGeneralized { - id: userListDelegate - lessThan: [ - function(left, right) { - return left.lastSeen > right.lastSeen - } - ] - model: messageList.userList - delegate: User { - publicKey: model.publicKey - name: model.userName - identicon: model.identicon - lastSeen: model.lastSeen - currentTime: svRoot.currentTime - } - } } } diff --git a/ui/app/AppLayouts/Chat/ChatColumn/UserList.qml b/ui/app/AppLayouts/Chat/ChatColumn/UserList.qml new file mode 100644 index 0000000000..b683b49e24 --- /dev/null +++ b/ui/app/AppLayouts/Chat/ChatColumn/UserList.qml @@ -0,0 +1,57 @@ +import QtQuick 2.13 +import Qt.labs.platform 1.1 +import QtQuick.Controls 2.13 +import QtQuick.Window 2.13 +import QtQuick.Layouts 1.13 +import QtQml.Models 2.13 +import QtGraphicalEffects 1.13 +import QtQuick.Dialogs 1.3 +import "../../../../shared" +import "../../../../shared/status" +import "../../../../imports" +import "../components" +import "./samples/" +import "./MessageComponents" +import "../ContactsColumn" + + +Rectangle { + id: userList + visible: showUsers && chatsModel.channelView.activeChannel.chatType !== Constants.chatTypeOneToOne + + property int defaultWidth: 250 + + SplitView.preferredWidth: visible ? defaultWidth : 0 + SplitView.minimumWidth: 50 + + color: Style.current.secondaryMenuBackground + + anchors.top: parent.top + anchors.bottom: parent.bottom + + ListView { + id: userListView + anchors.fill: parent + anchors.bottomMargin: Style.current.bigPadding + spacing: 0 + boundsBehavior: Flickable.StopAtBounds + model: userListDelegate + } + + DelegateModelGeneralized { + id: userListDelegate + lessThan: [ + function(left, right) { + return left.lastSeen > right.lastSeen + } + ] + model: messageList.userList + delegate: User { + publicKey: model.publicKey + name: model.userName + identicon: model.identicon + lastSeen: model.lastSeen + currentTime: svRoot.currentTime + } + } + } \ No newline at end of file