diff options
4 files changed, 58 insertions, 69 deletions
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/MimeTypes.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/MimeTypes.java index 17316602..6984c47a 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/MimeTypes.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/MimeTypes.java @@ -36,27 +36,43 @@ public class MimeTypes { private static final Map<String , String> FILE_EXTENSIONS = new HashMap<String, String>() { private static final long serialVersionUID = 1L; -{ - put("application/msword", ".doc"); - put("application/octet-stream", ".bin"); - put("application/pdf", ".pdf"); - put("application/xhtml+xml", ".xhtml"); - put("text/html", ".html"); - put("text/plain", ".txt"); - put("text/xml", ".xml"); - }}; + { + put("application/gzip", ".gz"); + put("application/msword", ".doc"); + put("application/octet-stream", ".bin"); + put("application/pdf", ".pdf"); + put("application/vnd.openxmlformats-officedocument.wordprocessingml.document", ".docx"); + put("application/xhtml+xml", ".xhtml"); + put("application/xml", ".xml"); + put("application/zip", ".zip"); + put("image/gif", ".gif"); + put("image/jpeg", ".jpg"); + put("image/png", ".png"); + put("text/html", ".html"); + put("text/plain", ".txt"); + put("text/xml", ".xml"); + } + }; private static final Map<String , String> DESCRIPTIONS = new HashMap<String, String>() { private static final long serialVersionUID = 1L; -{ - put("application/msword", "mimetype.desc.doc"); - put("application/octet-stream", "mimetype.desc.bin"); - put("application/pdf", "mimetype.desc.pdf"); - put("application/xhtml+xml", "mimetype.desc.xhtml"); - put("text/html", "mimetype.desc.html"); - put("text/plain", "mimetype.desc.txt"); - put("text/xml", "mimetype.desc.xml"); - }}; + { + put("application/gzip", "mimetype.desc.gz"); + put("application/msword", "mimetype.desc.doc"); + put("application/octet-stream", "mimetype.desc.bin"); + put("application/pdf", "mimetype.desc.pdf"); + put("application/vnd.openxmlformats-officedocument.wordprocessingml.document", "mimetype.desc.docx"); + put("application/xhtml+xml", "mimetype.desc.xhtml"); + put("application/xml", "mimetype.desc.xml"); + put("application/zip", "mimetype.desc.zip"); + put("image/gif", "mimetype.desc.gif"); + put("image/jpeg", "mimetype.desc.jpg"); + put("image/png", "mimetype.desc.png"); + put("text/html", "mimetype.desc.html"); + put("text/plain", "mimetype.desc.txt"); + put("text/xml", "mimetype.desc.xml"); + } + }; public static String getExtension(String mimetype) { if (FILE_EXTENSIONS.containsKey(mimetype)) { diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index b406c36e..434798ee 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -69,13 +69,19 @@ button.back=Back button.sign=Sign button.save=Save... button.close=Close -mimetype.desc.xml=XML-files (.xml) -mimetype.desc.html=HTML-files (.html, .htm) -mimetype.desc.xhtml=XHTML-files (.xhtml) -mimetype.desc.txt=Textfiles (.txt) -mimetype.desc.pdf=Adobe PDF-files (.pdf) +mimetype.desc.gz=Gzip files (.gz) +mimetype.desc.doc=Microsoft Word files (.doc) mimetype.desc.bin=Binary files (.bin) -mimetype.desc.doc=Microsoft Word-files (.doc) +mimetype.desc.pdf=Adobe PDF files (.pdf) +mimetype.desc.docx=Microsoft Word 2007 files (.docx) +mimetype.desc.xhtml=XHTML files (.xhtml) +mimetype.desc.xml=XML files (.xml) +mimetype.desc.zip=ZIP files (.zip) +mimetype.desc.gif=GIF image files (.gif) +mimetype.desc.jpg=JPEG image files (.jpg, .jpeg) +mimetype.desc.png=PNG image files (.png) +mimetype.desc.html=HTML files (.html, .htm) +mimetype.desc.txt=Text files (.txt) mimetype.desc.unknown=All files (.*) save.hashdatainput.prefix=signaturedata alt.help=help diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties index b6d7d22a..72da80ce 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties @@ -71,13 +71,19 @@ button.back=Zur\u00fcck button.sign=Signieren button.save=Speichern... button.close=Schlie\u00dfen +mimetype.desc.gz=Gzip-Dateien (.gz) +mimetype.desc.doc=Microsoft Word-Dateien (.doc) +mimetype.desc.bin=Bin\u00e4rdateien (.bin) +mimetype.desc.pdf=Adobe PDF-Dateien (.pdf) +mimetype.desc.docx=Microsoft Word 2007-Dateien (.doc) +mimetype.desc.xhtml=XHTML-Dateien (.xhtml) mimetype.desc.xml=XML-Dateien (.xml) +mimetype.desc.zip=ZIP-Dateien (.zip) +mimetype.desc.gif=GIF-Bilddateien (.gif) +mimetype.desc.jpg=JPEG-Bilddateien (.jpg, .jpeg) +mimetype.desc.png=PNG-Bilddateien (.png) mimetype.desc.html=HTML-Dateien (.html, .htm) -mimetype.desc.xhtml=XHTML-Dateien (.xhtml) mimetype.desc.txt=Textdateien (.txt) -mimetype.desc.pdf=Adobe PDF-Dateien (.pdf) -mimetype.desc.bin=Bin\u00e4rdateien (.bin) -mimetype.desc.doc=Microsoft Word-Dateien (.doc) mimetype.desc.unknown=Alle Dateien (.*) save.hashdatainput.prefix=Signaturdaten alt.help=Hilfe diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java index e596e5c8..e51c5823 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java @@ -27,6 +27,7 @@ package at.gv.egiz.bku.slcommands.impl.cms; import java.io.ByteArrayInputStream; import java.io.InputStream; +import at.gv.egiz.bku.gui.viewer.MimeTypes; import at.gv.egiz.stal.HashDataInput; public class CMSHashDataInput implements HashDataInput { @@ -58,51 +59,11 @@ public class CMSHashDataInput implements HashDataInput { @Override public String getFilename() { - String fileName = DEFAULT_FILENAME; - String extension = getExtensionForMimeType(mimeType); - if (extension != null) - fileName += extension; - return fileName; + return DEFAULT_FILENAME + MimeTypes.getExtension(mimeType); } @Override public InputStream getHashDataInput() { return new ByteArrayInputStream(data); } - private static String getExtensionForMimeType(String mimeType) { - if (mimeType.equalsIgnoreCase("application/pdf")) { - return ".pdf"; - } - else if (mimeType.equalsIgnoreCase("text/plain")) { - return ".txt"; - } - else if (mimeType.equalsIgnoreCase("text/xml")) { - return ".xml"; - } - else if (mimeType.equalsIgnoreCase("text/html")) { - return ".html"; - } - else if (mimeType.equalsIgnoreCase("application/xml")) { - return ".xml"; - } - else if (mimeType.equalsIgnoreCase("application/xhtml+xml")) { - return ".html"; - } - else if (mimeType.equalsIgnoreCase("application/zip")) { - return ".zip"; - } - else if (mimeType.equalsIgnoreCase("application/gzip")) { - return ".gz"; - } - else if (mimeType.equalsIgnoreCase("image/gif")) { - return ".gif"; - } - else if (mimeType.equalsIgnoreCase("image/jpeg")) { - return ".jpg"; - } - else if (mimeType.equalsIgnoreCase("image/png")) { - return ".png"; - } - return null; - } } |