From 7653cfa008540f604c56c399dfd32024c3a65c5f Mon Sep 17 00:00:00 2001 From: Angela Mazzurco Date: Sun, 9 Jul 2017 12:44:33 +0200 Subject: [PATCH] Search details if have gxs_id and the default image is set --- .../src/components/AvatarOrColorHash.qml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/retroshare-qml-app/src/components/AvatarOrColorHash.qml b/retroshare-qml-app/src/components/AvatarOrColorHash.qml index 11c775cf6..fe0597356 100644 --- a/retroshare-qml-app/src/components/AvatarOrColorHash.qml +++ b/retroshare-qml-app/src/components/AvatarOrColorHash.qml @@ -34,13 +34,17 @@ Item ////////////// The following should be considered privates ///////////////////// property bool has_avatar: false + property bool default_image: false property int avatarAttemptCnt: 0 + property string noGxsImage: "/icons/retroshare06.png" + function getDetails() { console.log("getDetails() ", compRoot.gxs_id ) ++compRoot.avatarAttemptCnt if (gxs_id) { + default_image = false rsApi.request( "/identity/get_identity_details", JSON.stringify({ gxs_id: compRoot.gxs_id }), @@ -55,7 +59,8 @@ Item else { has_avatar = true - contactAvatar.source = "/icons/retroshare06.png" + default_image = true + contactAvatar.source = noGxsImage } } function setDetails(data) @@ -78,8 +83,9 @@ Item } - Component.onCompleted: if(visible && !has_avatar) getDetails() - onVisibleChanged: if(visible && !has_avatar) getDetails() + Component.onCompleted: if(visible && (!has_avatar || default_image ) ) getDetails() + + onVisibleChanged: if(visible && (!has_avatar || default_image ) ) getDetails() Image {