mirror of https://github.com/zlatinb/muwire
copy hash from collection tool
parent
a082dc2dfd
commit
a9ea0de16c
|
@ -6,6 +6,9 @@ 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 com.muwire.core.SharedFile
|
||||
|
@ -62,4 +65,17 @@ class CollectionsToolController {
|
|||
params['text'] = DataUtil.readi18nString(Base64.decode(sf.getComment()))
|
||||
mvcGroup.createMVCGroup("show-comment", params)
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void copyHash() {
|
||||
int row = view.selectedCollectionRow()
|
||||
if (row < 0)
|
||||
return
|
||||
FileCollection collection = model.collections.get(row)
|
||||
|
||||
String b64 = Base64.encode(collection.getInfoHash().getRoot())
|
||||
StringSelection selection = new StringSelection(b64)
|
||||
def clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
|
||||
clipboard.setContents(selection, null)
|
||||
}
|
||||
}
|
|
@ -69,6 +69,7 @@ class CollectionsToolView {
|
|||
}
|
||||
panel(constraints : BorderLayout.SOUTH) {
|
||||
button(text : trans("VIEW_COMMENT"), enabled : bind {model.viewCommentButtonEnabled}, viewCommentAction)
|
||||
button(text : trans("COPY_HASH_TO_CLIPBOARD"), enabled : bind {model.deleteButtonEnabled}, copyHashAction)
|
||||
button(text : trans("DELETE"), enabled : bind {model.deleteButtonEnabled}, deleteAction)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue