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:
parent
b63cef17ff
commit
0b93cd0f82
@ -41,6 +41,7 @@ import grendel.storage.MessageExtraFactory;
|
|||||||
import grendel.widgets.Animation;
|
import grendel.widgets.Animation;
|
||||||
import grendel.widgets.CollapsiblePanel;
|
import grendel.widgets.CollapsiblePanel;
|
||||||
import grendel.widgets.GrendelToolBar;
|
import grendel.widgets.GrendelToolBar;
|
||||||
|
import grendel.ui.FolderPanel;
|
||||||
import grendel.ui.GeneralFrame;
|
import grendel.ui.GeneralFrame;
|
||||||
import grendel.ui.StoreFactory;
|
import grendel.ui.StoreFactory;
|
||||||
|
|
||||||
@ -197,7 +198,7 @@ public class Composition extends GeneralFrame {
|
|||||||
|
|
||||||
/** Initialize the headers and body of this composition
|
/** Initialize the headers and body of this composition
|
||||||
as being a message that is forwarded 'quoted'. */
|
as being a message that is forwarded 'quoted'. */
|
||||||
public void initializeAsForward(Message msg) {
|
public void initializeAsForward(Message msg, int aScope) {
|
||||||
mCompositionPanel.setReferredMessage(msg);
|
mCompositionPanel.setReferredMessage(msg);
|
||||||
MessageExtra mextra = MessageExtraFactory.Get(msg);
|
MessageExtra mextra = MessageExtraFactory.Get(msg);
|
||||||
|
|
||||||
@ -207,7 +208,13 @@ public class Composition extends GeneralFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Quote the original text
|
// 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,""));
|
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
|
* Add a signature
|
||||||
*/
|
*/
|
||||||
@ -266,6 +275,7 @@ public class CompositionPanel extends GeneralPanel {
|
|||||||
public static final String sendNowTag ="sendNow";
|
public static final String sendNowTag ="sendNow";
|
||||||
public static final String sendLaterTag ="sendLater";
|
public static final String sendLaterTag ="sendLater";
|
||||||
public static final String quoteOriginalTextTag ="quoteOriginalText";
|
public static final String quoteOriginalTextTag ="quoteOriginalText";
|
||||||
|
public static final String inlineOriginalTextTag ="inlineOriginalText";
|
||||||
public static final String addSignatureTag ="addSignatureAction";
|
public static final String addSignatureTag ="addSignatureAction";
|
||||||
public static final String selectAddressesTag ="selectAddresses";
|
public static final String selectAddressesTag ="selectAddresses";
|
||||||
public static final String goOfflineTag ="goOffline";
|
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
|
* Add a signature
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -922,7 +922,7 @@ public class FolderPanel extends GeneralPanel {
|
|||||||
super(aName);
|
super(aName);
|
||||||
fScope = aScope;
|
fScope = aScope;
|
||||||
|
|
||||||
this.setEnabled(aScope == kQuoted);
|
this.setEnabled(aScope != kAttachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent aEvent) {
|
public void actionPerformed(ActionEvent aEvent) {
|
||||||
@ -932,7 +932,7 @@ public class FolderPanel extends GeneralPanel {
|
|||||||
"Need to have exactly one message selected to reply");
|
"Need to have exactly one message selected to reply");
|
||||||
}
|
}
|
||||||
Composition frame = new Composition();
|
Composition frame = new Composition();
|
||||||
frame.initializeAsForward((Message) (selection.elementAt(0)));
|
frame.initializeAsForward((Message) (selection.elementAt(0)), fScope);
|
||||||
frame.show();
|
frame.show();
|
||||||
frame.requestFocus();
|
frame.requestFocus();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,10 +142,12 @@ msgReplyLabel=Reply
|
|||||||
msgReplyAccel=R
|
msgReplyAccel=R
|
||||||
msgReplyAllLabel=Reply All
|
msgReplyAllLabel=Reply All
|
||||||
msgReplyAllAccel=A
|
msgReplyAllAccel=A
|
||||||
msgForwardLabel=Forward
|
fwdQuotedLabel=Forward Quoted
|
||||||
msgForwardAccel=F
|
fwdQuotedAccel=Q
|
||||||
msgForwardQuotedLabel=Forward Quoted
|
fwdInlineLabel=Forward Inline
|
||||||
msgForwardQuotedAccel=Q
|
fwdInlineAccel=I
|
||||||
|
fwdAttachmentLabel=Forward Attachment
|
||||||
|
fwdAttachmentAccel=A
|
||||||
msgMoveLabel=File to
|
msgMoveLabel=File to
|
||||||
msgMoveAccel=F
|
msgMoveAccel=F
|
||||||
msgMovePopupLabel=File to
|
msgMovePopupLabel=File to
|
||||||
|
|||||||
@ -24,7 +24,7 @@ multiMain=multiFile multiEdit multiView multiMessage
|
|||||||
multiFile=msgNew folderNew msgOpen msgSaveAs - msgGetNew - appExit
|
multiFile=msgNew folderNew msgOpen msgSaveAs - msgGetNew - appExit
|
||||||
multiEdit=editUndo - editCut editCopy editPaste - folderDelete - appSearch - appPrefs - appRunFilters
|
multiEdit=editUndo - editCut editCopy editPaste - folderDelete - appSearch - appPrefs - appRunFilters
|
||||||
multiView=viewLayout viewSort
|
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 fwdQuoted print msgDelete stop
|
||||||
#multiToolBar=msgGetNew msgNew msgReply msgDelete
|
#multiToolBar=msgGetNew msgNew msgReply msgDelete
|
||||||
@ -38,7 +38,7 @@ viewLayout=splitTop splitLeft splitRight stacked
|
|||||||
messageMain=messageFile messageEdit messageMessage window
|
messageMain=messageFile messageEdit messageMessage window
|
||||||
messageFile=msgSaveAs - appExit
|
messageFile=msgSaveAs - appExit
|
||||||
messageEdit=editUndo - editCut editCopy editPaste editClear - appPrefs
|
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
|
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
|
folderMain=folderFile folderEdit folderMessage window
|
||||||
folderFile=msgNew msgOpen msgSaveAs - msgGetNew - appExit
|
folderFile=msgNew msgOpen msgSaveAs - msgGetNew - appExit
|
||||||
folderEdit=editUndo - editCut editCopy editPaste editClear - appPrefs
|
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 msgReply msgReplyAll fwdQuoted markAllRead print msgDelete stop
|
||||||
#folderToolBar=msgGetNew msgNew msgDelete msgReply
|
#folderToolBar=msgGetNew msgNew msgDelete msgReply
|
||||||
@ -71,7 +71,7 @@ masterToolBar=msgGetNew msgNew stop
|
|||||||
# Integrator Frame menus
|
# Integrator Frame menus
|
||||||
#
|
#
|
||||||
|
|
||||||
integratorMessage=msgGetNew - msgNew msgReply msgForward - msgDelete
|
integratorMessage=msgGetNew - msgNew msgReply - fwdInline fwdQuoted fwdAttachment - msgDelete
|
||||||
|
|
||||||
#
|
#
|
||||||
# Common menus
|
# Common menus
|
||||||
@ -101,7 +101,7 @@ msgNewKeyboard=CTRL+m
|
|||||||
msgGetNewKeyboard=CTRL+t
|
msgGetNewKeyboard=CTRL+t
|
||||||
msgSaveAsKeyboard=CTRL+s
|
msgSaveAsKeyboard=CTRL+s
|
||||||
msgReplyKeyboard=CTRL+r
|
msgReplyKeyboard=CTRL+r
|
||||||
msgForwardKeyboard=CTRL+l
|
#msgForwardKeyboard=CTRL+l
|
||||||
msgOpenKeyboard=CTRL+o
|
msgOpenKeyboard=CTRL+o
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
@ -20,7 +20,9 @@ msgGetNewLabel=Get Msg
|
|||||||
msgNewLabel=New Msg
|
msgNewLabel=New Msg
|
||||||
msgReplyLabel=Reply
|
msgReplyLabel=Reply
|
||||||
msgReplyAllLabel=Reply All
|
msgReplyAllLabel=Reply All
|
||||||
fwdQuotedLabel=Forward
|
fwdQuotedLabel=Fwd Q
|
||||||
|
fwdInlineLabel=Fwd I
|
||||||
|
fwdAttachmentLabel=Fwd A
|
||||||
markAllReadLabel=Mark Rd
|
markAllReadLabel=Mark Rd
|
||||||
printLabel=Print
|
printLabel=Print
|
||||||
msgDeleteLabel=Delete
|
msgDeleteLabel=Delete
|
||||||
@ -31,6 +33,8 @@ msgNewIcon=newmsg
|
|||||||
msgReplyIcon=reply
|
msgReplyIcon=reply
|
||||||
msgReplyAllIcon=replyall
|
msgReplyAllIcon=replyall
|
||||||
fwdQuotedIcon=forward
|
fwdQuotedIcon=forward
|
||||||
|
fwdInlineIcon=forward
|
||||||
|
fwdAttachmentIcon=forward
|
||||||
markAllReadIcon=markallread
|
markAllReadIcon=markallread
|
||||||
printIcon=print
|
printIcon=print
|
||||||
msgDeleteIcon=delete
|
msgDeleteIcon=delete
|
||||||
@ -41,6 +45,8 @@ msgNewTooltip=Compose a new message
|
|||||||
msgReplyTooltip=Reply
|
msgReplyTooltip=Reply
|
||||||
msgReplyAllTooltip=Reply to all recipients
|
msgReplyAllTooltip=Reply to all recipients
|
||||||
fwdQuotedTooltip=Forward
|
fwdQuotedTooltip=Forward
|
||||||
|
fwdInlineTooltip=Forward
|
||||||
|
fwdQuotedTooltip=Forward
|
||||||
markAllReadTooltip=Mark all messages read
|
markAllReadTooltip=Mark all messages read
|
||||||
printTooltip=Print this message
|
printTooltip=Print this message
|
||||||
msgDeleteTooltip=Delete this message
|
msgDeleteTooltip=Delete this message
|
||||||
|
|||||||
@ -121,11 +121,14 @@
|
|||||||
<menuitem id="msgReplyAll" category="message" action="msgReplyAll"
|
<menuitem id="msgReplyAll" category="message" action="msgReplyAll"
|
||||||
label="$msgReplyAllLabel" accel="$msgReplyAllAccel"
|
label="$msgReplyAllLabel" accel="$msgReplyAllAccel"
|
||||||
description=""/>
|
description=""/>
|
||||||
<menuitem id="msgForward" category="message" action="msgForward"
|
<menuitem id="fwdQuoted" category="message" action="fwdQuoted"
|
||||||
label="$msgForwardLabel" accel="$msgForwardAccel"
|
label="$fwdQuotedLabel" accel="$fwdQuotedAccel"
|
||||||
description=""/>
|
description=""/>
|
||||||
<menuitem id="msgForwardQuoted" category="message" action="msgForwardQuoted"
|
<menuitem id="fwdInline" category="message" action="fwdInline"
|
||||||
label="$msgForwardQuotedLabel" accel="$msgForwardQuotedAccel"
|
label="$fwdInlineLabel" accel="$fwdInlineAccel"
|
||||||
|
description=""/>
|
||||||
|
<menuitem id="fwdAttachment" category="message" action="fwdAttachment"
|
||||||
|
label="$fwdAttachmentLabel" accel="$fwdAttachmentAccel"
|
||||||
description=""/>
|
description=""/>
|
||||||
<menuitem type="separator"/>
|
<menuitem type="separator"/>
|
||||||
<menu id="msgMark" category="message"
|
<menu id="msgMark" category="message"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user