From c1c1d5ddb45b9e77a60ea06dfd0362f98b7e0515 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 17 May 2017 15:33:10 +0200 Subject: [PATCH] Qml app: fixed unread messages count displaying Roles in models are not expected to change type, so they must be always defined and have the same type --- retroshare-qml-app/src/ContactSort.js | 1 + retroshare-qml-app/src/Contacts.qml | 2 -- retroshare-qml-app/src/GxsIdentityDelegate.qml | 6 ++++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/retroshare-qml-app/src/ContactSort.js b/retroshare-qml-app/src/ContactSort.js index 376be721f..e4a02fb52 100644 --- a/retroshare-qml-app/src/ContactSort.js +++ b/retroshare-qml-app/src/ContactSort.js @@ -58,6 +58,7 @@ function mergeContactsUnread() var el = jsonData[i] if(unreadMessages.hasOwnProperty(el.gxs_id)) el['unread_count'] = unreadMessages[el.gxs_id] + else el['unread_count'] = "0" // This must be string } } diff --git a/retroshare-qml-app/src/Contacts.qml b/retroshare-qml-app/src/Contacts.qml index 213710c17..e1e312319 100644 --- a/retroshare-qml-app/src/Contacts.qml +++ b/retroshare-qml-app/src/Contacts.qml @@ -50,8 +50,6 @@ Item function refreshContactsCallback(par) { console.log("contactsView.refreshContactsCB()", visible) - if (contactsListModel.model.count < 1) - contactsListModel.json = par.response var token = JSON.parse(par.response).statetoken TokensManager.registerToken(token, refreshContacts) contactsSortWorker.sendMessage( diff --git a/retroshare-qml-app/src/GxsIdentityDelegate.qml b/retroshare-qml-app/src/GxsIdentityDelegate.qml index 38672fe9d..9f74b802e 100644 --- a/retroshare-qml-app/src/GxsIdentityDelegate.qml +++ b/retroshare-qml-app/src/GxsIdentityDelegate.qml @@ -79,6 +79,7 @@ Item anchors.rightMargin: 10 anchors.verticalCenter: parent.verticalCenter height: parent.height - 10 + spacing: 4 Rectangle { @@ -88,15 +89,16 @@ Item antialiasing: true border.color: "blue" border.width: 1 - height: parent.height + height: parent.height - 4 radius: height/2 width: height + anchors.verticalCenter: parent.verticalCenter Text { color: "white" font.bold: true - text: model.unread_count > 0 ? model.unread_count : '' + text: model.unread_count anchors.centerIn: parent } }