From f4ab4369932ce0435043c20199c8f7031c72efcb Mon Sep 17 00:00:00 2001 From: erinn Date: Fri, 1 Feb 2019 16:27:17 -0800 Subject: [PATCH] change toolbar title --- go/gothings/gcd.go | 17 ++++++++++++++++- qml/main.qml | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/go/gothings/gcd.go b/go/gothings/gcd.go index 5a94aa8..9a965b2 100644 --- a/go/gothings/gcd.go +++ b/go/gothings/gcd.go @@ -35,6 +35,7 @@ type GrandCentralDispatcher struct { _ func() `signal:"ClearMessages"` _ func() `signal:"ResetMessagePane"` _ func(mID uint) `signal:"Acknowledged"` + _ func(title string) `signal:"SetToolbarTitle"` // profile-area stuff _ func(name, onion, image string) `signal:"UpdateMyProfile"` @@ -115,7 +116,14 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) { if len(handle) == 32 { // LOAD GROUP log.Debugf("LOADING GROUP %s", handle) - tl := the.Peer.GetGroup(handle).GetTimeline() + group := the.Peer.GetGroup(handle) + tl := group.GetTimeline() + nick, _ := group.GetAttribute("nick") + if nick == "" { + this.SetToolbarTitle(handle) + } else { + this.SetToolbarTitle(nick) + } log.Debugf("messages: %d", len(tl)) for i := range tl { if tl[i].PeerID == the.Peer.GetProfile().Onion { @@ -143,6 +151,13 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) { return } // ELSE LOAD CONTACT + nick, _ := the.Peer.GetProfile().GetAttribute(handle + "_name") + if nick == "" { + this.SetToolbarTitle(handle) + } else { + this.SetToolbarTitle(nick) + } + messages := this.UIState.GetMessages(handle) for i := range messages { from := messages[i].From diff --git a/qml/main.qml b/qml/main.qml index 713c532..6812c88 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -205,5 +205,9 @@ Item { popup.visible = true anmPopup.restart() } + + onSetToolbarTitle: function(str) { + theStack.title = str + } } } \ No newline at end of file