2020-05-17 16:34:47 +03:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Layouts 1.2
|
|
|
|
import QtQuick.Window 2.3
|
|
|
|
|
2020-05-22 08:47:02 +03:00
|
|
|
import im.nheko 1.0
|
|
|
|
|
2020-06-04 16:44:15 +03:00
|
|
|
import "./device-verification"
|
|
|
|
|
2020-05-17 16:34:47 +03:00
|
|
|
ApplicationWindow{
|
2020-07-04 05:24:28 +03:00
|
|
|
property var profile
|
|
|
|
|
|
|
|
id: userProfileDialog
|
|
|
|
height: 650
|
|
|
|
width: 420
|
2020-09-13 19:13:08 +03:00
|
|
|
minimumHeight: 420
|
|
|
|
|
2020-07-04 05:24:28 +03:00
|
|
|
modality: Qt.WindowModal
|
|
|
|
palette: colors
|
|
|
|
|
2020-07-05 19:03:27 +03:00
|
|
|
Connections{
|
|
|
|
target: deviceVerificationList
|
2020-09-13 19:13:08 +03:00
|
|
|
function onUpdateProfile() {
|
2020-07-05 19:03:27 +03:00
|
|
|
profile.fetchDeviceList(profile.userid)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-04 05:24:28 +03:00
|
|
|
Component {
|
2020-06-09 19:36:41 +03:00
|
|
|
id: deviceVerificationDialog
|
|
|
|
DeviceVerification {}
|
|
|
|
}
|
2020-07-04 05:24:28 +03:00
|
|
|
Component{
|
|
|
|
id: deviceVerificationFlow
|
|
|
|
DeviceVerificationFlow {}
|
|
|
|
}
|
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
ColumnLayout{
|
|
|
|
id: contentL
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 10
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
spacing: 10
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
Avatar {
|
|
|
|
url: profile.avatarUrl.replace("mxc://", "image://MxcImage/")
|
|
|
|
height: 130
|
|
|
|
width: 130
|
|
|
|
displayName: profile.displayName
|
|
|
|
userid: profile.userid
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
}
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
Label {
|
|
|
|
text: profile.displayName
|
|
|
|
fontSizeMode: Text.HorizontalFit
|
|
|
|
font.pixelSize: 20
|
|
|
|
color: TimelineManager.userColor(profile.userid, colors.window)
|
|
|
|
font.bold: true
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
}
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
MatrixText {
|
|
|
|
text: profile.userid
|
|
|
|
font.pixelSize: 15
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
}
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
Button {
|
|
|
|
id: verifyUserButton
|
|
|
|
text: "Verify"
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2020-09-13 19:23:41 +03:00
|
|
|
enabled: profile.isUserVerified
|
|
|
|
visible: profile.isUserVerified
|
2020-09-13 19:13:08 +03:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
var newFlow = profile.createFlow(true);
|
|
|
|
newFlow.userId = profile.userid;
|
|
|
|
newFlow.sender = true;
|
|
|
|
deviceVerificationList.add(newFlow.tranId);
|
|
|
|
var dialog = deviceVerificationDialog.createObject(userProfileDialog, {flow: newFlow,isRequest: true,tran_id: newFlow.tranId});
|
|
|
|
dialog.show();
|
2020-07-17 23:16:30 +03:00
|
|
|
}
|
2020-09-13 19:13:08 +03:00
|
|
|
}
|
2020-07-17 23:16:30 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
RowLayout {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
spacing: 8
|
|
|
|
|
|
|
|
ImageButton {
|
|
|
|
image:":/icons/icons/ui/do-not-disturb-rounded-sign.png"
|
|
|
|
hoverEnabled: true
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.text: qsTr("Ban the user")
|
2020-09-13 19:23:41 +03:00
|
|
|
onClicked: profile.banUser()
|
2020-09-13 19:13:08 +03:00
|
|
|
}
|
|
|
|
// ImageButton{
|
|
|
|
// image:":/icons/icons/ui/volume-off-indicator.png"
|
|
|
|
// Layout.margins: {
|
|
|
|
// left: 5
|
|
|
|
// right: 5
|
|
|
|
// }
|
|
|
|
// ToolTip.visible: hovered
|
|
|
|
// ToolTip.text: qsTr("Ignore messages from this user")
|
|
|
|
// onClicked : {
|
|
|
|
// profile.ignoreUser()
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
ImageButton{
|
|
|
|
image:":/icons/icons/ui/black-bubble-speech.png"
|
|
|
|
hoverEnabled: true
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.text: qsTr("Start a private chat")
|
2020-09-13 19:23:41 +03:00
|
|
|
onClicked: profile.startChat()
|
2020-09-13 19:13:08 +03:00
|
|
|
}
|
|
|
|
ImageButton{
|
|
|
|
image:":/icons/icons/ui/round-remove-button.png"
|
|
|
|
hoverEnabled: true
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.text: qsTr("Kick the user")
|
2020-09-13 19:23:41 +03:00
|
|
|
onClicked: profile.kickUser()
|
2020-07-04 05:24:28 +03:00
|
|
|
}
|
2020-09-13 19:13:08 +03:00
|
|
|
}
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
ListView{
|
|
|
|
id: devicelist
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.minimumHeight: 200
|
|
|
|
Layout.fillWidth: true
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
clip: true
|
|
|
|
spacing: 8
|
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
model: profile.deviceList
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
delegate: RowLayout{
|
|
|
|
width: parent.width
|
|
|
|
spacing: 4
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
ColumnLayout{
|
|
|
|
spacing: 0
|
|
|
|
Text{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
elide: Text.ElideRight
|
|
|
|
font.bold: true
|
2020-09-13 19:23:41 +03:00
|
|
|
color: colors.text
|
2020-09-13 19:13:08 +03:00
|
|
|
text: model.deviceId
|
|
|
|
}
|
|
|
|
Text{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignRight
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
elide: Text.ElideRight
|
2020-09-13 19:23:41 +03:00
|
|
|
color: colors.text
|
2020-09-13 19:13:08 +03:00
|
|
|
text: model.deviceName
|
|
|
|
}
|
2020-07-04 05:24:28 +03:00
|
|
|
}
|
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
Image{
|
|
|
|
Layout.preferredHeight: 16
|
|
|
|
Layout.preferredWidth: 16
|
|
|
|
|
|
|
|
source: ((model.verificationStatus == VerificationStatus.VERIFIED)?"image://colorimage/:/icons/icons/ui/lock.png?green":
|
|
|
|
((model.verificationStatus == VerificationStatus.UNVERIFIED)?"image://colorimage/:/icons/icons/ui/unlock.png?yellow":
|
|
|
|
"image://colorimage/:/icons/icons/ui/unlock.png?red"))
|
|
|
|
}
|
|
|
|
Button{
|
|
|
|
id: verifyButton
|
|
|
|
text: (model.verificationStatus != VerificationStatus.VERIFIED)?"Verify":"Unverify"
|
|
|
|
onClicked: {
|
|
|
|
var newFlow = profile.createFlow(false);
|
|
|
|
newFlow.userId = profile.userid;
|
|
|
|
newFlow.sender = true;
|
|
|
|
newFlow.deviceId = model.deviceId;
|
|
|
|
if(model.verificationStatus == VerificationStatus.VERIFIED){
|
|
|
|
newFlow.unverify();
|
|
|
|
deviceVerificationList.updateProfile(newFlow.userId);
|
|
|
|
}else{
|
|
|
|
deviceVerificationList.add(newFlow.tranId);
|
|
|
|
var dialog = deviceVerificationDialog.createObject(userProfileDialog, {flow: newFlow,isRequest:false,tran_id: newFlow.tranId});
|
|
|
|
dialog.show();
|
|
|
|
}
|
|
|
|
}
|
2020-07-04 05:24:28 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-09-13 19:13:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
footer: DialogButtonBox {
|
|
|
|
standardButtons: DialogButtonBox.Ok
|
2020-07-04 05:24:28 +03:00
|
|
|
|
2020-09-13 19:13:08 +03:00
|
|
|
onAccepted: userProfileDialog.close()
|
2020-07-04 05:24:28 +03:00
|
|
|
}
|
2020-05-17 16:34:47 +03:00
|
|
|
}
|