diff --git a/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy b/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy index cb28df50..bfa188df 100644 --- a/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy +++ b/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy @@ -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 = [:] diff --git a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy index b5808229..9783fb8a 100644 --- a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy @@ -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})