copy collection hash from wizard

pull/53/head
Zlatin Balevsky 2020-11-02 01:11:15 +00:00
parent dd622b1c0d
commit a082dc2dfd
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 13 additions and 0 deletions

View File

@ -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))

View File

@ -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)
}
}