This commit is contained in:
Sarah Jamie Lewis 2019-08-08 14:42:51 -07:00
vanhempi c6ca6d2567
commit 0d6dd0e7ed
12 muutettua tiedostoa jossa 59 lisäystä ja 16 poistoa

Näytä tiedosto

@ -52,11 +52,12 @@ type GrandCentralDispatcher struct {
_ func(str string) `signal:"InvokePopup"`
_ func(zoom, locale string) `signal:"SupplySettings"`
_ func(groupID, name, server, invitation string, accepted bool, addrbooknames, addrbookaddrs []string) `signal:"SupplyGroupSettings"`
_ func(onion, nick string) `signal:"SupplyPeerSettings"`
_ func(onion, nick string, blocked bool) `signal:"SupplyPeerSettings"`
// signals emitted from the ui (written in go, below)
_ func(message string, mid string) `signal:"sendMessage,auto"`
_ func(onion string) `signal:"blockPeer,auto"`
_ func(onion string) `signal:"unblockPeer,auto"`
_ func(onion string) `signal:"loadMessagesPane,auto"`
_ func(signal string) `signal:"broadcast,auto"` // convenience relay signal
_ func(str string) `signal:"importString,auto"`
@ -285,18 +286,18 @@ func (this *GrandCentralDispatcher) requestPeerSettings() {
contact := the.Peer.GetContact(this.CurrentOpenConversation())
if contact == nil {
log.Errorf("error: requested settings for unknown contact %v?", this.CurrentOpenConversation())
this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation())
this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation(), false)
return
}
name, exists := contact.GetAttribute("nick")
if !exists {
log.Errorf("error: couldn't find contact %v", this.CurrentOpenConversation())
this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation())
this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation(), contact.Blocked)
return
}
this.SupplyPeerSettings(contact.Onion, name)
this.SupplyPeerSettings(contact.Onion, name, contact.Blocked)
}
func (this *GrandCentralDispatcher) savePeerSettings(onion, nick string) {
@ -492,6 +493,16 @@ func (this *GrandCentralDispatcher) blockPeer(onion string) {
this.UIState.UpdateContact(onion)
}
func (this *GrandCentralDispatcher) unblockPeer(onion string) {
err := the.Peer.UnblockPeer(onion)
if err != nil {
this.InvokePopup("Error Unblocking Peer: " + err.Error())
}
the.Peer.PeerWithOnion(onion)
this.UIState.UpdateContact(onion)
}
func (this *GrandCentralDispatcher) inviteToGroup(onion, groupID string) {
err := the.Peer.InviteOnionToGroup(onion, groupID)
if err != nil {

Näytä tiedosto

@ -177,6 +177,12 @@ func (this *InterfaceState) UpdateContact(handle string) {
c.Blocked = contact.Blocked
this.parentGcd.UpdateContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, c.Blocked, c.Loading)
}
} else {
cif, found := this.contacts.Load(handle)
if found {
c := cif.(*gobjects.Contact)
this.parentGcd.UpdateContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, c.Blocked, c.Loading)
}
}
}

Näytä tiedosto

@ -255,7 +255,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="94"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="85"/>
<source>unblock-btn</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<source>delete-btn</source>
<translation>löschen</translation>
</message>

Binary file not shown.

Näytä tiedosto

@ -255,7 +255,12 @@
<translation>Block Peer</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="94"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="85"/>
<source>unblock-btn</source>
<translation>Unblock Peer</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<source>delete-btn</source>
<translation>Delete</translation>
</message>

Näytä tiedosto

@ -255,7 +255,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="94"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="85"/>
<source>unblock-btn</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<source>delete-btn</source>
<translation>Effacer</translation>
</message>

Näytä tiedosto

@ -255,7 +255,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="94"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="85"/>
<source>unblock-btn</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<source>delete-btn</source>
<translation>Deletar</translation>
</message>

Näytä tiedosto

@ -92,7 +92,7 @@ ColumnLayout {
}
}
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) {
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _blocked, _loading) {
if (gcd.currentOpenConversation == _handle) {
if (_loading == true) {
newposttitle.enabled = false

Näytä tiedosto

@ -110,7 +110,7 @@ ColumnLayout {
messagesListView.positionViewAtEnd()
}
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) {
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _blocked, _loading) {
if (gcd.currentOpenConversation == _handle) {
// Group is Synced OR p2p is Authenticated
if ( (_handle.length == 32 && _status == 4) || _status == 3) {

Näytä tiedosto

@ -96,7 +96,7 @@ ColumnLayout {
}
}
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) {
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _blocked, _loading) {
if (gcd.currentOpenConversation == _handle) {
if (_loading == true) {
newposttitle.enabled = false

Näytä tiedosto

@ -12,7 +12,7 @@ import "../styles"
ColumnLayout { // peerSettingsPane
id: root
anchors.fill: parent
property bool blocked
StackToolbar {
id: toolbar
@ -82,10 +82,15 @@ ColumnLayout { // peerSettingsPane
SimpleButton {
icon: "solid/hand-paper"
text: qsTr("block-btn")
text: root.blocked ? qsTr("unblock-btn") : qsTr("block-btn")
onClicked: {
gcd.blockPeer(txtOnion.text)
if (root.blocked) {
gcd.unblockPeer(txtOnion.text)
} else {
gcd.blockPeer(txtOnion.text)
}
root.blocked = !root.blocked
}
}
@ -106,10 +111,11 @@ ColumnLayout { // peerSettingsPane
Connections {
target: gcd
onSupplyPeerSettings: function(onion, nick) {
onSupplyPeerSettings: function(onion, nick, blocked) {
toolbar.text = nick
txtOnion.text = onion
txtDisplayName.text = nick
root.blocked = blocked
}
}
}

Näytä tiedosto

@ -56,9 +56,9 @@ ColumnLayout {
"_badge": badge,
"_status": status,
"_trusted": trusted,
"_blocked": blocked,
"_deleted": false,
"_loading": loading,
"_blocked": blocked
})
}