mirror of https://github.com/zlatinb/muwire
copy collection hash from wizard
parent
dd622b1c0d
commit
a082dc2dfd
|
@ -4,6 +4,10 @@ import griffon.core.artifact.GriffonController
|
|||
import griffon.core.controller.ControllerAction
|
||||
import griffon.inject.MVCMember
|
||||
import griffon.metadata.ArtifactProviderFor
|
||||
import net.i2p.data.Base64
|
||||
|
||||
import java.awt.Toolkit
|
||||
import java.awt.datatransfer.StringSelection
|
||||
|
||||
import javax.annotation.Nonnull
|
||||
import javax.swing.tree.DefaultMutableTreeNode
|
||||
|
@ -61,6 +65,14 @@ class CollectionWizardController {
|
|||
view.switchToConfiguration()
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void copyHash() {
|
||||
String b64 = Base64.encode(model.collection.getInfoHash().getRoot())
|
||||
StringSelection selection = new StringSelection(b64)
|
||||
def clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
|
||||
clipboard.setContents(selection, null)
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void save() {
|
||||
model.eventBus.publish(new UICollectionCreatedEvent(collection : model.collection))
|
||||
|
|
|
@ -89,6 +89,7 @@ class CollectionWizardView {
|
|||
panel(constraints : BorderLayout.SOUTH) {
|
||||
button(text : trans("CANCEL"), cancelAction)
|
||||
button(text : trans("PREVIOUS"), previousAction)
|
||||
button(text : trans("COPY_HASH_TO_CLIPBOARD"), copyHashAction)
|
||||
button(text : trans("SAVE"), saveAction)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue