mirror of https://github.com/zlatinb/muwire
ability to add distrusted contacts
parent
b4c4dca953
commit
bc7aec00c1
|
@ -27,7 +27,8 @@ class AddContactController {
|
||||||
Persona p
|
Persona p
|
||||||
try {
|
try {
|
||||||
p = new Persona(new ByteArrayInputStream(Base64.decode(text)))
|
p = new Persona(new ByteArrayInputStream(Base64.decode(text)))
|
||||||
TrustEvent e = new TrustEvent(persona : p, level : TrustLevel.TRUSTED, reason : view.reasonArea.getText())
|
TrustLevel tl = model.trusted ? TrustLevel.TRUSTED : TrustLevel.DISTRUSTED
|
||||||
|
TrustEvent e = new TrustEvent(persona : p, level : tl, reason : view.reasonArea.getText())
|
||||||
model.core.eventBus.publish(e)
|
model.core.eventBus.publish(e)
|
||||||
cancel()
|
cancel()
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -9,4 +9,5 @@ import griffon.metadata.ArtifactProviderFor
|
||||||
@ArtifactProviderFor(GriffonModel)
|
@ArtifactProviderFor(GriffonModel)
|
||||||
class AddContactModel {
|
class AddContactModel {
|
||||||
Core core
|
Core core
|
||||||
|
@Observable boolean trusted = true
|
||||||
}
|
}
|
|
@ -2,6 +2,8 @@ package com.muwire.gui
|
||||||
|
|
||||||
import griffon.core.artifact.GriffonView
|
import griffon.core.artifact.GriffonView
|
||||||
|
|
||||||
|
import java.awt.event.ActionListener
|
||||||
|
|
||||||
import static com.muwire.gui.Translator.trans
|
import static com.muwire.gui.Translator.trans
|
||||||
|
|
||||||
import java.awt.BorderLayout
|
import java.awt.BorderLayout
|
||||||
|
@ -54,6 +56,9 @@ class AddContactView {
|
||||||
reasonArea = textArea(editable : true, lineWrap : true, wrapStyleWord : true)
|
reasonArea = textArea(editable : true, lineWrap : true, wrapStyleWord : true)
|
||||||
}
|
}
|
||||||
panel(constraints : BorderLayout.SOUTH) {
|
panel(constraints : BorderLayout.SOUTH) {
|
||||||
|
buttonGroup(id : "trustLevel")
|
||||||
|
radioButton(text : trans("TRUSTED"), selected : bind {model.trusted}, buttonGroup : trustLevel, actionPerformed : setTrusted )
|
||||||
|
radioButton(text : trans("DISTRUSTED"), selected : bind {!model.trusted}, buttonGroup: trustLevel, actionPerformed : setDistrusted )
|
||||||
button(text : trans("ADD_CONTACT_SPECIFIC"), addAction)
|
button(text : trans("ADD_CONTACT_SPECIFIC"), addAction)
|
||||||
button(text : trans("CANCEL"), cancelAction)
|
button(text : trans("CANCEL"), cancelAction)
|
||||||
}
|
}
|
||||||
|
@ -73,4 +78,12 @@ class AddContactView {
|
||||||
})
|
})
|
||||||
dialog.show()
|
dialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def setTrusted = {
|
||||||
|
model.trusted = true
|
||||||
|
}
|
||||||
|
|
||||||
|
def setDistrusted = {
|
||||||
|
model.trusted = false
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue