Unblocking Support #197
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -12,7 +12,7 @@ import "../styles"
|
|||
ColumnLayout { // peerSettingsPane
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
|
||||
property bool blocked
|
||||
|
||||
StackToolbar {
|
||||
id: toolbar
|
||||
|
@ -82,11 +82,16 @@ ColumnLayout { // peerSettingsPane
|
|||
|
||||
SimpleButton {
|
||||
icon: "solid/hand-paper"
|
||||
text: qsTr("block-btn")
|
||||
text: root.blocked ? qsTr("unblock-btn") : qsTr("block-btn")
|
||||
|
||||
onClicked: {
|
||||
if (root.blocked) {
|
||||
gcd.unblockPeer(txtOnion.text)
|
||||
} else {
|
||||
gcd.blockPeer(txtOnion.text)
|
||||
}
|
||||
root.blocked = !root.blocked
|
||||
}
|
||||
}
|
||||
|
||||
SimpleButton {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -56,9 +56,9 @@ ColumnLayout {
|
|||
"_badge": badge,
|
||||
"_status": status,
|
||||
"_trusted": trusted,
|
||||
"_blocked": blocked,
|
||||
"_deleted": false,
|
||||
"_loading": loading,
|
||||
"_blocked": blocked
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue