2021-06-15 19:34:36 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.controls 1.0
|
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
2021-10-28 20:23:30 +00:00
|
|
|
import shared.controls.chat 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
|
|
import "../controls"
|
|
|
|
import "../panels"
|
2021-06-15 19:34:36 +00:00
|
|
|
|
2021-10-21 23:34:35 +00:00
|
|
|
import StatusQ.Components 0.1
|
2022-07-05 10:12:27 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2021-10-21 23:34:35 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
2021-06-15 19:34:36 +00:00
|
|
|
Item {
|
2021-10-01 15:58:36 +00:00
|
|
|
id: root
|
2021-06-15 19:34:36 +00:00
|
|
|
width: parent.width
|
|
|
|
height: childrenRect.height + dateGroupLbl.anchors.topMargin
|
2021-10-21 22:39:53 +00:00
|
|
|
property var store
|
2022-01-13 21:41:43 +00:00
|
|
|
property int previousNotificationIndex
|
2022-07-05 10:12:27 +00:00
|
|
|
property int previousNotificationTimestamp
|
2022-05-10 16:04:25 +00:00
|
|
|
property bool hideReadNotifications: false
|
|
|
|
property bool acCurrentFilterAll: false
|
2022-01-13 21:41:43 +00:00
|
|
|
|
2022-07-05 10:12:27 +00:00
|
|
|
StatusDateGroupLabel {
|
2021-06-15 19:34:36 +00:00
|
|
|
id: dateGroupLbl
|
2022-07-05 10:12:27 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
height: visible ? implicitHeight : 0
|
|
|
|
visible: text !== ""
|
2022-01-13 21:41:43 +00:00
|
|
|
previousMessageIndex: root.previousNotificationIndex
|
|
|
|
previousMessageTimestamp: root.previousNotificationTimestamp
|
2021-06-15 19:34:36 +00:00
|
|
|
messageTimestamp: model.timestamp
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: groupRequestContent
|
2022-07-05 10:12:27 +00:00
|
|
|
property int timestamp: model.timestamp
|
2021-06-15 19:34:36 +00:00
|
|
|
|
|
|
|
visible: {
|
|
|
|
if (hideReadNotifications && model.read) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-05-10 16:04:25 +00:00
|
|
|
return acCurrentFilterAll;
|
2021-06-15 19:34:36 +00:00
|
|
|
}
|
|
|
|
width: parent.width
|
|
|
|
height: visible ? 60 : 0
|
|
|
|
anchors.top: dateGroupLbl.bottom
|
|
|
|
anchors.topMargin: dateGroupLbl.visible ? 4 : 0
|
|
|
|
color: model.read ? Style.current.transparent : Utils.setColorAlpha(Style.current.blue, 0.1)
|
|
|
|
|
2021-10-21 23:34:35 +00:00
|
|
|
StatusSmartIdenticon {
|
2021-06-15 19:34:36 +00:00
|
|
|
id: channelIdenticon
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-10-21 23:34:35 +00:00
|
|
|
name: model.name
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.color: Theme.palette.miscColor5
|
2021-06-15 19:34:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: nameItem
|
|
|
|
width: childrenRect.width
|
|
|
|
height: chatName.name
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
// TODO fix anchoring to center when there is no author
|
|
|
|
// anchors.top: inviteText.visible ? parent.top: undefined
|
|
|
|
// anchors.topMargin: inviteText.visible ? Style.current.halfPadding : 0
|
|
|
|
// anchors.verticalCenter: inviteText.visible ? undefined : parent.verticalCenter
|
|
|
|
anchors.left: channelIdenticon.right
|
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: groupImage
|
|
|
|
width: 16
|
|
|
|
height: 16
|
|
|
|
anchors.verticalCenter: chatName.verticalCenter
|
|
|
|
anchors.left: parent.left
|
2021-09-28 15:04:06 +00:00
|
|
|
source: Style.svg("channel-icon-group")
|
2021-06-15 19:34:36 +00:00
|
|
|
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: parent
|
|
|
|
source: parent
|
|
|
|
color: chatName.color
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: chatName
|
|
|
|
text: model.name
|
|
|
|
anchors.left: groupImage.right
|
|
|
|
anchors.leftMargin: 4
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.weight: Font.Medium
|
|
|
|
}
|
|
|
|
|
2021-10-21 22:39:53 +00:00
|
|
|
ChatTimePanel {
|
2021-06-15 19:34:36 +00:00
|
|
|
anchors.verticalCenter: chatName.verticalCenter
|
|
|
|
anchors.left: chatName.right
|
|
|
|
anchors.leftMargin: 4
|
|
|
|
font.pixelSize: 10
|
|
|
|
visible: true
|
|
|
|
color: Style.current.secondaryText
|
2021-10-21 00:41:54 +00:00
|
|
|
//timestamp: root.timestamp
|
2021-06-15 19:34:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function openProfile() {
|
2021-12-31 12:29:51 +00:00
|
|
|
Global.openProfilePopup(model.author)
|
2021-06-15 19:34:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledTextEdit {
|
|
|
|
id: inviteText
|
|
|
|
visible: !!model.author
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// text: {
|
|
|
|
// if (!visible) {
|
|
|
|
// return ""
|
|
|
|
// }
|
|
|
|
|
|
|
|
// let name = root.store.chatsModelInst.userNameOrAlias(model.author)
|
|
|
|
// if (name.length > 20) {
|
|
|
|
// name = name.substring(0, 9) + "..." + name.substring(name.length - 10)
|
|
|
|
// }
|
|
|
|
|
2022-04-04 11:26:30 +00:00
|
|
|
// return qsTr("%1 invited you to join the group")
|
2021-12-13 14:24:21 +00:00
|
|
|
// .arg(`<style type="text/css">`+
|
|
|
|
// `a {`+
|
|
|
|
// `color: ${Style.current.primary};`+
|
|
|
|
// `text-decoration: none;` +
|
|
|
|
// `}`+
|
|
|
|
// `</style>`+
|
|
|
|
// `<a href="#">${name}</a>`)
|
|
|
|
// }
|
2021-06-15 19:34:36 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: Style.current.halfPadding
|
|
|
|
anchors.left: nameItem.left
|
|
|
|
anchors.right: buttons.left
|
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
|
|
|
clip: true
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.weight: Font.Medium
|
|
|
|
readOnly: true
|
|
|
|
selectByMouse: true
|
|
|
|
textFormat: Text.RichText
|
|
|
|
onLinkActivated: groupRequestContent.openProfile()
|
|
|
|
onLinkHovered: {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
AcceptRejectOptionsButtonsPanel {
|
2021-06-15 19:34:36 +00:00
|
|
|
id: buttons
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-12-13 19:52:55 +00:00
|
|
|
onAcceptClicked: root.store.activityCenterModuleInst.acceptActivityCenterNotification(model.id)
|
|
|
|
onDeclineClicked: root.store.activityCenterModuleInst.dismissActivityCenterNotification(model.id)
|
2021-06-15 19:34:36 +00:00
|
|
|
onProfileClicked: groupRequestContent.openProfile()
|
|
|
|
onBlockClicked: {
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// const pk = model.author
|
|
|
|
// blockContactConfirmationDialog.contactName = root.store.chatsModelInst.userNameOrAlias(pk)
|
|
|
|
// blockContactConfirmationDialog.contactAddress = pk
|
|
|
|
// blockContactConfirmationDialog.open()
|
2021-06-15 19:34:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BlockContactConfirmationDialog {
|
|
|
|
id: blockContactConfirmationDialog
|
|
|
|
onBlockButtonClicked: {
|
2021-12-29 15:09:29 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// root.store.profileModuleInst.blockContact(blockContactConfirmationDialog.contactAddress)
|
2021-12-13 19:52:55 +00:00
|
|
|
root.store.activityCenterModuleInst.dismissActivityCenterNotification(model.id)
|
|
|
|
blockContactConfirmationDialog.close()
|
2021-06-15 19:34:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|