Inline forwarding now also works a bit.
git-svn-id: svn://10.0.0.236/trunk@28024 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -41,6 +41,7 @@ import grendel.storage.MessageExtraFactory;
|
||||
import grendel.widgets.Animation;
|
||||
import grendel.widgets.CollapsiblePanel;
|
||||
import grendel.widgets.GrendelToolBar;
|
||||
import grendel.ui.FolderPanel;
|
||||
import grendel.ui.GeneralFrame;
|
||||
import grendel.ui.StoreFactory;
|
||||
|
||||
@@ -197,7 +198,7 @@ public class Composition extends GeneralFrame {
|
||||
|
||||
/** Initialize the headers and body of this composition
|
||||
as being a message that is forwarded 'quoted'. */
|
||||
public void initializeAsForward(Message msg) {
|
||||
public void initializeAsForward(Message msg, int aScope) {
|
||||
mCompositionPanel.setReferredMessage(msg);
|
||||
MessageExtra mextra = MessageExtraFactory.Get(msg);
|
||||
|
||||
@@ -207,7 +208,13 @@ public class Composition extends GeneralFrame {
|
||||
}
|
||||
|
||||
// Quote the original text
|
||||
mCompositionPanel.QuoteOriginalMessage();
|
||||
if (aScope == FolderPanel.kQuoted) {
|
||||
mCompositionPanel.QuoteOriginalMessage();
|
||||
}
|
||||
|
||||
if (aScope == FolderPanel.kInline) {
|
||||
mCompositionPanel.InlineOriginalMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -200,6 +200,15 @@ public class CompositionPanel extends GeneralPanel {
|
||||
qot.actionPerformed(new ActionEvent(this,0,""));
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline the orgininal message when forwarding
|
||||
*/
|
||||
|
||||
public void InlineOriginalMessage() {
|
||||
InlineOriginalText iot = new InlineOriginalText();
|
||||
iot.actionPerformed(new ActionEvent(this,0,""));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a signature
|
||||
*/
|
||||
@@ -266,6 +275,7 @@ public class CompositionPanel extends GeneralPanel {
|
||||
public static final String sendNowTag ="sendNow";
|
||||
public static final String sendLaterTag ="sendLater";
|
||||
public static final String quoteOriginalTextTag ="quoteOriginalText";
|
||||
public static final String inlineOriginalTextTag ="inlineOriginalText";
|
||||
public static final String addSignatureTag ="addSignatureAction";
|
||||
public static final String selectAddressesTag ="selectAddresses";
|
||||
public static final String goOfflineTag ="goOffline";
|
||||
@@ -655,6 +665,100 @@ public class CompositionPanel extends GeneralPanel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline the original text message into the editor.
|
||||
* @see QuoteOriginalText
|
||||
*/
|
||||
class InlineOriginalText extends UIAction {
|
||||
InlineOriginalText() {
|
||||
super(inlineOriginalTextTag);
|
||||
this.setEnabled(true);
|
||||
}
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (referredMsg == null) return; // Or beep or whine??? ###
|
||||
// ### Get the message as a stream of text. This involves
|
||||
// complicated things like invoking the MIME parser, and throwing
|
||||
// away non-text parts, and translating HTML to text, and so on.
|
||||
// Yeah, right.
|
||||
InputStream plaintext = null;
|
||||
try {
|
||||
plaintext = referredMsg.getInputStream();
|
||||
} catch (IOException ioe) {
|
||||
} catch (MessagingException e) {
|
||||
}
|
||||
if (plaintext == null) return; // Or beep or whine??? ###
|
||||
|
||||
|
||||
int position = mEditor.getCaretPosition();
|
||||
Document doc = mEditor.getDocument();
|
||||
|
||||
MessageExtra mextra = MessageExtraFactory.Get(referredMsg);
|
||||
String author;
|
||||
try {
|
||||
author = mextra.getAuthor();
|
||||
} catch (MessagingException e) {
|
||||
author = "???"; // I18N? ###
|
||||
}
|
||||
String subject;
|
||||
try {
|
||||
subject = referredMsg.getSubject();
|
||||
} catch (MessagingException e) {
|
||||
subject = "???"; // I18N? ###
|
||||
}
|
||||
String tmp = "\n\n-------- Original Message --------\n";
|
||||
tmp = tmp + "From: " + author + "\n"; // I18N ###
|
||||
tmp = tmp + "Subject: " + subject + "\n";
|
||||
tmp = tmp + "\n";
|
||||
try {
|
||||
doc.insertString(position, tmp, null);
|
||||
position += tmp.length();
|
||||
} catch (BadLocationException e) {
|
||||
}
|
||||
|
||||
// OK, now insert the data from the plaintext, and precede each
|
||||
// line with "> ".
|
||||
|
||||
ByteLineBuffer linebuffer = new ByteLineBuffer();
|
||||
ByteBuf empty = new ByteBuf();
|
||||
linebuffer.setOutputEOL(empty);
|
||||
|
||||
boolean eof = false;
|
||||
|
||||
ByteBuf buf = new ByteBuf();
|
||||
ByteBuf line = new ByteBuf();
|
||||
|
||||
while (!eof) {
|
||||
buf.setLength(0);
|
||||
try {
|
||||
eof = (buf.read(plaintext, 1024) < 0);
|
||||
} catch (IOException e) {
|
||||
eof = true;
|
||||
}
|
||||
if (eof) {
|
||||
linebuffer.pushEOF();
|
||||
} else {
|
||||
linebuffer.pushBytes(buf);
|
||||
}
|
||||
while (linebuffer.pullLine(line)) {
|
||||
try {
|
||||
//doc.insertString(position, "> ", null);
|
||||
//position += 2;
|
||||
doc.insertString(position, line.toString(), null);
|
||||
position += line.length();
|
||||
doc.insertString(position, "\n", null);
|
||||
position += 1;
|
||||
} catch (BadLocationException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
repaint();
|
||||
try {
|
||||
plaintext.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a signature
|
||||
*/
|
||||
|
||||
@@ -922,7 +922,7 @@ public class FolderPanel extends GeneralPanel {
|
||||
super(aName);
|
||||
fScope = aScope;
|
||||
|
||||
this.setEnabled(aScope == kQuoted);
|
||||
this.setEnabled(aScope != kAttachment);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent aEvent) {
|
||||
@@ -932,7 +932,7 @@ public class FolderPanel extends GeneralPanel {
|
||||
"Need to have exactly one message selected to reply");
|
||||
}
|
||||
Composition frame = new Composition();
|
||||
frame.initializeAsForward((Message) (selection.elementAt(0)));
|
||||
frame.initializeAsForward((Message) (selection.elementAt(0)), fScope);
|
||||
frame.show();
|
||||
frame.requestFocus();
|
||||
}
|
||||
|
||||
@@ -142,10 +142,12 @@ msgReplyLabel=Reply
|
||||
msgReplyAccel=R
|
||||
msgReplyAllLabel=Reply All
|
||||
msgReplyAllAccel=A
|
||||
msgForwardLabel=Forward
|
||||
msgForwardAccel=F
|
||||
msgForwardQuotedLabel=Forward Quoted
|
||||
msgForwardQuotedAccel=Q
|
||||
fwdQuotedLabel=Forward Quoted
|
||||
fwdQuotedAccel=Q
|
||||
fwdInlineLabel=Forward Inline
|
||||
fwdInlineAccel=I
|
||||
fwdAttachmentLabel=Forward Attachment
|
||||
fwdAttachmentAccel=A
|
||||
msgMoveLabel=File to
|
||||
msgMoveAccel=F
|
||||
msgMovePopupLabel=File to
|
||||
|
||||
@@ -24,7 +24,7 @@ multiMain=multiFile multiEdit multiView multiMessage
|
||||
multiFile=msgNew folderNew msgOpen msgSaveAs - msgGetNew - appExit
|
||||
multiEdit=editUndo - editCut editCopy editPaste - folderDelete - appSearch - appPrefs - appRunFilters
|
||||
multiView=viewLayout viewSort
|
||||
multiMessage=msgNew - msgReply msgReplyAll msgForward fwdQuoted - msgMark
|
||||
multiMessage=msgNew - msgReply msgReplyAll - fwdInline fwdQuoted fwdAttachment - msgMark
|
||||
|
||||
multiToolBar=msgGetNew msgNew msgReply fwdQuoted print msgDelete stop
|
||||
#multiToolBar=msgGetNew msgNew msgReply msgDelete
|
||||
@@ -38,7 +38,7 @@ viewLayout=splitTop splitLeft splitRight stacked
|
||||
messageMain=messageFile messageEdit messageMessage window
|
||||
messageFile=msgSaveAs - appExit
|
||||
messageEdit=editUndo - editCut editCopy editPaste editClear - appPrefs
|
||||
messageMessage=msgNew - msgReply msgReplyAll msgForward fwdQuoted
|
||||
messageMessage=msgNew - msgReply msgReplyAll - fwdInline fwdQuoted fwdAttachment
|
||||
|
||||
messageToolBar=msgGetNew msgNew msgReply msgReplyAll fwdQuoted print msgDelete stop
|
||||
|
||||
@@ -51,7 +51,7 @@ messageToolBar=msgGetNew msgNew msgReply msgReplyAll fwdQuoted print msgDelete s
|
||||
folderMain=folderFile folderEdit folderMessage window
|
||||
folderFile=msgNew msgOpen msgSaveAs - msgGetNew - appExit
|
||||
folderEdit=editUndo - editCut editCopy editPaste editClear - appPrefs
|
||||
folderMessage=msgNew - msgReply msgReplyAll fwdQuoted msgForwardQuoted
|
||||
folderMessage=msgNew - msgReply msgReplyAll - fwdInline fwdQuoted fwdAttachment
|
||||
|
||||
folderToolBar=msgGetNew msgNew msgReply msgReplyAll fwdQuoted markAllRead print msgDelete stop
|
||||
#folderToolBar=msgGetNew msgNew msgDelete msgReply
|
||||
@@ -71,7 +71,7 @@ masterToolBar=msgGetNew msgNew stop
|
||||
# Integrator Frame menus
|
||||
#
|
||||
|
||||
integratorMessage=msgGetNew - msgNew msgReply msgForward - msgDelete
|
||||
integratorMessage=msgGetNew - msgNew msgReply - fwdInline fwdQuoted fwdAttachment - msgDelete
|
||||
|
||||
#
|
||||
# Common menus
|
||||
@@ -101,7 +101,7 @@ msgNewKeyboard=CTRL+m
|
||||
msgGetNewKeyboard=CTRL+t
|
||||
msgSaveAsKeyboard=CTRL+s
|
||||
msgReplyKeyboard=CTRL+r
|
||||
msgForwardKeyboard=CTRL+l
|
||||
#msgForwardKeyboard=CTRL+l
|
||||
msgOpenKeyboard=CTRL+o
|
||||
|
||||
#
|
||||
|
||||
@@ -20,7 +20,9 @@ msgGetNewLabel=Get Msg
|
||||
msgNewLabel=New Msg
|
||||
msgReplyLabel=Reply
|
||||
msgReplyAllLabel=Reply All
|
||||
fwdQuotedLabel=Forward
|
||||
fwdQuotedLabel=Fwd Q
|
||||
fwdInlineLabel=Fwd I
|
||||
fwdAttachmentLabel=Fwd A
|
||||
markAllReadLabel=Mark Rd
|
||||
printLabel=Print
|
||||
msgDeleteLabel=Delete
|
||||
@@ -31,6 +33,8 @@ msgNewIcon=newmsg
|
||||
msgReplyIcon=reply
|
||||
msgReplyAllIcon=replyall
|
||||
fwdQuotedIcon=forward
|
||||
fwdInlineIcon=forward
|
||||
fwdAttachmentIcon=forward
|
||||
markAllReadIcon=markallread
|
||||
printIcon=print
|
||||
msgDeleteIcon=delete
|
||||
@@ -41,6 +45,8 @@ msgNewTooltip=Compose a new message
|
||||
msgReplyTooltip=Reply
|
||||
msgReplyAllTooltip=Reply to all recipients
|
||||
fwdQuotedTooltip=Forward
|
||||
fwdInlineTooltip=Forward
|
||||
fwdQuotedTooltip=Forward
|
||||
markAllReadTooltip=Mark all messages read
|
||||
printTooltip=Print this message
|
||||
msgDeleteTooltip=Delete this message
|
||||
|
||||
@@ -121,11 +121,14 @@
|
||||
<menuitem id="msgReplyAll" category="message" action="msgReplyAll"
|
||||
label="$msgReplyAllLabel" accel="$msgReplyAllAccel"
|
||||
description=""/>
|
||||
<menuitem id="msgForward" category="message" action="msgForward"
|
||||
label="$msgForwardLabel" accel="$msgForwardAccel"
|
||||
<menuitem id="fwdQuoted" category="message" action="fwdQuoted"
|
||||
label="$fwdQuotedLabel" accel="$fwdQuotedAccel"
|
||||
description=""/>
|
||||
<menuitem id="msgForwardQuoted" category="message" action="msgForwardQuoted"
|
||||
label="$msgForwardQuotedLabel" accel="$msgForwardQuotedAccel"
|
||||
<menuitem id="fwdInline" category="message" action="fwdInline"
|
||||
label="$fwdInlineLabel" accel="$fwdInlineAccel"
|
||||
description=""/>
|
||||
<menuitem id="fwdAttachment" category="message" action="fwdAttachment"
|
||||
label="$fwdAttachmentLabel" accel="$fwdAttachmentAccel"
|
||||
description=""/>
|
||||
<menuitem type="separator"/>
|
||||
<menu id="msgMark" category="message"
|
||||
|
||||
Reference in New Issue
Block a user