From ddf9669ff0e04f2cd70b02b3c4dab5c404a65e3d Mon Sep 17 00:00:00 2001 From: j-dimension Date: Tue, 26 Nov 2024 23:13:04 +0100 Subject: [PATCH] option to specify pre-signature and post-signature body for emails. close #2590 --- .../cloud/ShareDocumentsToCloudAction.java | 2 +- .../jlawyer/client/mail/EmailInboxPanel.java | 12 +++++----- .../jlawyer/client/mail/EmailUtils.java | 12 +++++----- .../jlawyer/client/mail/SendEmailDialog.java | 6 ++--- .../jlawyer/client/mail/ViewEmailDialog.java | 24 +++++++++---------- .../jlawyer/client/utils/BugReportDialog.java | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/cloud/ShareDocumentsToCloudAction.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/cloud/ShareDocumentsToCloudAction.java index 90f947b74..184eb6223 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/cloud/ShareDocumentsToCloudAction.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/cloud/ShareDocumentsToCloudAction.java @@ -805,7 +805,7 @@ public boolean execute() throws Exception { SendEmailDialog dlg = new SendEmailDialog(false, EditorsRegistry.getInstance().getMainWindow(), false); // make share link available for use via placeholder {{CLOUD_LINK}} dlg.setCloudLink(share.getUrl()); - dlg.setBody("Freigabelink: " + share.getUrl(), ContentTypes.TEXT_PLAIN); + dlg.setBody("Freigabelink: " + share.getUrl(), "", ContentTypes.TEXT_PLAIN); if (caseDto != null) { dlg.setArchiveFile(caseDto, null); } diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/EmailInboxPanel.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/EmailInboxPanel.java index 4441e5cab..a42eacaf9 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/EmailInboxPanel.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/EmailInboxPanel.java @@ -2169,11 +2169,11 @@ private void cmdForwardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI String contentType = this.mailContentUI.getContentType(); dlg.setContentType(contentType); if (contentType.toLowerCase().startsWith(ContentTypes.TEXT_HTML)) { - dlg.setBody(EmailUtils.getQuotedBody(EmailUtils.html2Text(this.mailContentUI.getBody()), ContentTypes.TEXT_PLAIN, decodedFrom, m.getSentDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(EmailUtils.html2Text(this.mailContentUI.getBody()), ContentTypes.TEXT_PLAIN, decodedFrom, m.getSentDate()), ContentTypes.TEXT_PLAIN); } else { - dlg.setBody(EmailUtils.getQuotedBody(this.mailContentUI.getBody(), ContentTypes.TEXT_PLAIN, decodedFrom, m.getSentDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(this.mailContentUI.getBody(), ContentTypes.TEXT_PLAIN, decodedFrom, m.getSentDate()), ContentTypes.TEXT_PLAIN); } - dlg.setBody(EmailUtils.getQuotedBody(this.mailContentUI.getBody(), ContentTypes.TEXT_HTML, decodedFrom, m.getSentDate()), ContentTypes.TEXT_HTML); + dlg.setBody("", EmailUtils.getQuotedBody(this.mailContentUI.getBody(), ContentTypes.TEXT_HTML, decodedFrom, m.getSentDate()), ContentTypes.TEXT_HTML); try { // try forwarding attachments @@ -2272,11 +2272,11 @@ private void cmdReplyAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F String contentType = this.mailContentUI.getContentType(); dlg.setContentType(contentType); if (contentType.toLowerCase().startsWith(ContentTypes.TEXT_HTML)) { - dlg.setBody(EmailUtils.getQuotedBody(EmailUtils.html2Text(this.mailContentUI.getBody()), ContentTypes.TEXT_PLAIN, decodedTo, origM.getSentDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(EmailUtils.html2Text(this.mailContentUI.getBody()), ContentTypes.TEXT_PLAIN, decodedTo, origM.getSentDate()), ContentTypes.TEXT_PLAIN); } else { - dlg.setBody(EmailUtils.getQuotedBody(this.mailContentUI.getBody(), ContentTypes.TEXT_PLAIN, decodedTo, origM.getSentDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(this.mailContentUI.getBody(), ContentTypes.TEXT_PLAIN, decodedTo, origM.getSentDate()), ContentTypes.TEXT_PLAIN); } - dlg.setBody(EmailUtils.getQuotedBody(this.mailContentUI.getBody(), ContentTypes.TEXT_HTML, decodedTo, origM.getSentDate()), ContentTypes.TEXT_HTML); + dlg.setBody("", EmailUtils.getQuotedBody(this.mailContentUI.getBody(), ContentTypes.TEXT_HTML, decodedTo, origM.getSentDate()), ContentTypes.TEXT_HTML); } catch (Exception ex) { log.error(ex); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/EmailUtils.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/EmailUtils.java index b59cdea69..f3a8994f2 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/EmailUtils.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/EmailUtils.java @@ -1274,11 +1274,11 @@ public static SendEmailDialog reply(OutlookMessage m, String prependContent, Str prependContent=prependContent + System.lineSeparator() + System.lineSeparator(); if (contentType.toLowerCase().startsWith(ContentTypes.TEXT_HTML)) { - dlg.setBody(prependContent + EmailUtils.getQuotedBody(EmailUtils.html2Text(content), ContentTypes.TEXT_PLAIN, decodedTo, m.getDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody(prependContent, EmailUtils.getQuotedBody(EmailUtils.html2Text(content), ContentTypes.TEXT_PLAIN, decodedTo, m.getDate()), ContentTypes.TEXT_PLAIN); } else { - dlg.setBody(prependContent + EmailUtils.getQuotedBody(content, ContentTypes.TEXT_PLAIN, decodedTo, m.getDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody(prependContent, EmailUtils.getQuotedBody(content, ContentTypes.TEXT_PLAIN, decodedTo, m.getDate()), ContentTypes.TEXT_PLAIN); } - dlg.setBody(prependContent + EmailUtils.getQuotedBody(content, ContentTypes.TEXT_HTML, decodedTo, m.getDate()), ContentTypes.TEXT_HTML); + dlg.setBody(prependContent, EmailUtils.getQuotedBody(content, ContentTypes.TEXT_HTML, decodedTo, m.getDate()), ContentTypes.TEXT_HTML); } catch (Exception ex) { log.error(ex); @@ -1358,11 +1358,11 @@ public static SendEmailDialog reply(Message m, String prependContent, String con prependContent=prependContent + System.lineSeparator() + System.lineSeparator(); if (contentType.toLowerCase().startsWith(ContentTypes.TEXT_HTML)) { - dlg.setBody(prependContent + EmailUtils.getQuotedBody(EmailUtils.html2Text(content), ContentTypes.TEXT_PLAIN, decodedTo, m.getSentDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody(prependContent, EmailUtils.getQuotedBody(EmailUtils.html2Text(content), ContentTypes.TEXT_PLAIN, decodedTo, m.getSentDate()), ContentTypes.TEXT_PLAIN); } else { - dlg.setBody(prependContent + EmailUtils.getQuotedBody(content, ContentTypes.TEXT_PLAIN, decodedTo, m.getSentDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody(prependContent, EmailUtils.getQuotedBody(content, ContentTypes.TEXT_PLAIN, decodedTo, m.getSentDate()), ContentTypes.TEXT_PLAIN); } - dlg.setBody(prependContent + EmailUtils.getQuotedBody(content, ContentTypes.TEXT_HTML, decodedTo, m.getSentDate()), ContentTypes.TEXT_HTML); + dlg.setBody(prependContent, EmailUtils.getQuotedBody(content, ContentTypes.TEXT_HTML, decodedTo, m.getSentDate()), ContentTypes.TEXT_HTML); } catch (Exception ex) { log.error(ex); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/SendEmailDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/SendEmailDialog.java index 000d902d7..91187527f 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/SendEmailDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/SendEmailDialog.java @@ -1187,12 +1187,12 @@ private MailboxSetup getSelectedMailbox() { return null; } - public void setBody(String b, String contentType) { + public void setBody(String preSignature, String postSignature, String contentType) { MailboxSetup ms = this.getSelectedMailbox(); if (contentType.toLowerCase().startsWith(ContentTypes.TEXT_PLAIN)) { if (ms != null) { - this.tp.setText(EmailUtils.html2Text(ms.getEmailSignature()) + b); + this.tp.setText(preSignature + EmailUtils.html2Text(ms.getEmailSignature()) + postSignature); this.tp.setCaretPosition(0); } } else { @@ -1201,7 +1201,7 @@ public void setBody(String b, String contentType) { if (sig == null) { sig = ""; } - this.hp.setText("
" + sig + "

