mirror of https://github.com/zlatinb/muwire
add buttons to copy short and full nickname to clipboard
parent
7a0c60a164
commit
06cedb4f41
|
@ -14,6 +14,8 @@ import net.i2p.data.Signature
|
|||
import net.i2p.data.SigningPrivateKey
|
||||
|
||||
import java.awt.Desktop
|
||||
import java.awt.Toolkit
|
||||
import java.awt.datatransfer.StringSelection
|
||||
import java.awt.event.ActionEvent
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
|
@ -485,6 +487,22 @@ class MainFrameController {
|
|||
startChat(p)
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void copyShort() {
|
||||
copy(model.core.me.getHumanReadableName())
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void copyFull() {
|
||||
copy(model.core.me.toBase64())
|
||||
}
|
||||
|
||||
private void copy(String s) {
|
||||
StringSelection selection = new StringSelection(s)
|
||||
def clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
|
||||
clipboard.setContents(selection, null)
|
||||
}
|
||||
|
||||
void startChat(Persona p) {
|
||||
if (!mvcGroup.getChildrenGroups().containsKey(p.getHumanReadableName())) {
|
||||
def params = [:]
|
||||
|
|
|
@ -499,7 +499,11 @@ class MainFrameView {
|
|||
}
|
||||
panel (border: etchedBorder(), constraints : BorderLayout.SOUTH) {
|
||||
borderLayout()
|
||||
label(text : bind {model.me}, constraints: BorderLayout.CENTER)
|
||||
panel (constraints : BorderLayout.WEST) {
|
||||
label(text : bind {model.me})
|
||||
button(text : "Copy Short", copyShortAction)
|
||||
button(text : "Copy Full", copyFullAction)
|
||||
}
|
||||
panel (constraints : BorderLayout.EAST) {
|
||||
label("Connections:")
|
||||
label(text : bind {model.connections})
|
||||
|
|
Loading…
Reference in New Issue