From fba1c3e5a4f6413d728b416b8ecfdb8f4a24be0d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 4 May 2011 22:17:35 -0500 Subject: [PATCH] Implement #5 #6 Swing client open attachment bug on linux - thanks to bma99 http://hg.idempiere.com/idempiere/issue/6 https://sourceforge.net/projects/adempiere/forums/forum/610548/topic/4409004 --- .../src/org/compiere/apps/Attachment.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/Attachment.java b/org.adempiere.ui.swing/src/org/compiere/apps/Attachment.java index f534f109b8..084769fa82 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/Attachment.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/Attachment.java @@ -17,6 +17,7 @@ package org.compiere.apps; import java.awt.BorderLayout; +import java.awt.Desktop; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Frame; @@ -28,6 +29,7 @@ import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; +import java.io.IOException; import java.util.logging.Level; import javax.swing.JFileChooser; @@ -554,8 +556,19 @@ public final class Attachment extends CDialog // p.waitFor(); return true; } - else // other OS + else // other OS. originally nothing here. add the following codes { + try { + Desktop desktop = null; + if (Desktop.isDesktopSupported()) { + desktop = Desktop.getDesktop(); + File file = new File(tempFile.getAbsolutePath()); + desktop.open(file); + return true; + } + } catch (IOException e) { + e.printStackTrace(); + } } } catch (Exception e)