2024-10-15 21:26:12 +02:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2022-07-14 14:03:36 +03:00
|
|
|
|
2024-03-14 15:23:58 +00:00
|
|
|
import StatusQ 0.1
|
2022-07-14 14:03:36 +03:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-05-20 15:53:40 +03:00
|
|
|
import StatusQ.Components 0.1
|
2024-05-07 14:46:54 -04:00
|
|
|
import StatusQ.Controls 0.1
|
2022-07-14 14:03:36 +03:00
|
|
|
|
2021-10-28 00:27:49 +03:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.status 1.0
|
2023-05-19 19:07:50 +03:00
|
|
|
import shared.views.chat 1.0
|
2024-10-22 14:39:42 +02:00
|
|
|
|
2022-02-23 12:08:01 -05:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-07-21 11:03:51 +02:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2024-05-22 11:13:39 +03:00
|
|
|
import AppLayouts.Chat.stores 1.0 as ChatStores
|
|
|
|
|
2021-07-22 17:53:19 +03:00
|
|
|
Item {
|
|
|
|
id: root
|
2021-11-30 15:49:45 +01:00
|
|
|
|
2024-05-22 11:13:39 +03:00
|
|
|
property ChatStores.RootStore store
|
2024-10-22 14:39:42 +02:00
|
|
|
|
2022-11-16 10:41:32 +01:00
|
|
|
property var usersModel
|
2022-02-23 12:08:01 -05:00
|
|
|
property string label
|
2024-05-07 14:46:54 -04:00
|
|
|
property int communityMemberReevaluationStatus: Constants.CommunityMemberReevaluationStatus.None
|
2021-07-06 13:58:19 -04:00
|
|
|
|
2022-02-23 12:08:01 -05:00
|
|
|
StatusBaseText {
|
2021-07-22 17:53:19 +03:00
|
|
|
id: titleText
|
|
|
|
anchors.top: parent.top
|
2024-10-15 21:26:12 +02:00
|
|
|
anchors.topMargin: Theme.padding
|
2021-07-22 17:53:19 +03:00
|
|
|
anchors.left: parent.left
|
2024-10-15 21:26:12 +02:00
|
|
|
anchors.leftMargin: Theme.padding
|
2021-08-26 15:04:47 +03:00
|
|
|
opacity: (root.width > 58) ? 1.0 : 0.0
|
2021-07-22 17:53:19 +03:00
|
|
|
visible: (opacity > 0.1)
|
2024-10-15 21:26:12 +02:00
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
2022-02-23 12:08:01 -05:00
|
|
|
font.weight: Font.Medium
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
text: root.label
|
2021-07-22 17:53:19 +03:00
|
|
|
}
|
2021-07-06 18:41:26 -04:00
|
|
|
|
2024-05-07 14:46:54 -04:00
|
|
|
StatusBaseText {
|
|
|
|
id: communityMemberReevaluationInProgressText
|
|
|
|
visible: root.communityMemberReevaluationStatus === Constants.CommunityMemberReevaluationStatus.InProgress
|
2024-10-15 21:26:12 +02:00
|
|
|
height: visible ? implicitHeight : 0
|
2024-05-07 14:46:54 -04:00
|
|
|
anchors.top: titleText.bottom
|
2024-10-15 21:26:12 +02:00
|
|
|
anchors.topMargin: visible ? Theme.padding : 0
|
2024-05-07 14:46:54 -04:00
|
|
|
anchors.left: parent.left
|
2024-10-15 21:26:12 +02:00
|
|
|
anchors.leftMargin: Theme.padding
|
2024-05-07 14:46:54 -04:00
|
|
|
anchors.right: parent.right
|
2024-10-15 21:26:12 +02:00
|
|
|
anchors.rightMargin: Theme.padding
|
|
|
|
font.pixelSize: Theme.secondaryTextFontSize
|
2024-05-07 14:46:54 -04: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 10:54:14 +02:00
|
|
|
Item {
|
2021-07-22 17:53:19 +03:00
|
|
|
anchors {
|
2024-05-07 14:46:54 -04:00
|
|
|
top: communityMemberReevaluationInProgressText.bottom
|
2024-10-15 21:26:12 +02:00
|
|
|
topMargin: Theme.padding
|
2021-11-30 13:27:08 +01:00
|
|
|
left: parent.left
|
2024-10-15 21:26:12 +02:00
|
|
|
leftMargin: Theme.halfPadding
|
2021-07-22 17:53:19 +03:00
|
|
|
right: parent.right
|
2024-10-15 21:26:12 +02:00
|
|
|
rightMargin: Theme.halfPadding
|
2021-07-22 17:53:19 +03:00
|
|
|
bottom: parent.bottom
|
|
|
|
}
|
2022-07-14 14:03:36 +03:00
|
|
|
|
2022-09-26 10:54:14 +02:00
|
|
|
clip: true
|
|
|
|
|
|
|
|
StatusListView {
|
|
|
|
id: userListView
|
|
|
|
objectName: "userListPanel"
|
|
|
|
|
|
|
|
clip: false
|
|
|
|
|
|
|
|
anchors.fill: parent
|
2024-10-15 21:26:12 +02:00
|
|
|
anchors.bottomMargin: Theme.bigPadding
|
2022-09-26 10:54:14 +02:00
|
|
|
displayMarginEnd: anchors.bottomMargin
|
|
|
|
|
|
|
|
model: SortFilterProxyModel {
|
2022-11-16 10:41:32 +01:00
|
|
|
sourceModel: root.usersModel
|
2022-09-26 10:54:14 +02:00
|
|
|
|
|
|
|
sorters: [
|
|
|
|
RoleSorter {
|
|
|
|
roleName: "onlineStatus"
|
|
|
|
sortOrder: Qt.DescendingOrder
|
|
|
|
},
|
|
|
|
StringSorter {
|
2023-04-19 18:48:57 +02:00
|
|
|
roleName: "preferredDisplayName"
|
2022-09-26 10:54:14 +02:00
|
|
|
caseSensitivity: Qt.CaseInsensitive
|
|
|
|
}
|
|
|
|
]
|
2022-05-20 15:53:40 +03:00
|
|
|
}
|
2022-09-26 10:54:14 +02:00
|
|
|
section.property: "onlineStatus"
|
|
|
|
section.delegate: (root.width > 58) ? sectionDelegateComponent : null
|
|
|
|
delegate: StatusMemberListItem {
|
|
|
|
width: ListView.view.width
|
|
|
|
nickName: model.localNickname
|
2022-12-05 10:56:44 +01:00
|
|
|
userName: ProfileUtils.displayName("", model.ensName, model.displayName, model.alias)
|
2024-10-29 13:54:11 +01:00
|
|
|
pubKey: model.isEnsVerified ? "" : model.compressedPubKey
|
2022-09-26 10:54:14 +02:00
|
|
|
isContact: model.isContact
|
|
|
|
isVerified: model.isVerified
|
|
|
|
isUntrustworthy: model.isUntrustworthy
|
2023-06-14 18:00:41 +02:00
|
|
|
isAdmin: model.memberRole === Constants.memberRole.owner
|
2024-09-06 15:11:47 +02:00
|
|
|
icon.name: model.icon
|
|
|
|
icon.color: Utils.colorForColorId(model.colorId)
|
2022-09-26 10:54:14 +02:00
|
|
|
status: model.onlineStatus
|
2023-01-10 13:29:24 +02:00
|
|
|
ringSettings.ringSpecModel: model.colorHash
|
2022-09-26 10:54:14 +02:00
|
|
|
onClicked: {
|
|
|
|
if (mouse.button === Qt.RightButton) {
|
2024-10-15 11:58:09 +02:00
|
|
|
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.store.contactsStore.getProfileContext(model.pubKey)
|
2024-09-06 11:55:44 -04:00
|
|
|
const chatType = chatContentModule.chatDetails.type
|
|
|
|
const isAdmin = chatContentModule.amIChatAdmin()
|
2024-09-06 11:55:44 -04:00
|
|
|
|
2023-05-19 19:07:50 +03:00
|
|
|
Global.openMenu(profileContextMenuComponent, this, {
|
2024-09-06 11:55:44 -04:00
|
|
|
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname, chatType, isAdmin,
|
2024-09-06 11:55:44 -04:00
|
|
|
publicKey: model.pubKey,
|
2024-10-28 15:24:53 +01:00
|
|
|
emojiHash: model.emojiHash,
|
2024-09-06 11:55:44 -04:00
|
|
|
displayName: nickName || userName,
|
2024-10-28 15:24:53 +01:00
|
|
|
userIcon: model.icon
|
2023-05-19 19:07:50 +03:00
|
|
|
})
|
|
|
|
} else if (mouse.button === Qt.LeftButton) {
|
2024-09-06 15:11:47 +02:00
|
|
|
Global.openProfilePopup(model.pubKey)
|
2022-09-26 10:54:14 +02:00
|
|
|
}
|
2022-05-20 15:53:40 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-02-23 12:08:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: sectionDelegateComponent
|
|
|
|
Item {
|
2023-02-28 15:54:10 +01:00
|
|
|
width: ListView.view.width
|
2022-02-23 12:08:01 -05:00
|
|
|
height: 24
|
2023-02-28 15:54:10 +01:00
|
|
|
StatusBaseText {
|
2022-02-23 12:08:01 -05:00
|
|
|
anchors.fill: parent
|
2024-10-15 21:26:12 +02:00
|
|
|
anchors.leftMargin: Theme.padding
|
2022-02-23 12:08:01 -05:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2024-10-15 21:26:12 +02:00
|
|
|
font.pixelSize: Theme.additionalTextSize
|
2022-02-23 12:08:01 -05:00
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
text: {
|
|
|
|
switch(parseInt(section)) {
|
2022-06-10 11:01:31 +02:00
|
|
|
case Constants.onlineStatus.online:
|
|
|
|
return qsTr("Online")
|
|
|
|
default:
|
2022-09-12 18:00:30 +02:00
|
|
|
return qsTr("Inactive")
|
2022-02-23 12:08:01 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-06 18:41:26 -04:00
|
|
|
}
|
2023-05-19 19:07:50 +03:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: profileContextMenuComponent
|
|
|
|
|
|
|
|
ProfileContextMenu {
|
2024-09-06 11:55:44 -04:00
|
|
|
id: profileContextMenu
|
2023-05-19 19:07:50 +03:00
|
|
|
margins: 8
|
2024-09-06 11:55:44 -04:00
|
|
|
onOpenProfileClicked: Global.openProfilePopup(profileContextMenu.publicKey, null)
|
2023-05-19 19:07:50 +03:00
|
|
|
onCreateOneToOneChat: {
|
|
|
|
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
2024-09-06 11:55:44 -04:00
|
|
|
root.store.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "")
|
|
|
|
}
|
|
|
|
onReviewContactRequest: {
|
|
|
|
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true)
|
|
|
|
Global.openReviewContactRequestPopup(profileContextMenu.publicKey, contactDetails, null)
|
|
|
|
}
|
|
|
|
onSendContactRequest: {
|
|
|
|
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true)
|
|
|
|
Global.openContactRequestPopup(profileContextMenu.publicKey, contactDetails, null)
|
|
|
|
}
|
|
|
|
onEditNickname: {
|
|
|
|
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true)
|
|
|
|
Global.openNicknamePopupRequested(profileContextMenu.publicKey, contactDetails, null)
|
|
|
|
}
|
|
|
|
onRemoveNickname: (displayName) => {
|
|
|
|
root.store.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", displayName, true)
|
|
|
|
}
|
|
|
|
onUnblockContact: {
|
|
|
|
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true)
|
|
|
|
Global.unblockContactRequested(profileContextMenu.publicKey, contactDetails)
|
|
|
|
}
|
|
|
|
onMarkAsUntrusted: {
|
|
|
|
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true)
|
|
|
|
Global.markAsUntrustedRequested(profileContextMenu.publicKey, contactDetails)
|
|
|
|
}
|
|
|
|
onRemoveTrustStatus: root.store.contactsStore.removeTrustStatus(profileContextMenu.publicKey)
|
|
|
|
onRemoveContact: {
|
|
|
|
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true)
|
|
|
|
Global.removeContactRequested(profileContextMenu.publicKey, contactDetails)
|
2023-05-19 19:07:50 +03:00
|
|
|
}
|
2024-09-06 11:55:44 -04:00
|
|
|
onBlockContact: {
|
|
|
|
const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true)
|
|
|
|
Global.blockContactRequested(profileContextMenu.publicKey, contactDetails)
|
2023-05-19 19:07:50 +03:00
|
|
|
}
|
2024-09-06 11:55:44 -04:00
|
|
|
onRemoveFromGroup: {
|
|
|
|
root.store.removeMemberFromGroupChat(profileContextMenu.publicKey)
|
|
|
|
}
|
2024-10-02 14:54:11 +02:00
|
|
|
onClosed: destroy()
|
2023-05-19 19:07:50 +03:00
|
|
|
}
|
|
|
|
}
|
2021-07-22 17:53:19 +03:00
|
|
|
}
|