Skip to content
Snippets Groups Projects
Commit 00febee4 authored by Page Magnier-Slimani's avatar Page Magnier-Slimani Committed by Adrien Béraud
Browse files

UserProfile: add ID copy functionnality

Allow to copy UID from the user profile menu.
Make the alias always visible and assure we cannot copy it by mistake.
Allow to copy the username from the chatViewHeader.

Change-Id: I8ff257850286e8a1142c5bd2fbb26e29e8fe5060
parent c8879716
Branches
No related tags found
No related merge requests found
...@@ -116,6 +116,20 @@ Rectangle { ...@@ -116,6 +116,20 @@ Rectangle {
spacing: 0 spacing: 0
LineEditContextMenu {
id: displayNameContextMenu
lineEditObj: title
selectOnly: true
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
cursorShape: Qt.IBeamCursor
onClicked: function (mouse) {
displayNameContextMenu.openMenuAt(mouse);
}
}
ElidedTextLabel { ElidedTextLabel {
id: title id: title
......
...@@ -90,8 +90,7 @@ BaseModalDialog { ...@@ -90,8 +90,7 @@ BaseModalDialog {
spacing: 10 spacing: 10
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
// Visible when user alias is not empty and not equal to id. Text {
TextEdit {
id: contactAlias id: contactAlias
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
...@@ -99,14 +98,12 @@ BaseModalDialog { ...@@ -99,14 +98,12 @@ BaseModalDialog {
font.kerning: true font.kerning: true
color: JamiTheme.textColor color: JamiTheme.textColor
visible: aliasText ? (aliasText === idText ? false : true) : false visible: true
selectByMouse: true
readOnly: true
text: textMetricsContactAliasText.elidedText text: textMetricsContactAliasText.elidedText
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
}
TextMetrics { TextMetrics {
id: textMetricsContactAliasText id: textMetricsContactAliasText
...@@ -115,7 +112,6 @@ BaseModalDialog { ...@@ -115,7 +112,6 @@ BaseModalDialog {
elideWidth: userProfileDialogLayout.width - qrImageBackground.width - 100 elideWidth: userProfileDialogLayout.width - qrImageBackground.width - 100
elide: Qt.ElideRight elide: Qt.ElideRight
} }
}
// Visible when user name is not empty or equals to id. // Visible when user name is not empty or equals to id.
TextEdit { TextEdit {
...@@ -135,6 +131,21 @@ BaseModalDialog { ...@@ -135,6 +131,21 @@ BaseModalDialog {
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
LineEditContextMenu {
id: displayNameContextMenu
lineEditObj: contactDisplayName
selectOnly: true
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
cursorShape: Qt.IBeamCursor
onClicked: function (mouse) {
displayNameContextMenu.openMenuAt(mouse);
}
}
TextMetrics { TextMetrics {
id: textMetricsContactDisplayNameText id: textMetricsContactDisplayNameText
font: contactDisplayName.font font: contactDisplayName.font
...@@ -146,8 +157,6 @@ BaseModalDialog { ...@@ -146,8 +157,6 @@ BaseModalDialog {
} }
} }
Rectangle { Rectangle {
id: idRectangle id: idRectangle
...@@ -181,7 +190,7 @@ BaseModalDialog { ...@@ -181,7 +190,7 @@ BaseModalDialog {
TextEdit { TextEdit {
id: contactId id: contactId
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
Layout.minimumWidth: 400 - identifierText.width - 2 * root.popupMargins - 35 Layout.minimumWidth: 400 - identifierText.width - copyButton.width - 2 * root.popupMargins - 35
font.pointSize: JamiTheme.textFontSize font.pointSize: JamiTheme.textFontSize
font.kerning: true font.kerning: true
...@@ -191,6 +200,21 @@ BaseModalDialog { ...@@ -191,6 +200,21 @@ BaseModalDialog {
readOnly: true readOnly: true
text: textMetricsContacIdText.elidedText text: textMetricsContacIdText.elidedText
LineEditContextMenu {
id: idContextMenu
lineEditObj: contactId
selectOnly: true
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
cursorShape: Qt.IBeamCursor
onClicked: function (mouse) {
idContextMenu.openMenuAt(mouse);
}
}
TextMetrics { TextMetrics {
id: textMetricsContacIdText id: textMetricsContacIdText
font: contactDisplayName.font font: contactDisplayName.font
...@@ -202,9 +226,25 @@ BaseModalDialog { ...@@ -202,9 +226,25 @@ BaseModalDialog {
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
PushButton {
id: copyButton
preferredHeight: 24
preferredWidth: 24
circled: false
radius: 3
toolTipText: JamiStrings.copy
source: JamiResources.copy_svg
onClicked: {
contactId.selectAll();
contactId.copy();
contactId.deselect();
}
}
} }
} }
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment