fix(UserListPanel): Removed margin when the list positioned not at the end

Closes #7526
This commit is contained in:
Michał Cieślak 2022-09-26 10:54:14 +02:00 committed by Michał
parent c931f716e8
commit f48aee2e44

View File

@ -39,10 +39,7 @@ Item {
text: root.label text: root.label
} }
StatusListView { Item {
id: userListView
objectName: "userListPanel"
anchors { anchors {
top: titleText.bottom top: titleText.bottom
topMargin: Style.current.padding topMargin: Style.current.padding
@ -51,61 +48,74 @@ Item {
right: parent.right right: parent.right
rightMargin: Style.current.halfPadding rightMargin: Style.current.halfPadding
bottom: parent.bottom bottom: parent.bottom
bottomMargin: Style.current.bigPadding
} }
model: SortFilterProxyModel { clip: true
sourceModel: usersModule.model
sorters: [
RoleSorter {
roleName: "onlineStatus"
sortOrder: Qt.DescendingOrder
},
StringSorter {
roleName: "displayName"
caseSensitivity: Qt.CaseInsensitive
}
]
}
section.property: "onlineStatus"
section.delegate: (root.width > 58) ? sectionDelegateComponent : null
delegate: StatusMemberListItem {
width: ListView.view.width
nickName: model.localNickname
userName: !!model.ensName ? "@" + Utils.removeStatusEns(model.ensName) : model.displayName !== "" ? model.displayName : model.alias
pubKey: !!model.ensName ? "" : Utils.getCompressedPk(model.pubKey)
isContact: model.isContact
isVerified: model.isVerified
isUntrustworthy: model.isUntrustworthy
isAdmin: model.isAdmin
asset.name: {
const isCurrentUser = model.pubKey === root.rootStore.getPubkey()
const visibility = Global.privacyModuleInst.profilePicturesVisibility
if (isCurrentUser StatusListView {
|| visibility === Constants.profilePicturesVisibility.everyone id: userListView
|| (visibility === Constants.profilePicturesVisibility.contactsOnly && model.isContact)) objectName: "userListPanel"
return model.icon
return "" clip: false
anchors.fill: parent
anchors.bottomMargin: Style.current.bigPadding
displayMarginEnd: anchors.bottomMargin
model: SortFilterProxyModel {
sourceModel: usersModule.model
sorters: [
RoleSorter {
roleName: "onlineStatus"
sortOrder: Qt.DescendingOrder
},
StringSorter {
roleName: "displayName"
caseSensitivity: Qt.CaseInsensitive
}
]
} }
asset.isImage: (asset.name !== "") section.property: "onlineStatus"
asset.isLetterIdenticon: (asset.name === "") section.delegate: (root.width > 58) ? sectionDelegateComponent : null
asset.color: Utils.colorForColorId(model.colorId) delegate: StatusMemberListItem {
status: model.onlineStatus width: ListView.view.width
ringSettings.ringSpecModel: !!model.ensName ? undefined : Utils.getColorHashAsJson(model.pubKey, true) // FIXME: use model.colorHash nickName: model.localNickname
onClicked: { userName: !!model.ensName ? "@" + Utils.removeStatusEns(model.ensName) : model.displayName !== "" ? model.displayName : model.alias
if (mouse.button === Qt.RightButton) { pubKey: !!model.ensName ? "" : Utils.getCompressedPk(model.pubKey)
// Set parent, X & Y positions for the messageContextMenu isContact: model.isContact
messageContextMenu.parent = this isVerified: model.isVerified
messageContextMenu.isProfile = true isUntrustworthy: model.isUntrustworthy
messageContextMenu.myPublicKey = userProfile.pubKey isAdmin: model.isAdmin
messageContextMenu.selectedUserPublicKey = model.pubKey asset.name: {
messageContextMenu.selectedUserDisplayName = model.displayName const isCurrentUser = model.pubKey === root.rootStore.getPubkey()
messageContextMenu.selectedUserIcon = model.icon const visibility = Global.privacyModuleInst.profilePicturesVisibility
messageContextMenu.popup(4, 4)
} else if (mouse.button === Qt.LeftButton && !!messageContextMenu) { if (isCurrentUser
Global.openProfilePopup(model.pubKey); || visibility === Constants.profilePicturesVisibility.everyone
|| (visibility === Constants.profilePicturesVisibility.contactsOnly && model.isContact))
return model.icon
return ""
}
asset.isImage: (asset.name !== "")
asset.isLetterIdenticon: (asset.name === "")
asset.color: Utils.colorForColorId(model.colorId)
status: model.onlineStatus
ringSettings.ringSpecModel: !!model.ensName ? undefined : Utils.getColorHashAsJson(model.pubKey, true) // FIXME: use model.colorHash
onClicked: {
if (mouse.button === Qt.RightButton) {
// Set parent, X & Y positions for the messageContextMenu
messageContextMenu.parent = this
messageContextMenu.isProfile = true
messageContextMenu.myPublicKey = userProfile.pubKey
messageContextMenu.selectedUserPublicKey = model.pubKey
messageContextMenu.selectedUserDisplayName = model.displayName
messageContextMenu.selectedUserIcon = model.icon
messageContextMenu.popup(4, 4)
} else if (mouse.button === Qt.LeftButton && !!messageContextMenu) {
Global.openProfilePopup(model.pubKey);
}
} }
} }
} }