forked from cwtch.im/ui
Merge branch 'master' of git.openprivacy.ca:cwtch.im/ui into ebf201902051208
This commit is contained in:
commit
ec18895605
|
@ -120,6 +120,7 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) {
|
|||
this.ClearMessages()
|
||||
this.SetCurrentOpenConversation(handle)
|
||||
c := this.UIState.GetContact(handle)
|
||||
|
||||
c.Badge = 0
|
||||
this.UIState.UpdateContact(handle)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package gothings
|
|||
|
||||
import (
|
||||
"cwtch.im/ui/go/constants"
|
||||
"cwtch.im/ui/go/cwutil"
|
||||
"cwtch.im/ui/go/gobjects"
|
||||
"cwtch.im/ui/go/the"
|
||||
"encoding/base32"
|
||||
|
@ -50,6 +51,22 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) {
|
|||
}
|
||||
|
||||
func (this *InterfaceState) GetContact(handle string) *gobjects.Contact {
|
||||
if _, found := this.contacts[handle]; !found {
|
||||
c := &gobjects.Contact{
|
||||
handle,
|
||||
handle,
|
||||
cwutil.RandomProfileImage(handle),
|
||||
"",
|
||||
1,
|
||||
0,
|
||||
false,
|
||||
}
|
||||
|
||||
this.contacts[handle] = c
|
||||
this.parentGcd.AddContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted)
|
||||
go the.Peer.PeerWithOnion(c.Handle)
|
||||
}
|
||||
|
||||
return this.contacts[handle]
|
||||
}
|
||||
|
||||
|
@ -57,21 +74,16 @@ func (this *InterfaceState) AddMessage(m *gobjects.Message) {
|
|||
_, found := this.contacts[m.Handle]
|
||||
if !found {
|
||||
this.AddContact(&gobjects.Contact{
|
||||
m.DisplayName,
|
||||
m.Image,
|
||||
m.Handle,
|
||||
m.Handle,
|
||||
cwutil.RandomProfileImage(m.Handle),
|
||||
"",
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
})
|
||||
}
|
||||
|
||||
c := the.Peer.GetContact(m.Handle)
|
||||
if c == nil {
|
||||
|
||||
}
|
||||
|
||||
_, found = this.messages[m.Handle]
|
||||
if !found {
|
||||
this.messages[m.Handle] = make([]*gobjects.Message, 0)
|
||||
|
|
|
@ -57,7 +57,7 @@ ColumnLayout {
|
|||
target: gcd
|
||||
|
||||
onClearMessages: function() {
|
||||
//jsonModel4.clear()
|
||||
jsonModel4.clear()
|
||||
}
|
||||
|
||||
onAppendMessage: function(handle, from, displayName, message, image, mid, fromMe, ts) {
|
||||
|
@ -173,10 +173,6 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
focus: true
|
||||
onCurrentItemChanged: console.log(model.get(bulletinView.currentIndex).title + ' selected')
|
||||
|
||||
|
||||
|
||||
ListModel {
|
||||
id: jsonModel4
|
||||
}
|
||||
|
|
|
@ -102,6 +102,9 @@ ColumnLayout {
|
|||
|
||||
Flickable {
|
||||
id: flkMessage
|
||||
anchors.fill: parent//this does nothing! bug in qt
|
||||
Layout.minimumWidth: parent.width
|
||||
Layout.maximumWidth: parent.width
|
||||
Layout.minimumHeight: rectMessage.height
|
||||
Layout.maximumHeight: rectMessage.height
|
||||
contentWidth: txtMessage.width
|
||||
|
@ -120,6 +123,7 @@ ColumnLayout {
|
|||
padding: 6
|
||||
wrapMode: TextEdit.Wrap
|
||||
textFormat: Text.RichText
|
||||
width: rectMessage.width
|
||||
|
||||
property bool skipOneUpdate: false
|
||||
|
||||
|
|
Loading…
Reference in New Issue