From 61971b5b3de2947cc091b25b43373a3ac88993a9 Mon Sep 17 00:00:00 2001 From: Angela Mazzurco Date: Sun, 9 Jul 2017 17:04:31 +0200 Subject: [PATCH 1/3] Customize contact details own view --- retroshare-qml-app/src/ContactDetails.qml | 43 ++++++++++++++++++----- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/retroshare-qml-app/src/ContactDetails.qml b/retroshare-qml-app/src/ContactDetails.qml index 0336e74ca..99f718f74 100644 --- a/retroshare-qml-app/src/ContactDetails.qml +++ b/retroshare-qml-app/src/ContactDetails.qml @@ -27,6 +27,20 @@ Item id: cntDt property var md property bool is_contact: cntDt.md.is_contact + property bool isOwn: cntDt.md.own + + + Text + { + id: meText + + text: "Yourself" + visible: isOwn + + anchors.top: parent.top + anchors.topMargin: 6 + anchors.horizontalCenter: parent.horizontalCenter + } AvatarOrColorHash { @@ -34,7 +48,7 @@ Item gxs_id: cntDt.md.gxs_id - anchors.top: parent.top + anchors.top: meText.bottom anchors.topMargin: 6 anchors.horizontalCenter: parent.horizontalCenter } @@ -68,9 +82,19 @@ Item Image { - source: cntDt.is_contact ? - "qrc:/icons/rating.svg" : - "qrc:/icons/rating-unrated.svg" + source: + { + if (isOwn) + { + "qrc:/icons/keyring.svg" + } + else + { + cntDt.is_contact ? + "qrc:/icons/rating.svg" : + "qrc:/icons/rating-unrated.svg" + } + } height: parent.height - 4 sourceSize.height: height fillMode: Image.PreserveAspectFit @@ -82,10 +106,13 @@ Item onClicked: { - var jDt = JSON.stringify({gxs_id: cntDt.md.gxs_id}) - if(cntDt.is_contact) - rsApi.request("/identity/remove_contact", jDt, tgCt) - else rsApi.request("/identity/add_contact", jDt, tgCt) + if (!isOwn) + { + var jDt = JSON.stringify({gxs_id: cntDt.md.gxs_id}) + if(cntDt.is_contact) + rsApi.request("/identity/remove_contact", jDt, tgCt) + else rsApi.request("/identity/add_contact", jDt, tgCt) + } } function tgCt() { cntDt.is_contact = !cntDt.is_contact } From 55b0790285c4533df1c208f2a787c4bb2a5c28a1 Mon Sep 17 00:00:00 2001 From: Angela Mazzurco Date: Wed, 19 Jul 2017 16:21:08 +0200 Subject: [PATCH 2/3] Solve undefined parent width when a new bubble is created --- retroshare-qml-app/src/ChatBubbleDelegate.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-qml-app/src/ChatBubbleDelegate.qml b/retroshare-qml-app/src/ChatBubbleDelegate.qml index d7c346cfd..7b02f6cf9 100644 --- a/retroshare-qml-app/src/ChatBubbleDelegate.qml +++ b/retroshare-qml-app/src/ChatBubbleDelegate.qml @@ -9,7 +9,7 @@ Item id: chatBubbleDelegate height: bubble.height - width: parent.width + width: mainWindow.width - (styles.aditionalBubbleWidth - 10) property var styles: StyleChat.bubble From e369f23bb4c358ccec1c1bbec45eabb62daa270b Mon Sep 17 00:00:00 2001 From: Angela Mazzurco Date: Wed, 19 Jul 2017 16:56:17 +0200 Subject: [PATCH 3/3] Add link detection on bubbles --- retroshare-qml-app/src/ChatBubbleDelegate.qml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/retroshare-qml-app/src/ChatBubbleDelegate.qml b/retroshare-qml-app/src/ChatBubbleDelegate.qml index 7b02f6cf9..8f94320c9 100644 --- a/retroshare-qml-app/src/ChatBubbleDelegate.qml +++ b/retroshare-qml-app/src/ChatBubbleDelegate.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts 1.2 import QtQuick.Controls 2.0 import "." // To load styles import "./components" +import "URI.js" as UriJs Item { @@ -80,7 +81,11 @@ Item Text { id: mesageText - text: model.msg + text: UriJs.URI.withinString(model.msg, function(url) + { + return "" + url + ""; + }) + width: rootBubble.width * styles.bubbleMaxWidth + timeText.width anchors.left: (model.incoming)? parent.left : undefined anchors.right:(!model.incoming)? parent.right : undefined @@ -89,6 +94,10 @@ Item anchors.leftMargin: styles.lMarginBubble anchors.rightMargin: styles.rMarginBubble + + textFormat: Text.RichText + onLinkActivated: Qt.openUrlExternally(link) + // Used for the correct alineation when the message must be on right horizontalAlignment:(!model.incoming && mesageText.implicitWidth <= (rootBubble.width * styles.bubbleMaxWidth) @@ -96,6 +105,7 @@ Item wrapMode: Text.Wrap font.pixelSize: styles.messageTextSize + } }