diff --git a/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy b/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy index 1b9286f7..0f551e5a 100644 --- a/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy +++ b/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy @@ -11,6 +11,7 @@ import net.i2p.crypto.DSAEngine import net.i2p.data.Base64 import net.i2p.data.Signature +import java.awt.Desktop import java.awt.event.ActionEvent import java.nio.charset.StandardCharsets @@ -383,7 +384,7 @@ class MainFrameController { @ControllerAction void showFileDetails() { def selected = view.selectedSharedFiles() - if (selected.size() != 1) { + if (selected == null || selected.size() != 1) { JOptionPane.showMessageDialog(null, "Please select only one file to view it's details") return } @@ -392,6 +393,19 @@ class MainFrameController { params['core'] = core mvcGroup.createMVCGroup("shared-file", params) } + + @ControllerAction + void openContainingFolder() { + def selected = view.selectedSharedFiles() + if (selected == null || selected.size() != 1) { + JOptionPane.showMessageDialog(null, "Please select only one file to open it's containing folder") + return + } + + try { + Desktop.getDesktop().open(selected[0].file.getParentFile()) + } catch (Exception ignored) {} + } void saveMuWireSettings() { core.saveMuSettings() diff --git a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy index a456d2d1..d9ad5d40 100644 --- a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy @@ -608,6 +608,9 @@ class MainFrameView { JMenuItem certifySelectedFiles = new JMenuItem("Certify selected files") certifySelectedFiles.addActionListener({mvcGroup.controller.issueCertificate()}) sharedFilesMenu.add(certifySelectedFiles) + JMenuItem openContainingFolder = new JMenuItem("Open containing folder") + openContainingFolder.addActionListener({mvcGroup.controller.openContainingFolder()}) + sharedFilesMenu.add(openContainingFolder) JMenuItem showFileDetails = new JMenuItem("Show file details") showFileDetails.addActionListener({mvcGroup.controller.showFileDetails()}) sharedFilesMenu.add(showFileDetails)