diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatContent.qml b/linphone-app/ui/modules/Linphone/Chat/ChatContent.qml index 46befa9b3..7a8b90cb6 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatContent.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatContent.qml @@ -26,6 +26,9 @@ Column{ property string lastTextSelected property alias textColor: message.color property alias textFont: message.font + + signal rightClicked() + height: fitHeight anchors.left: parent.left anchors.right: parent.right @@ -49,5 +52,6 @@ Column{ contentModel: mainItem.contentModel onLastTextSelectedChanged: mainItem.lastTextSelected = lastTextSelected color: isOutgoing ? ChatStyle.entry.message.outgoing.text.color : ChatStyle.entry.message.incoming.text.color + onRightClicked: mainItem.rightClicked() } } \ No newline at end of file diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatMenu.qml b/linphone-app/ui/modules/Linphone/Chat/ChatMenu.qml index c185d03a4..d2bde7f82 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatMenu.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatMenu.qml @@ -114,18 +114,4 @@ Item { onTriggered: container.removeEntryRequested() } } - - - - // Handle hovered link. - MouseArea { - anchors.fill: parent - - acceptedButtons: Qt.RightButton - propagateComposedEvents:true - cursorShape: parent.hoveredLink - ? Qt.PointingHandCursor - : Qt.IBeamCursor - onClicked: mouse.button === Qt.RightButton && messageMenu.popup() - } } diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatTextMessage.qml b/linphone-app/ui/modules/Linphone/Chat/ChatTextMessage.qml index 385b3b3d8..ccaf1c4b6 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatTextMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatTextMessage.qml @@ -26,6 +26,8 @@ TextEdit { property int fitHeight: visible ? contentHeight + padding : 0 property int fitWidth: visible ? implicitWidth + padding*2 : 0 + signal rightClicked() + property int removeWarningFromBindingLoop : implicitWidth // Just a dummy variable to remove meaningless binding loop on implicitWidth @@ -49,12 +51,44 @@ TextEdit { textFormat: Text.RichText // To supports links and imgs. wrapMode: TextEdit.Wrap - onCursorRectangleChanged: Logic.ensureVisible(cursorRectangle) + onCursorRectangleChanged: if(!readOnly) Logic.ensureVisible(cursorRectangle) onLinkActivated: Qt.openUrlExternally(link) - onSelectedTextChanged:if(selectedText != '') lastTextSelected = selectedText + onSelectedTextChanged:{ + if(selectedText != '') lastTextSelected = selectedText + else { + if( mouseArea.keepLastSelection) { + mouseArea.keepLastSelection = false + select(mouseArea.lastStartSelection, mouseArea.lastEndSelection) + } + } + } onActiveFocusChanged: { - if(activeFocus) + if(activeFocus) { lastTextSelected = '' + mouseArea.keepLastSelection = false + } deselect() } + + MouseArea { + id: mouseArea + property bool keepLastSelection: false + property int lastStartSelection:0 + property int lastEndSelection:0 + anchors.fill: parent + propagateComposedEvents: true + hoverEnabled: false + scrollGestureEnabled: false + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor + acceptedButtons: Qt.RightButton + onClicked: { + if(!keepLastSelection) { + lastStartSelection = parent.selectionStart + lastEndSelection = parent.selectionEnd + } + keepLastSelection = true + message.rightClicked() + mouse.accepted = true + } + } } diff --git a/linphone-app/ui/modules/Linphone/Chat/Message.qml b/linphone-app/ui/modules/Linphone/Chat/Message.qml index adc30a2e1..2a95c6325 100644 --- a/linphone-app/ui/modules/Linphone/Chat/Message.qml +++ b/linphone-app/ui/modules/Linphone/Chat/Message.qml @@ -98,13 +98,15 @@ Item { chatMessageModel: $chatEntry } height: contentHeight - + boundsBehavior: Flickable.StopAtBounds + interactive: false delegate: ChatContent{ contentModel: modelData onFitWidthChanged:{ rectangle.updateWidth() } onLastTextSelectedChanged: container.lastTextSelected= lastTextSelected + onRightClicked: chatMenu.open() } } } diff --git a/linphone-sdk b/linphone-sdk index d69419023..21c354aaf 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit d69419023710a53f3a1c946243d3448ca3db5e4c +Subproject commit 21c354aaf1c6e39797840bc79a1f60aa70dd6a49