Author: kmorin Date: 2014-04-18 15:48:06 +0200 (Fri, 18 Apr 2014) New Revision: 37 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/37 Log: refs #4667 [ECRAN] R?\195?\169pondre Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-04-17 17:27:05 UTC (rev 36) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-04-18 13:48:06 UTC (rev 37) @@ -1,16 +1,31 @@ package com.franciaflex.faxtomail.ui.swing.content.demande.replies; +import com.franciaflex.faxtomail.persistence.entities.Attachment; +import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.Reply; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; +import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; +import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel; import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler; import com.google.common.collect.Iterables; import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.commons.mail.MultiPartEmail; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.HighlighterFactory; +import javax.activation.DataHandler; +import javax.activation.DataSource; +import javax.mail.BodyPart; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Part; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; import javax.swing.*; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; @@ -24,7 +39,12 @@ import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import static org.nuiton.i18n.I18n.t; + /** * @author Kevin Morin (Code Lutin) * @since x.x @@ -115,11 +135,86 @@ public void openReply(Reply reply) { closeEditor(); + try { + ReplyFormUI dialogContent = new ReplyFormUI(ui); + Message message = new MimeMessage(null, new ByteArrayInputStream(reply.getEmailSource().getBytes())); + ReplyFormUIModel replyModel = dialogContent.getModel(); + replyModel.setReadonly(true); + replyModel.setSubject(message.getSubject()); + replyModel.setTo(message.getAllRecipients()[0].toString()); + replyModel.setFrom(message.getFrom()[0].toString()); + + if (message.isMimeType("multipart/*")) { + decomposeMultipartEmail(message, replyModel, reply.getTopiaId()); + + } else { + String content = IOUtils.toString(message.getInputStream()); + replyModel.setMessage(content); + } + + openFrame(dialogContent, t("faxtomail.reply.title", getModel().getSubject()), new Dimension(800, 600)); + + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("", e); + } + } + // FaxToMailUIContext context = getContext(); // context.setCurrentEmail(demande); // context.getActionEngine().runAction(new ShowDemandeAction(context.getMainUI().getHandler())); } + /** + * Decompose a multipart part. + * - sets the email content if the part contains a text bodypart + * - adds attachments to the email + * + * @param part the part to decompose + * @throws Exception + */ + protected void decomposeMultipartEmail(Part part, ReplyFormUIModel reply, String topiaId) throws Exception { + DataSource dataSource = part.getDataHandler().getDataSource(); + MimeMultipart mimeMultipart = new MimeMultipart(dataSource); + int multiPartCount = mimeMultipart.getCount(); + + for (int j = 0; j < multiPartCount; j++) { + BodyPart bp = mimeMultipart.getBodyPart(j); + + // if it is a text part, the,n this is the email content + if (bp.isMimeType("text/*")) { + String content = IOUtils.toString(bp.getInputStream()); + reply.setMessage(content); + + // if it is multipart part, decompose it + } else if (bp.isMimeType("multipart/*")) { + decomposeMultipartEmail(bp, reply, topiaId); + + // else, this is an attachment + } else { + String fileName = bp.getFileName(); + if (fileName == null) { + fileName = bp.getHeader("Content-ID")[0]; + // remove the guillemets between the id + fileName = fileName.replaceFirst("^<(.*)>$", "$1"); + } + log.debug("FileName : " + fileName); + + File dir = new File(FileUtils.getTempDirectory(), topiaId); + if (!dir.exists()) { + dir.mkdir(); + } + File file = new File(dir, fileName); + FileOutputStream fos = new FileOutputStream(file); + + DataHandler dh = bp.getDataHandler(); + dh.writeTo(fos); + + reply.addAttachment(file); + } + } + } + protected class DemandReplyItemRenderer extends DemandReplyItem implements TableCellRenderer { Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css 2014-04-17 17:27:05 UTC (rev 36) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css 2014-04-18 13:48:06 UTC (rev 37) @@ -3,14 +3,25 @@ } #attachmentNameLabel { - text: { attachment != null ? getAttachment().getName() : null }; + actionIcon: "attachment"; + text: { t("faxtomail.reply.attachment.label", getAttachment().getName(), getAttachment().length() / 1024) }; border: { BorderFactory.createEmptyBorder(3, 3, 3, 3) }; } + +#toolbar { + borderPainted: false; + floatable: false; +} + #openAttachmentButton { - actionIcon: "cross"; - opaque: false; - border: { BorderFactory.createEmptyBorder(3, 3, 3, 3) }; - borderPainted: false; - contentAreaFilled: false; -} \ No newline at end of file + actionIcon: "open-file"; + toolTipText: "faxtomail.attachmentEditor.action.open.tip"; +} + +#removeAttachmentButton { + actionIcon: "delete"; + toolTipText: "faxtomail.attachmentEditor.action.remove.tip"; + visible: { !getHandler().getModel().isReadonly() }; +} + Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx 2014-04-17 17:27:05 UTC (rev 36) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx 2014-04-18 13:48:06 UTC (rev 37) @@ -17,8 +17,11 @@ <JLabel id='attachmentNameLabel' constraints='BorderLayout.CENTER'/> - <JButton id='openAttachmentButton' - constraints='BorderLayout.EAST' - onActionPerformed='handler.removeAttachment(this)'/> + <JToolBar id='toolbar' constraints='BorderLayout.EAST'> + <JButton id='openAttachmentButton' + onActionPerformed='handler.openAttachment(attachment)'/> + <JButton id='removeAttachmentButton' + onActionPerformed='handler.removeAttachment(attachment)'/> + </JToolBar> </JPanel> \ No newline at end of file Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-04-17 17:27:05 UTC (rev 36) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-04-18 13:48:06 UTC (rev 37) @@ -2,8 +2,13 @@ text: "faxtomail.reply.label.from"; } +#fromPanelLayout { + selected: { String.valueOf(model.isReadonly()) }; +} + #fromField { text: { model.getFrom() }; + editable: false; } #fromComboBox { @@ -17,14 +22,16 @@ #toField { text: { model.getTo() }; + editable: { !model.isReadonly() }; } #subjectLabel { text: "faxtomail.reply.label.subject"; } -#objectField { - text: { model.getObject() }; +#subjectField { + text: { model.getSubject() }; + editable: { !model.isReadonly() }; } #splitPane { @@ -33,6 +40,7 @@ #message { text: { model.getMessage() }; + editable: { !model.isReadonly() }; } #attachmentsPanel { @@ -40,11 +48,18 @@ } #attachmentsLabel { - text: "faxtomail.attachmentEditor.title"; + text: { t("faxtomail.reply.attachments.title", + getModel().getTotalAttachmentLength(), + getModel().getMaxAttachmentLength()) }; + foreground: { getModel().isValid() ? Color.BLACK : Color.RED } } +#addAttachmentForm { + visible: { !model.isReadonly() }; +} + #addAttachmentLabel { - text: "faxtomail.attachmentEditor.field.file"; + text: "faxtomail.reply.attachments.add.label"; } #addAttachmentFile { @@ -59,6 +74,16 @@ actionIcon: "add"; } +#buttonPanelLayout { + selected: { String.valueOf(model.isReadonly()) }; +} + +#closeButton { + actionIcon: cancel; + text: "faxtomail.reply.action.close"; + toolTipText: "faxtomail.reply.action.close.tip"; +} + #cancelButton { actionIcon: cancel; text: "faxtomail.reply.action.cancel"; @@ -70,4 +95,5 @@ text: "faxtomail.reply.action.validate"; toolTipText: "faxtomail.reply.action.validate.tip"; _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ReplyAction.class }; + enabled: { getModel().isValid() }; } \ No newline at end of file Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-04-17 17:27:05 UTC (rev 36) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-04-18 13:48:06 UTC (rev 37) @@ -23,25 +23,17 @@ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<ReplyFormUIModel, ReplyFormUIHandler>'> <import> - com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - com.franciaflex.faxtomail.ui.swing.content.attachment.ButtonAttachment - com.franciaflex.faxtomail.persistence.entities.Email - com.franciaflex.faxtomail.persistence.entities.DemandType - com.franciaflex.faxtomail.persistence.entities.DemandStatus - com.franciaflex.faxtomail.persistence.entities.Range - com.franciaflex.faxtomail.persistence.entities.Priority - - java.text.SimpleDateFormat - java.util.Date - + java.awt.CardLayout java.awt.Color - jaxx.runtime.swing.editor.FileEditor + jaxx.runtime.swing.CardLayout2Ext org.jdesktop.swingx.WrapLayout + + static org.nuiton.i18n.I18n.t </import> <script><![CDATA[ @@ -55,6 +47,12 @@ <ReplyFormUIModel id='model' initializer='getContextValue(ReplyFormUIModel.class)'/> + <CardLayout2Ext id='fromPanelLayout' + constructorParams='this, "fromPanel"'/> + + <CardLayout2Ext id='buttonPanelLayout' + constructorParams='this, "buttonPanel"'/> + <Table constraints='BorderLayout.NORTH' fill='both'> <row> @@ -62,10 +60,14 @@ <JLabel id="fromLabel"/> </cell> <cell weightx='1'> - <!--<JTextField id="fromField"--> - <!--onKeyReleased='handler.setText(event, "from")'/>--> - <JComboBox id="fromComboBox" - onItemStateChanged='handler.setText(event, "from")'/> + <JPanel id="fromPanel" + layout="{ fromPanelLayout }"> + <JTextField id="fromField" + constraints='"true"'/> + <JComboBox id="fromComboBox" + onItemStateChanged='handler.setText(event, "from")' + constraints='"false"'/> + </JPanel> </cell> </row> <row> @@ -103,6 +105,7 @@ <JPanel id="attachmentsPanel" layout="{new WrapLayout(WrapLayout.LEFT)}"/> </JScrollPane> <Table fill="both" + id="addAttachmentForm" constraints='BorderLayout.SOUTH'> <row> <cell> @@ -125,9 +128,18 @@ </JPanel> </JSplitPane> - <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='validateButton'/> + <JPanel id="buttonPanel" + layout="{ buttonPanelLayout }" + constraints='BorderLayout.SOUTH'> + <JPanel constraints='"true"' + layout='{new GridLayout(1, 0)}'> + <JButton id='closeButton' onActionPerformed='handler.cancel()'/> + </JPanel> + <JPanel constraints='"false"' + layout='{new GridLayout(1, 0)}'> + <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> + <JButton id='validateButton'/> + </JPanel> </JPanel> </JPanel> \ No newline at end of file Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-04-17 17:27:05 UTC (rev 36) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-04-18 13:48:06 UTC (rev 37) @@ -5,6 +5,7 @@ import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; import com.franciaflex.faxtomail.ui.swing.util.Cancelable; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; import com.google.common.collect.Lists; import jaxx.runtime.JAXXUtil; import jaxx.runtime.swing.editor.FileEditor; @@ -21,7 +22,10 @@ import java.awt.*; import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.io.File; +import java.io.IOException; import java.io.Serializable; import java.lang.reflect.Method; import java.util.Collection; @@ -43,6 +47,7 @@ super.beforeInit(ui); ReplyFormUIModel model = new ReplyFormUIModel(); + model.setMaxAttachmentLength(10485760); DemandeUIModel currentEmail = getContext().getCurrentEmail(); model.setOriginalDemand(currentEmail); @@ -66,6 +71,20 @@ plainContent.replaceAll("\n", "\n> ")); model.setMessage(quotedReply); + model.addPropertyChangeListener(ReplyFormUIModel.PROPERTY_ATTACHMENT, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + updateAttachmentPanel((Collection<File>) evt.getNewValue()); + } + }); + + model.addPropertyChangeListener(ReplyFormUIModel.PROPERTY_READONLY, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + updateAttachmentPanel(getModel().getAttachments()); + } + }); + this.ui.setContextValue(model); } @@ -119,15 +138,11 @@ return getUI().getMessage(); } - public void removeAttachment(AttachmentItem item) { + public void removeAttachment(File attachment) { ReplyFormUIModel model = getModel(); - File attachment = item.getAttachment(); model.removeAttachment(attachment); - ui.getAttachmentsPanel().remove(item); - ui.getAttachmentsPanel().updateUI(); - model.addAvailableAttachment(attachment); ui.getAddAttachmentFile().addItem(attachment); } @@ -139,13 +154,6 @@ ReplyFormUIModel model = getModel(); model.addAttachment(file); - AttachmentItem item = new AttachmentItem(); - item.setHandler(this); - item.setAttachment(file); - ui.getAttachmentsPanel().add(item); - - ui.getAttachmentsPanel().updateUI(); - model.removeAvailableAttachment(file); ui.getAddAttachmentFile().removeItem(file); @@ -153,6 +161,18 @@ } } + protected void updateAttachmentPanel(Collection<File> attachments) { + JPanel attachmentsPanel = ui.getAttachmentsPanel(); + attachmentsPanel.removeAll(); + for (File attachment : attachments) { + AttachmentItem item = new AttachmentItem(); + item.setHandler(this); + item.setAttachment(attachment); + attachmentsPanel.add(item); + } + attachmentsPanel.updateUI(); + } + public void openLocation() { // use last selected file ReplyFormUIModel model = getModel(); @@ -177,6 +197,17 @@ } } + public void openAttachment(File attachment) { + Desktop desktop = FaxToMailUIUtil.getDesktopForBrowse(); + try { +// desktop.browse(file.toURI()); + desktop.open(attachment); + + } catch (IOException e) { + getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file")); + } + } + protected class FileComboBoxEditor implements ComboBoxEditor { protected File oldValue; Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-04-17 17:27:05 UTC (rev 36) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-04-18 13:48:06 UTC (rev 37) @@ -9,7 +9,9 @@ import java.io.File; import java.util.ArrayList; import java.util.Collection; +import java.util.HashSet; import java.util.List; +import java.util.Set; /** * @author Kevin Morin (Code Lutin) @@ -22,15 +24,24 @@ public static final String PROPERTY_SUBJECT = "subject"; public static final String PROPERTY_MESSAGE = "message"; public static final String PROPERTY_ORIGINAL_DEMAND = "originalDemand"; + public static final String PROPERTY_ATTACHMENT = "attachment"; + public static final String PROPERTY_READONLY = "readonly"; + public static final String PROPERTY_MAX_ATTACHMENT_LENGHT = "maxAttachmentLength"; + public static final String PROPERTY_TOTAL_ATTACHMENT_LENGHT = "totalAttachmentLength"; + public static final String PROPERTY_VALID = "valid"; protected String to; protected String from; protected String subject; protected String message; protected DemandeUIModel originalDemand; + protected long maxAttachmentLength = 0; + protected long totalAttachmentLength = 0; + protected boolean valid = true; + protected boolean readonly = false; - protected List<File> attachments = new ArrayList<File>(); - protected List<File> availableAttachments = new ArrayList<File>(); + protected Set<File> attachments = new HashSet<File>(); + protected Set<File> availableAttachments = new HashSet<File>(); protected File lastVisitedDirectory = FileUtils.getUserDirectory(); @@ -84,19 +95,33 @@ firePropertyChange(PROPERTY_ORIGINAL_DEMAND, oldValue, originalDemand); } - public Collection<File> getAttachments() { + public Set<File> getAttachments() { return attachments; } public void addAttachment(File attachment) { attachments.add(attachment); + firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachments()); + + Object oldValue = getTotalAttachmentLength(); + totalAttachmentLength += attachment.length(); + firePropertyChange(PROPERTY_TOTAL_ATTACHMENT_LENGHT, oldValue, getTotalAttachmentLength()); + + recomputeValidity(); } public void removeAttachment(File attachment) { attachments.remove(attachment); + firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachments()); + + Object oldValue = getTotalAttachmentLength(); + totalAttachmentLength -= attachment.length(); + firePropertyChange(PROPERTY_TOTAL_ATTACHMENT_LENGHT, oldValue, getTotalAttachmentLength()); + + recomputeValidity(); } - public List<File> getAvailableAttachments() { + public Set<File> getAvailableAttachments() { return availableAttachments; } @@ -115,4 +140,40 @@ public void setLastVisitedDirectory(File lastVisitedDirectory) { this.lastVisitedDirectory = lastVisitedDirectory; } + + public boolean isReadonly() { + return readonly; + } + + public void setReadonly(boolean readonly) { + Object oldValue = isReadonly(); + this.readonly = readonly; + firePropertyChange(PROPERTY_READONLY, oldValue, readonly); + } + + public long getMaxAttachmentLength() { + return maxAttachmentLength / 1024; + } + + public void setMaxAttachmentLength(long maxAttachmentLength) { + Object oldValue = getMaxAttachmentLength(); + this.maxAttachmentLength = maxAttachmentLength; + firePropertyChange(PROPERTY_MAX_ATTACHMENT_LENGHT, oldValue, maxAttachmentLength); + + recomputeValidity(); + } + + public long getTotalAttachmentLength() { + return totalAttachmentLength / 1024; + } + + public boolean isValid() { + return valid; + } + + public void recomputeValidity() { + Object oldValue = isValid(); + this.valid = totalAttachmentLength < maxAttachmentLength; + firePropertyChange(PROPERTY_VALID, oldValue, valid); + } } Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-17 17:27:05 UTC (rev 36) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-18 13:48:06 UTC (rev 37) @@ -315,10 +315,13 @@ faxtomail.reply.action.cancel= faxtomail.reply.action.cancel.mnemonic= faxtomail.reply.action.cancel.tip= +faxtomail.reply.action.close= +faxtomail.reply.action.close.tip= faxtomail.reply.action.validate= faxtomail.reply.action.validate.mnemonic= faxtomail.reply.action.validate.tip= faxtomail.reply.attachment= +faxtomail.reply.attachments.add.label= faxtomail.reply.from= faxtomail.reply.label.attachment= faxtomail.reply.label.from= Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-17 17:27:05 UTC (rev 36) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-18 13:48:06 UTC (rev 37) @@ -184,9 +184,13 @@ faxtomail.rangeRows.table.header.savQuantity.tip=Quantité de SAV faxtomail.reply.action.cancel=Annuler faxtomail.reply.action.cancel.tip=Annuler et fermer la popup +faxtomail.reply.action.close=Fermer +faxtomail.reply.action.close.tip=Fermer faxtomail.reply.action.validate=Valider faxtomail.reply.action.validate.tip=Valider et répondre au mail -faxtomail.reply.label.attachment=Ajouter des pièces jointes +faxtomail.reply.attachment.label=%1$s (%2$s ko) +faxtomail.reply.attachments.add.label=Ajouter des pièces jointes +faxtomail.reply.attachments.title=Pièces-jointes (%1$s / %2$s ko autorisés) faxtomail.reply.label.from=De \: faxtomail.reply.label.subject=Objet \: faxtomail.reply.label.to=À \: Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java =================================================================== --- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-04-17 17:27:05 UTC (rev 36) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-04-18 13:48:06 UTC (rev 37) @@ -257,7 +257,11 @@ } else { String fileName = bp.getFileName(); if (fileName == null) { - fileName = bp.getHeader("Content-ID")[0]; + String[] headers = bp.getHeader("Content-ID"); + if (headers == null) { + break; + } + fileName = headers[0]; // remove the guillemets between the id fileName = fileName.replaceFirst("^<(.*)>$", "$1"); }