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
This commit is contained in:
Gioacchino Mazzurco 2017-05-17 15:33:10 +02:00
parent de9a44fac7
commit c1c1d5ddb4
3 changed files with 5 additions and 4 deletions

View File

@ -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
}
}

View File

@ -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(

View File

@ -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
}
}