2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2020-06-04 10:30:49 +00:00
|
|
|
import "../../../../imports"
|
|
|
|
import "../../../../shared"
|
|
|
|
import "./"
|
|
|
|
|
|
|
|
ModalPopup {
|
|
|
|
id: popup
|
2020-06-17 21:43:26 +00:00
|
|
|
property var identicon: ""
|
|
|
|
property var userName: ""
|
|
|
|
property var fromAuthor: ""
|
|
|
|
|
|
|
|
function openPopup(userNameParam, fromAuthorParam, identiconParam) {
|
|
|
|
this.userName = userNameParam
|
|
|
|
this.fromAuthor = fromAuthorParam
|
|
|
|
this.identicon = identiconParam
|
|
|
|
popup.open()
|
|
|
|
}
|
2020-06-09 10:05:25 +00:00
|
|
|
|
|
|
|
header: Item {
|
|
|
|
height: children[0].height
|
|
|
|
width: parent.width
|
|
|
|
Rectangle {
|
|
|
|
id: profilePic
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
radius: 30
|
|
|
|
border.color: "#10000000"
|
|
|
|
border.width: 1
|
|
|
|
color: Theme.transparent
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Theme.padding
|
|
|
|
Image {
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: identicon
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TextEdit {
|
|
|
|
id: profileName
|
|
|
|
text: userName
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 18
|
|
|
|
anchors.left: profilePic.right
|
|
|
|
anchors.leftMargin: Theme.smallPadding
|
|
|
|
font.bold: true
|
|
|
|
font.pixelSize: 14
|
|
|
|
readOnly: true
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-09 10:05:25 +00:00
|
|
|
text: fromAuthor
|
|
|
|
width: 160
|
|
|
|
elide: Text.ElideMiddle
|
|
|
|
anchors.left: profilePic.right
|
|
|
|
anchors.leftMargin: Theme.smallPadding
|
|
|
|
anchors.top: profileName.bottom
|
|
|
|
anchors.topMargin: 2
|
|
|
|
font.pixelSize: 14
|
|
|
|
color: Theme.darkGrey
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(pascal): implement qrcode view
|
|
|
|
// Rectangle {
|
|
|
|
// id: qrCodeButton
|
|
|
|
// height: 32
|
|
|
|
// width: 32
|
|
|
|
// anchors.top: parent.top
|
|
|
|
// anchors.topMargin: Theme.padding
|
|
|
|
// anchors.right: parent.right
|
|
|
|
// anchors.rightMargin: 32 + Theme.smallPadding
|
|
|
|
// radius: 8
|
|
|
|
|
|
|
|
// Image {
|
|
|
|
// source: "../../../../shared/img/qr-code-icon.svg"
|
|
|
|
// anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
// anchors.verticalCenter: parent.verticalCenter
|
|
|
|
// }
|
|
|
|
|
|
|
|
// MouseArea {
|
|
|
|
// cursorShape: Qt.PointingHandCursor
|
|
|
|
// anchors.fill: parent
|
|
|
|
// hoverEnabled: true
|
|
|
|
// onExited: {
|
|
|
|
// qrCodeButton.color = Theme.white
|
|
|
|
// }
|
|
|
|
// onEntered:{
|
|
|
|
// qrCodeButton.color = Theme.grey
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-09 10:05:25 +00:00
|
|
|
id: labelEnsUsername
|
|
|
|
text: qsTr("ENS username")
|
|
|
|
font.pixelSize: 13
|
|
|
|
font.weight: Font.Medium
|
|
|
|
color: Theme.darkGrey
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Theme.smallPadding
|
2020-06-09 10:01:19 +00:00
|
|
|
anchors.top: parent.top
|
2020-06-09 10:05:25 +00:00
|
|
|
anchors.topMargin: Theme.smallPadding
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-09 10:05:25 +00:00
|
|
|
id: valueEnsName
|
|
|
|
text: "@emily.stateofus.eth"
|
|
|
|
font.pixelSize: 14
|
2020-06-09 10:01:19 +00:00
|
|
|
anchors.left: parent.left
|
2020-06-09 10:05:25 +00:00
|
|
|
anchors.leftMargin: Theme.smallPadding
|
|
|
|
anchors.top: labelEnsUsername.bottom
|
|
|
|
anchors.topMargin: Theme.smallPadding
|
2020-06-09 10:01:19 +00:00
|
|
|
}
|
2020-06-04 10:30:49 +00:00
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-09 10:05:25 +00:00
|
|
|
id: labelChatKey
|
|
|
|
text: qsTr("Chat key")
|
|
|
|
font.pixelSize: 13
|
|
|
|
font.weight: Font.Medium
|
|
|
|
color: Theme.darkGrey
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Theme.smallPadding
|
|
|
|
anchors.top: valueEnsName.bottom
|
|
|
|
anchors.topMargin: Theme.padding
|
2020-06-04 10:30:49 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-09 10:05:25 +00:00
|
|
|
id: valueChatKey
|
|
|
|
text: fromAuthor
|
|
|
|
width: 160
|
|
|
|
elide: Text.ElideMiddle
|
|
|
|
font.pixelSize: 14
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Theme.smallPadding
|
|
|
|
anchors.top: labelChatKey.bottom
|
|
|
|
anchors.topMargin: Theme.smallPadding
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: separator
|
|
|
|
anchors.top: valueChatKey.bottom
|
|
|
|
anchors.topMargin: Theme.padding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: -Theme.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -Theme.padding
|
2020-06-04 10:30:49 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-09 10:05:25 +00:00
|
|
|
id: labelShareURL
|
|
|
|
text: qsTr("Share Profile URL")
|
|
|
|
font.pixelSize: 13
|
|
|
|
font.weight: Font.Medium
|
2020-06-04 10:30:49 +00:00
|
|
|
color: Theme.darkGrey
|
2020-06-09 10:05:25 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Theme.smallPadding
|
|
|
|
anchors.top: separator.bottom
|
|
|
|
anchors.topMargin: Theme.padding
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-09 10:05:25 +00:00
|
|
|
id: valueShareURL
|
|
|
|
text: "https://join.status.im/u/" + fromAuthor.substr(0, 4) + "..." + fromAuthor.substr(fromAuthor.length - 5)
|
|
|
|
font.pixelSize: 14
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Theme.smallPadding
|
|
|
|
anchors.top: labelShareURL.bottom
|
|
|
|
anchors.topMargin: Theme.smallPadding
|
2020-06-04 10:30:49 +00:00
|
|
|
}
|
|
|
|
|
2020-06-09 10:05:25 +00:00
|
|
|
// TODO(pascal): implement copy to clipboard component
|
|
|
|
// Rectangle {
|
|
|
|
// id: copyToClipboardButton
|
|
|
|
// height: 32
|
|
|
|
// width: 32
|
|
|
|
// anchors.top: labelShareURL.bottom
|
|
|
|
// anchors.topMargin: Theme.padding
|
|
|
|
// anchors.left: valueShareURL.right
|
|
|
|
// anchors.leftMargin: Theme.padding
|
|
|
|
// radius: 8
|
|
|
|
|
|
|
|
// Image {
|
|
|
|
// source: "../../../../shared/img/copy-to-clipboard-icon.svg"
|
|
|
|
// anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
// anchors.verticalCenter: parent.verticalCenter
|
|
|
|
// }
|
|
|
|
|
|
|
|
// MouseArea {
|
|
|
|
// cursorShape: Qt.PointingHandCursor
|
|
|
|
// anchors.fill: parent
|
|
|
|
// hoverEnabled: true
|
|
|
|
// onExited: {
|
|
|
|
// copyToClipboardButton.color = Theme.white
|
|
|
|
// }
|
|
|
|
// onEntered:{
|
|
|
|
// copyToClipboardButton.color = Theme.grey
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
2020-06-11 08:22:20 +00:00
|
|
|
footer: Item {
|
|
|
|
width: parent.width
|
|
|
|
height: children[0].height
|
|
|
|
|
2020-06-17 22:02:23 +00:00
|
|
|
StyledButton {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 20
|
|
|
|
label: qsTr("Send Message")
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
onClicked: {
|
|
|
|
profilePopup.close()
|
|
|
|
if (tabBar.currentIndex !== 0) tabBar.currentIndex = 0
|
|
|
|
chatsModel.joinChat(fromAuthor, Constants.chatTypeOneToOne)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-11 08:22:20 +00:00
|
|
|
StyledButton {
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: addToContactsButton.width + 32
|
|
|
|
btnColor: "white"
|
|
|
|
btnBorderWidth: 1
|
2020-06-17 22:02:23 +00:00
|
|
|
btnBorderColor: Theme.grey
|
|
|
|
textColor: Theme.red
|
|
|
|
label: qsTr("Block User")
|
2020-06-11 08:22:20 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
onClicked: {
|
|
|
|
chatsModel.blockContact(fromAuthor)
|
|
|
|
// TODO(pascal): Change block user button state based
|
|
|
|
// on :contact/blocked state
|
|
|
|
profilePopup.close()
|
|
|
|
}
|
2020-06-04 10:30:49 +00:00
|
|
|
}
|
2020-06-11 08:22:20 +00:00
|
|
|
|
|
|
|
StyledButton {
|
|
|
|
id: addToContactsButton
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Theme.smallPadding
|
2020-06-17 22:02:23 +00:00
|
|
|
label: qsTr("Add to contacts")
|
2020-06-11 08:22:20 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
onClicked: {
|
2020-06-13 13:49:20 +00:00
|
|
|
chatsModel.addContact(fromAuthor)
|
|
|
|
// TODO(iuri): Change add contact button state based
|
|
|
|
// on contact already added or not
|
2020-06-11 08:22:20 +00:00
|
|
|
profilePopup.close()
|
|
|
|
}
|
|
|
|
}
|
2020-06-04 10:30:49 +00:00
|
|
|
}
|
|
|
|
}
|