2022-09-27 16:21:00 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
2022-12-22 13:26:27 +00:00
|
|
|
property bool isOutgoingRequest: false
|
2022-09-27 16:21:00 +00:00
|
|
|
property bool pending: false
|
|
|
|
property bool accepted: false
|
|
|
|
property bool dismissed: false
|
|
|
|
property bool blocked: false
|
|
|
|
|
|
|
|
signal acceptClicked()
|
|
|
|
signal declineClicked()
|
|
|
|
signal blockClicked()
|
|
|
|
signal profileClicked()
|
2022-12-05 15:37:21 +00:00
|
|
|
signal detailsClicked()
|
2022-09-27 16:21:00 +00:00
|
|
|
|
2022-10-20 11:57:41 +00:00
|
|
|
implicitWidth: Math.max(textItem.width, buttons.width)
|
|
|
|
implicitHeight: Math.max(textItem.height, buttons.height)
|
2022-09-27 16:21:00 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: textItem
|
2022-10-19 12:56:00 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
2022-11-15 10:11:55 +00:00
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
2022-12-22 13:26:27 +00:00
|
|
|
visible: !buttons.visible
|
2022-09-27 16:21:00 +00:00
|
|
|
text: {
|
|
|
|
if (root.accepted) {
|
|
|
|
return qsTr("Accepted")
|
2022-12-22 13:26:27 +00:00
|
|
|
} else if (root.pending) {
|
|
|
|
return qsTr("Pending")
|
2022-09-27 16:21:00 +00:00
|
|
|
} else if (root.dismissed) {
|
|
|
|
return blocked ? qsTr("Declined & Blocked") : qsTr("Declined")
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
color: {
|
|
|
|
if (root.accepted) {
|
|
|
|
return Theme.palette.successColor1
|
|
|
|
} else if (root.dismissed) {
|
|
|
|
return Theme.palette.dangerColor1
|
|
|
|
}
|
|
|
|
return Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AcceptRejectOptionsButtonsPanel {
|
|
|
|
id: buttons
|
2022-12-22 13:26:27 +00:00
|
|
|
visible: pending && !isOutgoingRequest
|
2022-10-13 15:52:44 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: parent.left
|
2022-09-27 16:21:00 +00:00
|
|
|
onAcceptClicked: root.acceptClicked()
|
|
|
|
onDeclineClicked: root.declineClicked()
|
|
|
|
onProfileClicked: root.profileClicked()
|
|
|
|
onBlockClicked: root.blockClicked()
|
2022-12-05 15:37:21 +00:00
|
|
|
onDetailsClicked: root.detailsClicked()
|
2022-09-27 16:21:00 +00:00
|
|
|
}
|
2022-12-05 15:37:21 +00:00
|
|
|
}
|