" + b + "
"); + this.hp.setText("
" + preSignature + "
" + sig + "

" + postSignature + "
"); this.hp.setCaretPosition(0); } } diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/ViewEmailDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/ViewEmailDialog.java index f7b4d39a3..dd0f2eef8 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/ViewEmailDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/ViewEmailDialog.java @@ -902,11 +902,11 @@ private void cmdReplyAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F String contentType = this.content.getContentType(); dlg.setContentType(contentType); if (contentType.toLowerCase().startsWith(ContentTypes.TEXT_HTML)) { - dlg.setBody(EmailUtils.getQuotedBody(EmailUtils.html2Text(this.content.getBody()), ContentTypes.TEXT_PLAIN, decodedTo, origM.getSentDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(EmailUtils.html2Text(this.content.getBody()), ContentTypes.TEXT_PLAIN, decodedTo, origM.getSentDate()), ContentTypes.TEXT_PLAIN); } else { - dlg.setBody(EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_PLAIN, decodedTo, origM.getSentDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_PLAIN, decodedTo, origM.getSentDate()), ContentTypes.TEXT_PLAIN); } - dlg.setBody(EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_HTML, decodedTo, origM.getSentDate()), ContentTypes.TEXT_HTML); + dlg.setBody("", EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_HTML, decodedTo, origM.getSentDate()), ContentTypes.TEXT_HTML); } catch (Exception ex) { log.error(ex); @@ -931,11 +931,11 @@ private void cmdReplyAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F String contentType = this.content.getContentType(); dlg.setContentType(contentType); if (contentType.toLowerCase().startsWith(ContentTypes.TEXT_HTML)) { - dlg.setBody(EmailUtils.getQuotedBody(EmailUtils.html2Text(this.content.getBody()), ContentTypes.TEXT_PLAIN, decodedTo, this.outlookMsg.getDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(EmailUtils.html2Text(this.content.getBody()), ContentTypes.TEXT_PLAIN, decodedTo, this.outlookMsg.getDate()), ContentTypes.TEXT_PLAIN); } else { - dlg.setBody(EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_PLAIN, decodedTo, this.outlookMsg.getDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_PLAIN, decodedTo, this.outlookMsg.getDate()), ContentTypes.TEXT_PLAIN); } - dlg.setBody(EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_HTML, decodedTo, this.outlookMsg.getDate()), ContentTypes.TEXT_HTML); + dlg.setBody("", EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_HTML, decodedTo, this.outlookMsg.getDate()), ContentTypes.TEXT_HTML); } catch (Exception ex) { log.error(ex); @@ -1002,11 +1002,11 @@ private void cmdForwardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI String contentType = this.content.getContentType(); dlg.setContentType(contentType); if (contentType.toLowerCase().startsWith(ContentTypes.TEXT_HTML)) { - dlg.setBody(EmailUtils.getQuotedBody(EmailUtils.html2Text(this.content.getBody()), ContentTypes.TEXT_PLAIN, decodedFrom, m.getSentDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(EmailUtils.html2Text(this.content.getBody()), ContentTypes.TEXT_PLAIN, decodedFrom, m.getSentDate()), ContentTypes.TEXT_PLAIN); } else { - dlg.setBody(EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_PLAIN, decodedFrom, m.getSentDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_PLAIN, decodedFrom, m.getSentDate()), ContentTypes.TEXT_PLAIN); } - dlg.setBody(EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_HTML, decodedFrom, m.getSentDate()), ContentTypes.TEXT_HTML); + dlg.setBody("", EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_HTML, decodedFrom, m.getSentDate()), ContentTypes.TEXT_HTML); try { // try forwarding attachments @@ -1058,11 +1058,11 @@ private void cmdForwardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI String contentType = this.content.getContentType(); dlg.setContentType(contentType); if (contentType.toLowerCase().startsWith(ContentTypes.TEXT_HTML)) { - dlg.setBody(EmailUtils.getQuotedBody(EmailUtils.html2Text(this.content.getBody()), ContentTypes.TEXT_PLAIN, from, this.outlookMsg.getDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(EmailUtils.html2Text(this.content.getBody()), ContentTypes.TEXT_PLAIN, from, this.outlookMsg.getDate()), ContentTypes.TEXT_PLAIN); } else { - dlg.setBody(EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_PLAIN, from, this.outlookMsg.getDate()), ContentTypes.TEXT_PLAIN); + dlg.setBody("", EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_PLAIN, from, this.outlookMsg.getDate()), ContentTypes.TEXT_PLAIN); } - dlg.setBody(EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_HTML, from, this.outlookMsg.getDate()), ContentTypes.TEXT_HTML); + dlg.setBody("", EmailUtils.getQuotedBody(this.content.getBody(), ContentTypes.TEXT_HTML, from, this.outlookMsg.getDate()), ContentTypes.TEXT_HTML); try { List attachments = this.outlookMsg.fetchTrueAttachments(); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/utils/BugReportDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/utils/BugReportDialog.java index 94352510a..111b5e4f9 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/utils/BugReportDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/utils/BugReportDialog.java @@ -1119,7 +1119,7 @@ private void cmdSendActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST dlg.addAttachment(tmpUrl, ""); dlg.setSubject("j-lawyer - Systeminformationen"); SimpleDateFormat df2 = new SimpleDateFormat("dd.MM.yyyy HH:mm"); - dlg.setBody("Systembericht vom " + df2.format(new Date()), "text/plain"); + dlg.setBody("Systembericht vom " + df2.format(new Date()), "", "text/plain"); FrameUtils.centerDialog(dlg, null); dlg.setVisible(true);