Merge pull request 'fix contacts sort up on send msg; profile list shows unread;' (#460) from dan/ui:unread into master
the build was successful
Details
the build was successful
Details
Reviewed-on: #460
This commit is contained in:
commit
211e388a7d
|
@ -6,6 +6,8 @@ const Name = "name"
|
||||||
const LastRead = "last-read"
|
const LastRead = "last-read"
|
||||||
const Picture = "picture"
|
const Picture = "picture"
|
||||||
const ShowBlocked = "show-blocked"
|
const ShowBlocked = "show-blocked"
|
||||||
|
const UnreadMsgCount = "unread-message-count"
|
||||||
|
const ApprovedTime = "approved-time"
|
||||||
|
|
||||||
const ProfileTypeV1DefaultPassword = "v1-defaultPassword"
|
const ProfileTypeV1DefaultPassword = "v1-defaultPassword"
|
||||||
const ProfileTypeV1Password = "v1-userPassword"
|
const ProfileTypeV1Password = "v1-userPassword"
|
||||||
|
|
|
@ -64,7 +64,6 @@ func PeerHandler(onion string, uiManager ui.Manager, subscribed chan bool) {
|
||||||
case event.NewMessageFromGroup: //event.TimestampReceived, event.TimestampSent, event.Data, event.GroupID, event.RemotePeer
|
case event.NewMessageFromGroup: //event.TimestampReceived, event.TimestampSent, event.Data, event.GroupID, event.RemotePeer
|
||||||
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampSent])
|
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampSent])
|
||||||
uiManager.AddMessage(e.Data[event.GroupID], e.Data[event.RemotePeer], e.Data[event.Data], e.Data[event.RemotePeer] == peer.GetOnion(), hex.EncodeToString([]byte(e.Data[event.Signature])), ts, true)
|
uiManager.AddMessage(e.Data[event.GroupID], e.Data[event.RemotePeer], e.Data[event.Data], e.Data[event.RemotePeer] == peer.GetOnion(), hex.EncodeToString([]byte(e.Data[event.Signature])), ts, true)
|
||||||
|
|
||||||
case event.NewGroup:
|
case event.NewGroup:
|
||||||
group := peer.GetGroup(e.Data[event.GroupID])
|
group := peer.GetGroup(e.Data[event.GroupID])
|
||||||
if group != nil {
|
if group != nil {
|
||||||
|
|
14
go/ui/gcd.go
14
go/ui/gcd.go
|
@ -59,7 +59,7 @@ type GrandCentralDispatcher struct {
|
||||||
_ func(pane int) `signal:"ChangeProfilePane"`
|
_ func(pane int) `signal:"ChangeProfilePane"`
|
||||||
// profile management stuff
|
// profile management stuff
|
||||||
_ func() `signal:"Loaded"`
|
_ func() `signal:"Loaded"`
|
||||||
_ func(handle, displayname, image, tag string, online bool) `signal:"AddProfile"`
|
_ func(handle, displayname, image, tag string, unread int, online bool) `signal:"AddProfile"`
|
||||||
_ func() `signal:"ErrorLoaded0"`
|
_ func() `signal:"ErrorLoaded0"`
|
||||||
_ func() `signal:"ResetProfile"`
|
_ func() `signal:"ResetProfile"`
|
||||||
_ func() `signal:"ResetProfileList"`
|
_ func() `signal:"ResetProfileList"`
|
||||||
|
@ -85,7 +85,7 @@ type GrandCentralDispatcher struct {
|
||||||
_ func(handle, displayName string) `signal:"UpdateContactDisplayName"`
|
_ func(handle, displayName string) `signal:"UpdateContactDisplayName"`
|
||||||
_ func(handle, image string) `signal:"UpdateContactPicture"`
|
_ func(handle, image string) `signal:"UpdateContactPicture"`
|
||||||
_ func(handle string, status int, loading bool) `signal:"UpdateContactStatus"`
|
_ func(handle string, status int, loading bool) `signal:"UpdateContactStatus"`
|
||||||
_ func(handle string) `signal:"IncContactUnreadCount"`
|
_ func(profile, contact string) `signal:"IncContactMessageCount"`
|
||||||
_ func(handle string) `signal:"RemoveContact"`
|
_ func(handle string) `signal:"RemoveContact"`
|
||||||
_ func(handle, key, value string) `signal:"UpdateContactAttribute"`
|
_ func(handle, key, value string) `signal:"UpdateContactAttribute"`
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ func (this *GrandCentralDispatcher) sendMessage(message string) {
|
||||||
the.Peer.SendMessageToPeer(this.SelectedConversation(), message)
|
the.Peer.SendMessageToPeer(this.SelectedConversation(), message)
|
||||||
this.TimelineInterface.RequestEIR()
|
this.TimelineInterface.RequestEIR()
|
||||||
}
|
}
|
||||||
|
this.IncContactMessageCount(this.SelectedProfile(), this.SelectedConversation())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
|
func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
|
||||||
|
@ -669,6 +669,8 @@ func (this *GrandCentralDispatcher) addPeer(name, address string) {
|
||||||
if name != "" {
|
if name != "" {
|
||||||
the.Peer.SetContactAttribute(address, attr.GetLocalScope(constants.Name), name)
|
the.Peer.SetContactAttribute(address, attr.GetLocalScope(constants.Name), name)
|
||||||
}
|
}
|
||||||
|
the.Peer.SetContactAttribute(address, attr.GetLocalScope(constants.ApprovedTime), strconv.Itoa(int(time.Now().Unix())))
|
||||||
|
|
||||||
the.Peer.PeerWithOnion(address)
|
the.Peer.PeerWithOnion(address)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,6 +702,8 @@ func (this *GrandCentralDispatcher) createGroup(server, groupName string) {
|
||||||
the.Peer.SetGroupAttribute(groupID, attr.GetLocalScope(constants.Name), groupName)
|
the.Peer.SetGroupAttribute(groupID, attr.GetLocalScope(constants.Name), groupName)
|
||||||
the.Peer.JoinServer(server)
|
the.Peer.JoinServer(server)
|
||||||
|
|
||||||
|
the.Peer.SetGroupAttribute(server, attr.GetLocalScope(constants.ApprovedTime), strconv.Itoa(int(time.Now().Unix())))
|
||||||
|
|
||||||
this.GetUiManager(this.selectedProfile()).AddContact(groupID)
|
this.GetUiManager(this.selectedProfile()).AddContact(groupID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,10 +715,11 @@ func (this *GrandCentralDispatcher) setPeerAuthorization(onion string, authoriza
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.RemoveContact(onion)
|
this.RemoveContact(onion)
|
||||||
this.GetUiManager(this.selectedProfile()).AddContact(onion)
|
|
||||||
if model.Authorization(authorization) == model.AuthApproved {
|
if model.Authorization(authorization) == model.AuthApproved {
|
||||||
|
the.Peer.SetContactAttribute(onion, attr.GetLocalScope(constants.ApprovedTime), strconv.Itoa(int(time.Now().Unix())))
|
||||||
the.Peer.PeerWithOnion(onion)
|
the.Peer.PeerWithOnion(onion)
|
||||||
}
|
}
|
||||||
|
this.GetUiManager(this.selectedProfile()).AddContact(onion)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) inviteToGroup(onion, groupID string) {
|
func (this *GrandCentralDispatcher) inviteToGroup(onion, groupID string) {
|
||||||
|
@ -898,6 +903,7 @@ func (this *GrandCentralDispatcher) loadProfile(onion string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
the.Peer.SetAttribute(attr.GetSettingsScope(constants.UnreadMsgCount), "0")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) createProfile(nick string, defaultPass bool, password string) {
|
func (this *GrandCentralDispatcher) createProfile(nick string, defaultPass bool, password string) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"cwtch.im/ui/go/the"
|
"cwtch.im/ui/go/the"
|
||||||
"git.openprivacy.ca/openprivacy/log"
|
"git.openprivacy.ca/openprivacy/log"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -190,8 +191,11 @@ func AddProfile(gcd *GrandCentralDispatcher, handle string) {
|
||||||
|
|
||||||
online, _ := p.GetAttribute(attr.GetLocalScope(constants.PeerOnline))
|
online, _ := p.GetAttribute(attr.GetLocalScope(constants.PeerOnline))
|
||||||
|
|
||||||
log.Debugf("AddProfile %v %v %v %v %v\n", handle, nick, picPath, tag, online)
|
unreadStr, _ := p.GetAttribute(attr.GetSettingsScope(constants.UnreadMsgCount))
|
||||||
gcd.AddProfile(handle, nick, picPath, tag, online == event.True)
|
unread, _ := strconv.Atoi(unreadStr)
|
||||||
|
|
||||||
|
log.Debugf("AddProfile %v %v %v %v %v %v\n", handle, nick, picPath, tag, unread, online)
|
||||||
|
gcd.AddProfile(handle, nick, picPath, tag, unread, online == event.True)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,6 +245,26 @@ func (this *manager) Acknowledge(handle, mID string) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getContactLastMessageTime(contact *model.PublicProfile) int {
|
||||||
|
time := getLastMessageTime(&contact.Timeline)
|
||||||
|
|
||||||
|
if time == 0 {
|
||||||
|
approvedTimeStr, _ := contact.GetAttribute(attr.GetLocalScope(constants.ApprovedTime))
|
||||||
|
time, _ = strconv.Atoi(approvedTimeStr)
|
||||||
|
}
|
||||||
|
return time
|
||||||
|
}
|
||||||
|
|
||||||
|
func getGroupLastMessageTime(group *model.Group) int {
|
||||||
|
time := getLastMessageTime(&group.Timeline)
|
||||||
|
|
||||||
|
if time == 0 {
|
||||||
|
approvedTimeStr, _ := group.GetAttribute(attr.GetLocalScope(constants.ApprovedTime))
|
||||||
|
time, _ = strconv.Atoi(approvedTimeStr)
|
||||||
|
}
|
||||||
|
return time
|
||||||
|
}
|
||||||
|
|
||||||
func getLastMessageTime(tl *model.Timeline) int {
|
func getLastMessageTime(tl *model.Timeline) int {
|
||||||
if len(tl.Messages) == 0 {
|
if len(tl.Messages) == 0 {
|
||||||
return 0
|
return 0
|
||||||
|
@ -260,7 +284,7 @@ func (this *manager) AddContact(handle string) {
|
||||||
unread := countUnread(group.Timeline.GetMessages(), lastRead)
|
unread := countUnread(group.Timeline.GetMessages(), lastRead)
|
||||||
picture := GetProfilePic(handle)
|
picture := GetProfilePic(handle)
|
||||||
|
|
||||||
this.gcd.AddContact(handle, GetNick(handle), picture, unread, int(connections.ConnectionStateToType[group.State]), string(model.AuthApproved), false, getLastMessageTime(&group.Timeline))
|
this.gcd.AddContact(handle, GetNick(handle), picture, unread, int(connections.ConnectionStateToType[group.State]), string(model.AuthApproved), false, getGroupLastMessageTime(group))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} else if !isPeer(handle) {
|
} else if !isPeer(handle) {
|
||||||
|
@ -275,7 +299,7 @@ func (this *manager) AddContact(handle string) {
|
||||||
unread := countUnread(contact.Timeline.GetMessages(), lastRead)
|
unread := countUnread(contact.Timeline.GetMessages(), lastRead)
|
||||||
picture := GetProfilePic(handle)
|
picture := GetProfilePic(handle)
|
||||||
|
|
||||||
this.gcd.AddContact(handle, GetNick(handle), picture, unread, int(connections.ConnectionStateToType[contact.State]), string(contact.Authorization), false, getLastMessageTime(&contact.Timeline))
|
this.gcd.AddContact(handle, GetNick(handle), picture, unread, int(connections.ConnectionStateToType[contact.State]), string(contact.Authorization), false, getContactLastMessageTime(contact))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -303,8 +327,11 @@ func (this *manager) MessageJustAdded() {
|
||||||
func (this *manager) StoreAndNotify(pere peer.CwtchPeer, onion string, messageTxt string, sent time.Time, profileOnion string) {
|
func (this *manager) StoreAndNotify(pere peer.CwtchPeer, onion string, messageTxt string, sent time.Time, profileOnion string) {
|
||||||
|
|
||||||
// Send a New Message from Peer Notification
|
// Send a New Message from Peer Notification
|
||||||
|
// Android
|
||||||
this.gcd.AndroidCwtchActivity.SetChannel(onion)
|
this.gcd.AndroidCwtchActivity.SetChannel(onion)
|
||||||
this.gcd.AndroidCwtchActivity.NotificationChanged("New Message from Peer")
|
this.gcd.AndroidCwtchActivity.NotificationChanged("New Message from Peer")
|
||||||
|
// Desktop
|
||||||
|
this.gcd.Notify(onion)
|
||||||
|
|
||||||
this.gcd.DoIfProfileElse(this.profile, func() {
|
this.gcd.DoIfProfileElse(this.profile, func() {
|
||||||
this.gcd.DoIfConversationElse(onion, func() {
|
this.gcd.DoIfConversationElse(onion, func() {
|
||||||
|
@ -315,16 +342,16 @@ func (this *manager) StoreAndNotify(pere peer.CwtchPeer, onion string, messageTx
|
||||||
}, func() {
|
}, func() {
|
||||||
pere.StoreMessage(onion, messageTxt, sent)
|
pere.StoreMessage(onion, messageTxt, sent)
|
||||||
})
|
})
|
||||||
this.gcd.IncContactUnreadCount(onion)
|
|
||||||
}, func() {
|
}, func() {
|
||||||
the.CwtchApp.GetPeer(profileOnion).StoreMessage(onion, messageTxt, sent)
|
the.CwtchApp.GetPeer(profileOnion).StoreMessage(onion, messageTxt, sent)
|
||||||
|
this.incUnreadMsgCount()
|
||||||
})
|
})
|
||||||
this.gcd.Notify(onion)
|
this.gcd.IncContactMessageCount(this.profile, onion)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddMessage adds a message to the message pane for the supplied conversation if it is active
|
// AddMessage adds a message to the message pane for the supplied conversation if it is active
|
||||||
func (this *manager) AddMessage(handle string, from string, message string, fromMe bool, messageID string, timestamp time.Time, Acknowledged bool) {
|
func (this *manager) AddMessage(handle string, from string, message string, fromMe bool, messageID string, timestamp time.Time, Acknowledged bool) {
|
||||||
this.gcd.DoIfProfile(this.profile, func() {
|
this.gcd.DoIfProfileElse(this.profile, func() {
|
||||||
this.gcd.DoIfConversation(handle, func() {
|
this.gcd.DoIfConversation(handle, func() {
|
||||||
updateLastReadTime(handle)
|
updateLastReadTime(handle)
|
||||||
// If the message is not from the user then add it, otherwise, just acknowledge.
|
// If the message is not from the user then add it, otherwise, just acknowledge.
|
||||||
|
@ -335,11 +362,14 @@ func (this *manager) AddMessage(handle string, from string, message string, from
|
||||||
this.gcd.Acknowledged(messageID)
|
this.gcd.Acknowledged(messageID)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.gcd.IncContactUnreadCount(handle)
|
}, func() {
|
||||||
|
this.incUnreadMsgCount()
|
||||||
})
|
})
|
||||||
|
|
||||||
if !fromMe {
|
if !fromMe {
|
||||||
this.gcd.Notify(handle)
|
this.gcd.Notify(handle)
|
||||||
}
|
}
|
||||||
|
this.gcd.IncContactMessageCount(this.profile, handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *manager) ReloadProfiles() {
|
func (this *manager) ReloadProfiles() {
|
||||||
|
@ -381,3 +411,15 @@ func (this *manager) ChangePasswordResponse(error bool) {
|
||||||
func (this *manager) UpdateNetworkStatus(online bool) {
|
func (this *manager) UpdateNetworkStatus(online bool) {
|
||||||
this.gcd.UpdateProfileNetworkStatus(this.profile, online)
|
this.gcd.UpdateProfileNetworkStatus(this.profile, online)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *manager) incUnreadMsgCount() {
|
||||||
|
peer := the.CwtchApp.GetPeer(this.profile)
|
||||||
|
if peer != nil {
|
||||||
|
unreadMsgCountStr, _ := peer.GetAttribute(attr.GetSettingsScope(constants.UnreadMsgCount))
|
||||||
|
unreadMsgCount, err := strconv.Atoi(unreadMsgCountStr)
|
||||||
|
if err != nil {
|
||||||
|
unreadMsgCount = 0
|
||||||
|
}
|
||||||
|
peer.SetAttribute(attr.GetSettingsScope(constants.UnreadMsgCount), strconv.Itoa(unreadMsgCount+1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -428,7 +428,11 @@ ApplicationWindow {
|
||||||
// Until then I am leaving this here for documentation.
|
// Until then I am leaving this here for documentation.
|
||||||
// androidCwtchActivity.channel = onion
|
// androidCwtchActivity.channel = onion
|
||||||
// androidCwtchActivity.notification = "Message from " + onion;
|
// androidCwtchActivity.notification = "Message from " + onion;
|
||||||
|
|
||||||
|
// Basic Desktop notification
|
||||||
|
windowItem.alert(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: Mutant.standard.imagePath = gcd.assetPath;
|
Component.onCompleted: Mutant.standard.imagePath = gcd.assetPath;
|
||||||
|
|
|
@ -22,12 +22,6 @@ W.Overlay {
|
||||||
target: mm
|
target: mm
|
||||||
onRowsInserted: {
|
onRowsInserted: {
|
||||||
if (messagesListView.atYEnd) thymer.running = true
|
if (messagesListView.atYEnd) thymer.running = true
|
||||||
|
|
||||||
//todo: this won't fire for non-active convos
|
|
||||||
windowItem.alert(0)
|
|
||||||
if (gcd.os == "android" && windowItem.activeFocusItem == null) {
|
|
||||||
androidCwtchActivity.notification = "New Content"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,6 @@ ColumnLayout {
|
||||||
"_status": status,
|
"_status": status,
|
||||||
"_authorization": authorization,
|
"_authorization": authorization,
|
||||||
"_loading": loading,
|
"_loading": loading,
|
||||||
"_loading": loading,
|
|
||||||
"_lastMsgTs": lastMsgTs,
|
"_lastMsgTs": lastMsgTs,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +137,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onIncContactUnreadCount: function(handle) {
|
/*onIncContactUnreadCount: function(handle) {
|
||||||
var ts = Math.round((new Date()).getTime() / 1000);
|
var ts = Math.round((new Date()).getTime() / 1000);
|
||||||
for(var i = 0; i < contactsModel.count; i++){
|
for(var i = 0; i < contactsModel.count; i++){
|
||||||
if(contactsModel.get(i)["_handle"] == handle) {
|
if(contactsModel.get(i)["_handle"] == handle) {
|
||||||
|
@ -147,6 +146,19 @@ ColumnLayout {
|
||||||
contactsModel.move(i, 0, 1)
|
contactsModel.move(i, 0, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
onIncContactMessageCount: function(profile, handle) {
|
||||||
|
if (profile == gcd.selectedProfile) {
|
||||||
|
var ts = Math.round((new Date()).getTime() / 1000);
|
||||||
|
for(var i = 0; i < contactsModel.count; i++){
|
||||||
|
if(contactsModel.get(i)["_handle"] == handle) {
|
||||||
|
var contact = contactsModel.get(i)
|
||||||
|
contact["_lastMsgTs"] = ts
|
||||||
|
contactsModel.move(i, 0, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onResetProfile: function() {
|
onResetProfile: function() {
|
||||||
|
|
|
@ -148,8 +148,8 @@ Opaque.PortraitRow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onIncContactUnreadCount: function(_handle) {
|
onIncContactMessageCount: function(_profile, _handle) {
|
||||||
if (handle == _handle && gcd.selectedConversation != handle) {
|
if (_profile == gcd.selectedProfile && handle == _handle && gcd.selectedConversation != handle) {
|
||||||
badge++
|
badge++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ ColumnLayout {
|
||||||
Connections { // ADD/REMOVE CONTACT ENTRIES
|
Connections { // ADD/REMOVE CONTACT ENTRIES
|
||||||
target: gcd
|
target: gcd
|
||||||
|
|
||||||
onAddProfile: function(handle, displayName, image, tag, online) {
|
onAddProfile: function(handle, displayName, image, tag, unread, online) {
|
||||||
|
|
||||||
// don't add duplicates
|
// don't add duplicates
|
||||||
for (var i = 0; i < profilesModel.count; i++) {
|
for (var i = 0; i < profilesModel.count; i++) {
|
||||||
|
@ -61,6 +61,7 @@ ColumnLayout {
|
||||||
_image: image,
|
_image: image,
|
||||||
_tag: tag,
|
_tag: tag,
|
||||||
_online: online,
|
_online: online,
|
||||||
|
_unread: unread,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +93,7 @@ ColumnLayout {
|
||||||
displayName: _displayName
|
displayName: _displayName
|
||||||
image: _image
|
image: _image
|
||||||
tag: _tag
|
tag: _tag
|
||||||
|
unread: _unread
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
profileOnline: _online
|
profileOnline: _online
|
||||||
rowClicked: function(handle) {
|
rowClicked: function(handle) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ RowLayout {
|
||||||
property var rowClicked: {}
|
property var rowClicked: {}
|
||||||
property var editClicked: {}
|
property var editClicked: {}
|
||||||
property bool profileOnline: false
|
property bool profileOnline: false
|
||||||
|
property int unread: 0
|
||||||
|
|
||||||
Opaque.PortraitRow {
|
Opaque.PortraitRow {
|
||||||
id: prow
|
id: prow
|
||||||
|
@ -44,7 +45,28 @@ RowLayout {
|
||||||
hilightBackgroundColor: prow.badgeColor
|
hilightBackgroundColor: prow.badgeColor
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: rowClicked(handle)
|
Opaque.Badge {
|
||||||
|
id: unreadBadge
|
||||||
|
visible: unread > 0
|
||||||
|
color: Theme.portraitContactBadgeColor
|
||||||
|
size: parent.height/4
|
||||||
|
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 25 * gcd.themeScale
|
||||||
|
anchors.leftMargin: 1 * gcd.themeScale
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
content: Label {
|
||||||
|
id: lblUnread
|
||||||
|
color: Theme.portraitContactBadgeTextColor
|
||||||
|
font.pixelSize: Theme.badgeTextSize * gcd.themeScale
|
||||||
|
font.weight: Font.Bold
|
||||||
|
text: unread > 99 ? "99+" : unread
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onClicked: { unread = 0; rowClicked(handle) }
|
||||||
|
|
||||||
function updateStatus() {
|
function updateStatus() {
|
||||||
if (gcd.torStatus != Const.statusOnline) { // Tor network offline
|
if (gcd.torStatus != Const.statusOnline) { // Tor network offline
|
||||||
|
@ -84,6 +106,12 @@ RowLayout {
|
||||||
prow.updateStatus()
|
prow.updateStatus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onIncContactMessageCount: function(_profile, _handle) {
|
||||||
|
if (_profile == handle) {
|
||||||
|
unread++
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|
Reference in New Issue