2024-10-15 19:26:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2022-07-14 11:03:36 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-05-20 12:53:40 +00:00
|
|
|
import StatusQ.Components 0.1
|
2024-05-07 18:46:54 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2022-07-14 11:03:36 +00:00
|
|
|
|
2023-05-19 16:07:50 +00:00
|
|
|
import shared.views.chat 1.0
|
2022-02-23 17:08:01 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-07-21 09:03:51 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2021-07-22 14:53:19 +00:00
|
|
|
Item {
|
|
|
|
id: root
|
2021-11-30 14:49:45 +00:00
|
|
|
|
2022-11-16 09:41:32 +00:00
|
|
|
property var usersModel
|
2024-11-07 21:52:46 +00:00
|
|
|
|
2022-02-23 17:08:01 +00:00
|
|
|
property string label
|
2024-11-07 21:52:46 +00:00
|
|
|
property int chatType: Constants.chatType.unknown
|
|
|
|
property bool isAdmin
|
2024-05-07 18:46:54 +00:00
|
|
|
property int communityMemberReevaluationStatus: Constants.CommunityMemberReevaluationStatus.None
|
2021-07-06 17:58:19 +00:00
|
|
|
|
2024-11-07 21:52:46 +00:00
|
|
|
signal openProfileRequested(string pubKey)
|
|
|
|
signal createOneToOneChatRequested(string pubKey)
|
|
|
|
signal reviewContactRequestRequested(string pubKey)
|
|
|
|
signal sendContactRequestRequested(string pubKey)
|
|
|
|
signal editNicknameRequested(string pubKey)
|
|
|
|
signal removeNicknameRequested(string pubKey)
|
|
|
|
signal blockContactRequested(string pubKey)
|
|
|
|
signal unblockContactRequested(string pubKey)
|
2024-11-04 21:47:59 +00:00
|
|
|
signal markAsTrustedRequested(string pubKey)
|
2024-11-07 21:52:46 +00:00
|
|
|
signal markAsUntrustedRequested(string pubKey)
|
|
|
|
signal removeTrustStatusRequested(string pubKey)
|
2024-11-04 21:47:59 +00:00
|
|
|
signal removeTrustedMarkRequested(string pubKey)
|
2024-11-07 21:52:46 +00:00
|
|
|
signal removeContactRequested(string pubKey)
|
|
|
|
signal removeContactFromGroupRequested(string pubKey)
|
|
|
|
|
2022-02-23 17:08:01 +00:00
|
|
|
StatusBaseText {
|
2021-07-22 14:53:19 +00:00
|
|
|
id: titleText
|
2024-11-07 21:52:46 +00:00
|
|
|
|
2021-07-22 14:53:19 +00:00
|
|
|
anchors.top: parent.top
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.topMargin: Theme.padding
|
2021-07-22 14:53:19 +00:00
|
|
|
anchors.left: parent.left
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.leftMargin: Theme.padding
|
2024-11-07 21:52:46 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Theme.padding
|
|
|
|
|
2021-08-26 12:04:47 +00:00
|
|
|
opacity: (root.width > 58) ? 1.0 : 0.0
|
2021-07-22 14:53:19 +00:00
|
|
|
visible: (opacity > 0.1)
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
2022-02-23 17:08:01 +00:00
|
|
|
font.weight: Font.Medium
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
text: root.label
|
2024-11-07 21:52:46 +00:00
|
|
|
|
|
|
|
wrapMode: Text.Wrap
|
2021-07-22 14:53:19 +00:00
|
|
|
}
|
2021-07-06 22:41:26 +00:00
|
|
|
|
2024-05-07 18:46:54 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: communityMemberReevaluationInProgressText
|
|
|
|
visible: root.communityMemberReevaluationStatus === Constants.CommunityMemberReevaluationStatus.InProgress
|
2024-10-15 19:26:12 +00:00
|
|
|
height: visible ? implicitHeight : 0
|
2024-05-07 18:46:54 +00:00
|
|
|
anchors.top: titleText.bottom
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.topMargin: visible ? Theme.padding : 0
|
2024-05-07 18:46:54 +00:00
|
|
|
anchors.left: parent.left
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.leftMargin: Theme.padding
|
2024-05-07 18:46:54 +00:00
|
|
|
anchors.right: parent.right
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.rightMargin: Theme.padding
|
|
|
|
font.pixelSize: Theme.secondaryTextFontSize
|
2024-05-07 18:46:54 +00:00
|
|
|
color: Theme.palette.directColor1
|
|
|
|
text: qsTr("Member re-evaluation in progress...")
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
|
|
|
StatusToolTip {
|
|
|
|
text: qsTr("Saving community edits might take longer than usual")
|
|
|
|
visible: hoverHandler.hovered
|
|
|
|
}
|
|
|
|
HoverHandler {
|
|
|
|
id: hoverHandler
|
|
|
|
enabled: communityMemberReevaluationInProgressText.visible
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-26 08:54:14 +00:00
|
|
|
Item {
|
2021-07-22 14:53:19 +00:00
|
|
|
anchors {
|
2024-05-07 18:46:54 +00:00
|
|
|
top: communityMemberReevaluationInProgressText.bottom
|
2024-10-15 19:26:12 +00:00
|
|
|
topMargin: Theme.padding
|
2021-11-30 12:27:08 +00:00
|
|
|
left: parent.left
|
2024-10-15 19:26:12 +00:00
|
|
|
leftMargin: Theme.halfPadding
|
2021-07-22 14:53:19 +00:00
|
|
|
right: parent.right
|
2024-10-15 19:26:12 +00:00
|
|
|
rightMargin: Theme.halfPadding
|
2021-07-22 14:53:19 +00:00
|
|
|
bottom: parent.bottom
|
|
|
|
}
|
2022-07-14 11:03:36 +00:00
|
|
|
|
2022-09-26 08:54:14 +00:00
|
|
|
clip: true
|
|
|
|
|
|
|
|
StatusListView {
|
|
|
|
id: userListView
|
|
|
|
objectName: "userListPanel"
|
|
|
|
|
|
|
|
clip: false
|
|
|
|
|
|
|
|
anchors.fill: parent
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.bottomMargin: Theme.bigPadding
|
2022-09-26 08:54:14 +00:00
|
|
|
displayMarginEnd: anchors.bottomMargin
|
|
|
|
|
|
|
|
model: SortFilterProxyModel {
|
2022-11-16 09:41:32 +00:00
|
|
|
sourceModel: root.usersModel
|
2022-09-26 08:54:14 +00:00
|
|
|
|
|
|
|
sorters: [
|
|
|
|
RoleSorter {
|
|
|
|
roleName: "onlineStatus"
|
|
|
|
sortOrder: Qt.DescendingOrder
|
|
|
|
},
|
|
|
|
StringSorter {
|
2023-04-19 16:48:57 +00:00
|
|
|
roleName: "preferredDisplayName"
|
2022-09-26 08:54:14 +00:00
|
|
|
caseSensitivity: Qt.CaseInsensitive
|
|
|
|
}
|
|
|
|
]
|
2022-05-20 12:53:40 +00:00
|
|
|
}
|
2022-09-26 08:54:14 +00:00
|
|
|
section.property: "onlineStatus"
|
|
|
|
section.delegate: (root.width > 58) ? sectionDelegateComponent : null
|
|
|
|
delegate: StatusMemberListItem {
|
|
|
|
width: ListView.view.width
|
2024-11-07 21:52:46 +00:00
|
|
|
|
2022-09-26 08:54:14 +00:00
|
|
|
nickName: model.localNickname
|
2022-12-05 09:56:44 +00:00
|
|
|
userName: ProfileUtils.displayName("", model.ensName, model.displayName, model.alias)
|
2024-10-29 12:54:11 +00:00
|
|
|
pubKey: model.isEnsVerified ? "" : model.compressedPubKey
|
2022-09-26 08:54:14 +00:00
|
|
|
isContact: model.isContact
|
|
|
|
isVerified: model.isVerified
|
|
|
|
isUntrustworthy: model.isUntrustworthy
|
2023-06-14 16:00:41 +00:00
|
|
|
isAdmin: model.memberRole === Constants.memberRole.owner
|
2024-09-06 13:11:47 +00:00
|
|
|
icon.name: model.icon
|
|
|
|
icon.color: Utils.colorForColorId(model.colorId)
|
2022-09-26 08:54:14 +00:00
|
|
|
status: model.onlineStatus
|
2023-01-10 11:29:24 +00:00
|
|
|
ringSettings.ringSpecModel: model.colorHash
|
2024-11-07 14:29:28 +00:00
|
|
|
|
2022-09-26 08:54:14 +00:00
|
|
|
onClicked: {
|
|
|
|
if (mouse.button === Qt.RightButton) {
|
2024-11-07 14:29:28 +00:00
|
|
|
const profileType = Utils.getProfileType(model.isCurrentUser, false, model.isBlocked)
|
|
|
|
const contactType = Utils.getContactType(model.contactRequest, model.isContact)
|
|
|
|
|
|
|
|
const params = {
|
|
|
|
profileType, contactType, chatType, isAdmin,
|
|
|
|
pubKey: model.pubKey,
|
|
|
|
compressedPubKey: model.compressedPubKey,
|
|
|
|
emojiHash: model.emojiHash,
|
|
|
|
colorHash: model.colorHash,
|
|
|
|
colorId: model.colorId,
|
|
|
|
displayName: nickName || userName,
|
|
|
|
userIcon: model.icon,
|
|
|
|
trustStatus: model.trustStatus,
|
|
|
|
onlineStatus: model.onlineStatus,
|
|
|
|
ensVerified: model.isEnsVerified,
|
2024-11-07 21:52:46 +00:00
|
|
|
hasLocalNickname: !!model.localNickname,
|
|
|
|
chatType: root.chatType,
|
|
|
|
isAdmin: root.isAdmin
|
2024-11-07 14:29:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Global.openMenu(profileContextMenuComponent, this, params)
|
2023-05-19 16:07:50 +00:00
|
|
|
} else if (mouse.button === Qt.LeftButton) {
|
2024-09-06 13:11:47 +00:00
|
|
|
Global.openProfilePopup(model.pubKey)
|
2022-09-26 08:54:14 +00:00
|
|
|
}
|
2022-05-20 12:53:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-02-23 17:08:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: sectionDelegateComponent
|
2024-11-07 21:52:46 +00:00
|
|
|
|
2022-02-23 17:08:01 +00:00
|
|
|
Item {
|
2023-02-28 14:54:10 +00:00
|
|
|
width: ListView.view.width
|
2022-02-23 17:08:01 +00:00
|
|
|
height: 24
|
2024-11-07 21:52:46 +00:00
|
|
|
|
2023-02-28 14:54:10 +00:00
|
|
|
StatusBaseText {
|
2022-02-23 17:08:01 +00:00
|
|
|
anchors.fill: parent
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.leftMargin: Theme.padding
|
2022-02-23 17:08:01 +00:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.additionalTextSize
|
2022-02-23 17:08:01 +00:00
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
text: {
|
|
|
|
switch(parseInt(section)) {
|
2022-06-10 09:01:31 +00:00
|
|
|
case Constants.onlineStatus.online:
|
|
|
|
return qsTr("Online")
|
|
|
|
default:
|
2022-09-12 16:00:30 +00:00
|
|
|
return qsTr("Inactive")
|
2022-02-23 17:08:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-06 22:41:26 +00:00
|
|
|
}
|
2023-05-19 16:07:50 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: profileContextMenuComponent
|
|
|
|
|
|
|
|
ProfileContextMenu {
|
2024-09-06 15:55:44 +00:00
|
|
|
id: profileContextMenu
|
2024-11-07 10:43:06 +00:00
|
|
|
|
|
|
|
property string pubKey
|
|
|
|
|
2023-05-19 16:07:50 +00:00
|
|
|
margins: 8
|
2024-11-07 21:52:46 +00:00
|
|
|
|
|
|
|
onOpenProfileClicked: root.openProfileRequested(pubKey)
|
|
|
|
onCreateOneToOneChat: root.createOneToOneChatRequested(pubKey)
|
|
|
|
onReviewContactRequest: root.reviewContactRequestRequested(pubKey)
|
|
|
|
onSendContactRequest: root.sendContactRequestRequested(pubKey)
|
|
|
|
onEditNickname: root.editNicknameRequested(pubKey)
|
|
|
|
onRemoveNickname: root.removeNicknameRequested(pubKey)
|
|
|
|
onUnblockContact: root.unblockContactRequested(pubKey)
|
|
|
|
onMarkAsUntrusted: root.markAsUntrustedRequested(pubKey)
|
|
|
|
onRemoveTrustStatus: root.removeTrustStatusRequested(pubKey)
|
|
|
|
onRemoveContact: root.removeContactRequested(pubKey)
|
|
|
|
onBlockContact: root.blockContactRequested(pubKey)
|
|
|
|
onRemoveFromGroup: root.removeContactFromGroupRequested(pubKey)
|
2024-11-04 21:47:59 +00:00
|
|
|
onMarkAsTrusted: root.markAsTrustedRequested(pubKey)
|
|
|
|
onRemoveTrustedMark: root.removeTrustedMarkRequested(pubKey)
|
2024-11-07 21:52:46 +00:00
|
|
|
|
2024-10-02 12:54:11 +00:00
|
|
|
onClosed: destroy()
|
2023-05-19 16:07:50 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-22 14:53:19 +00:00
|
|
|
}
|