Merge branch 'master' of git.openprivacy.ca:cwtch.im/ui
This commit is contained in:
commit
6de3805ecf
|
@ -52,11 +52,12 @@ type GrandCentralDispatcher struct {
|
||||||
_ func(str string) `signal:"InvokePopup"`
|
_ func(str string) `signal:"InvokePopup"`
|
||||||
_ func(zoom, locale string) `signal:"SupplySettings"`
|
_ func(zoom, locale string) `signal:"SupplySettings"`
|
||||||
_ func(groupID, name, server, invitation string, accepted bool, addrbooknames, addrbookaddrs []string) `signal:"SupplyGroupSettings"`
|
_ 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)
|
// signals emitted from the ui (written in go, below)
|
||||||
_ func(message string, mid string) `signal:"sendMessage,auto"`
|
_ func(message string, mid string) `signal:"sendMessage,auto"`
|
||||||
_ func(onion string) `signal:"blockPeer,auto"`
|
_ func(onion string) `signal:"blockPeer,auto"`
|
||||||
|
_ func(onion string) `signal:"unblockPeer,auto"`
|
||||||
_ func(onion string) `signal:"loadMessagesPane,auto"`
|
_ func(onion string) `signal:"loadMessagesPane,auto"`
|
||||||
_ func(signal string) `signal:"broadcast,auto"` // convenience relay signal
|
_ func(signal string) `signal:"broadcast,auto"` // convenience relay signal
|
||||||
_ func(str string) `signal:"importString,auto"`
|
_ func(str string) `signal:"importString,auto"`
|
||||||
|
@ -285,18 +286,18 @@ func (this *GrandCentralDispatcher) requestPeerSettings() {
|
||||||
contact := the.Peer.GetContact(this.CurrentOpenConversation())
|
contact := the.Peer.GetContact(this.CurrentOpenConversation())
|
||||||
if contact == nil {
|
if contact == nil {
|
||||||
log.Errorf("error: requested settings for unknown contact %v?", this.CurrentOpenConversation())
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
name, exists := contact.GetAttribute("nick")
|
name, exists := contact.GetAttribute("nick")
|
||||||
if !exists {
|
if !exists {
|
||||||
log.Errorf("error: couldn't find contact %v", this.CurrentOpenConversation())
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.SupplyPeerSettings(contact.Onion, name)
|
this.SupplyPeerSettings(contact.Onion, name, contact.Blocked)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) savePeerSettings(onion, nick string) {
|
func (this *GrandCentralDispatcher) savePeerSettings(onion, nick string) {
|
||||||
|
@ -492,6 +493,16 @@ func (this *GrandCentralDispatcher) blockPeer(onion string) {
|
||||||
this.UIState.UpdateContact(onion)
|
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) {
|
func (this *GrandCentralDispatcher) inviteToGroup(onion, groupID string) {
|
||||||
err := the.Peer.InviteOnionToGroup(onion, groupID)
|
err := the.Peer.InviteOnionToGroup(onion, groupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -177,6 +177,12 @@ func (this *InterfaceState) UpdateContact(handle string) {
|
||||||
c.Blocked = contact.Blocked
|
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)
|
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>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<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>
|
<source>delete-btn</source>
|
||||||
<translation>löschen</translation>
|
<translation>löschen</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
Binary file not shown.
|
@ -255,7 +255,12 @@
|
||||||
<translation>Block Peer</translation>
|
<translation>Block Peer</translation>
|
||||||
</message>
|
</message>
|
||||||
<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>
|
<source>delete-btn</source>
|
||||||
<translation>Delete</translation>
|
<translation>Delete</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
@ -255,7 +255,12 @@
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<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>
|
<source>delete-btn</source>
|
||||||
<translation>Effacer</translation>
|
<translation>Effacer</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
@ -255,7 +255,12 @@
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<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>
|
<source>delete-btn</source>
|
||||||
<translation>Deletar</translation>
|
<translation>Deletar</translation>
|
||||||
</message>
|
</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 (gcd.currentOpenConversation == _handle) {
|
||||||
if (_loading == true) {
|
if (_loading == true) {
|
||||||
newposttitle.enabled = false
|
newposttitle.enabled = false
|
||||||
|
|
|
@ -110,7 +110,7 @@ ColumnLayout {
|
||||||
messagesListView.positionViewAtEnd()
|
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) {
|
if (gcd.currentOpenConversation == _handle) {
|
||||||
// Group is Synced OR p2p is Authenticated
|
// Group is Synced OR p2p is Authenticated
|
||||||
if ( (_handle.length == 32 && _status == 4) || _status == 3) {
|
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 (gcd.currentOpenConversation == _handle) {
|
||||||
if (_loading == true) {
|
if (_loading == true) {
|
||||||
newposttitle.enabled = false
|
newposttitle.enabled = false
|
||||||
|
|
|
@ -12,7 +12,7 @@ import "../styles"
|
||||||
ColumnLayout { // peerSettingsPane
|
ColumnLayout { // peerSettingsPane
|
||||||
id: root
|
id: root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
property bool blocked
|
||||||
|
|
||||||
StackToolbar {
|
StackToolbar {
|
||||||
id: toolbar
|
id: toolbar
|
||||||
|
@ -82,10 +82,15 @@ ColumnLayout { // peerSettingsPane
|
||||||
|
|
||||||
SimpleButton {
|
SimpleButton {
|
||||||
icon: "solid/hand-paper"
|
icon: "solid/hand-paper"
|
||||||
text: qsTr("block-btn")
|
text: root.blocked ? qsTr("unblock-btn") : qsTr("block-btn")
|
||||||
|
|
||||||
onClicked: {
|
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 {
|
Connections {
|
||||||
target: gcd
|
target: gcd
|
||||||
|
|
||||||
onSupplyPeerSettings: function(onion, nick) {
|
onSupplyPeerSettings: function(onion, nick, blocked) {
|
||||||
toolbar.text = nick
|
toolbar.text = nick
|
||||||
txtOnion.text = onion
|
txtOnion.text = onion
|
||||||
txtDisplayName.text = nick
|
txtDisplayName.text = nick
|
||||||
|
root.blocked = blocked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -56,9 +56,9 @@ ColumnLayout {
|
||||||
"_badge": badge,
|
"_badge": badge,
|
||||||
"_status": status,
|
"_status": status,
|
||||||
"_trusted": trusted,
|
"_trusted": trusted,
|
||||||
|
"_blocked": blocked,
|
||||||
"_deleted": false,
|
"_deleted": false,
|
||||||
"_loading": loading,
|
"_loading": loading,
|
||||||
"_blocked": blocked
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue