1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Add support for Outlook-style quote headers as a preference under Account Settings -> Sending Mail.

Refactor forwarding header (header-style quote header) into individual string pieces that are assembled in code to accommodate future HTML version of headers.
Introduced four new strings for translation.
This commit is contained in:
Andrew Chen 2011-01-05 23:58:14 +00:00
parent aae08c15ee
commit 5fef7f3b07
20 changed files with 228 additions and 49 deletions

View File

@ -261,7 +261,11 @@ Vítejte v nastavení pošty K-9 Mail. K-9 je open source poštovní klient pro
<string name="message_compose_bcc_hint">Skrytá kopie</string>
<string name="message_compose_subject_hint">Předmět</string>
<string name="message_compose_content_hint">Text zprávy</string>
<string name="message_compose_fwd_header_fmt">\n-------- Původní zpráva --------\nPředmět: <xliff:g id="subject">%s</xliff:g>\nOdesílatel: <xliff:g id="sender">%s</xliff:g>\nKomu: <xliff:g id="to">%s</xliff:g>\nKopie: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Původní zpráva --------</string>
<string name="message_compose_quote_header_subject">Předmět:</string>
<string name="message_compose_quote_header_from">Odesílatel:</string>
<string name="message_compose_quote_header_to">Komu:</string>
<string name="message_compose_quote_header_cc">Kopie:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> napsal(a):\n\n</string>
<string name="message_compose_quoted_text_label">Citovaný text</string>
<string name="message_compose_error_no_recipients">Musíte přidat alespoň jednoho příjemce.</string>

View File

@ -255,7 +255,11 @@ Willkommen zum \"K-9 Mail\"-Setup. K-9 ist eine quelloffene E-Mail-Anwendung fü
<string name="message_compose_bcc_hint">BCC</string>
<string name="message_compose_subject_hint">Betreff</string>
<string name="message_compose_content_hint">Nachrichtentext</string>
<string name="message_compose_fwd_header_fmt">\n\n-------- Original-Nachricht --------\nBetreff: <xliff:g id="subject">%s</xliff:g>\nVon: <xliff:g id="sender">%s</xliff:g>\nAn: <xliff:g id="to">%s</xliff:g>\nCC: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Original-Nachricht --------</string>
<string name="message_compose_quote_header_subject">Betreff:</string>
<string name="message_compose_quote_header_from">Von:</string>
<string name="message_compose_quote_header_to">An:</string>
<string name="message_compose_quote_header_cc">CC:</string>
<string name="message_compose_reply_header_fmt">\n\n<xliff:g id="sender">%s</xliff:g> schrieb:\n\n</string>
<string name="message_compose_quoted_text_label">Zitierter Text</string>
<string name="message_compose_error_no_recipients">Sie müssen mindestens einen Empfänger wählen.</string>

View File

@ -253,7 +253,11 @@ Bienvenido a la Configuración de K-9. K-9 es un cliente de correo OpenSource pa
<string name="message_compose_bcc_hint">CCo</string>
<string name="message_compose_subject_hint">Asunto</string>
<string name="message_compose_content_hint">Texto del Mensaje</string>
<string name="message_compose_fwd_header_fmt">\n-------- Mensaje Origianl --------\nAsunto: <xliff:g id="subject">%s</xliff:g>\nDesde: <xliff:g id="sender">%s</xliff:g>\nPara: <xliff:g id="to">%s</xliff:g>\nCC: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Mensaje Origianl --------</string>
<string name="message_compose_quote_header_subject">Asunto:</string>
<string name="message_compose_quote_header_from">Desde:</string>
<string name="message_compose_quote_header_to">Para:</string>
<string name="message_compose_quote_header_cc">CC:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> escribió:\n\n</string>
<string name="message_compose_quoted_text_label">Citado</string>
<string name="message_compose_error_no_recipients">Debes Añadir un destinatario</string>

View File

@ -250,7 +250,11 @@ Tervetuloa K-9 Mail asennukseen. K-9 on avoimen lähdekoodin sähköpostiasiaka
<string name="message_compose_bcc_hint">Piilokopio</string>
<string name="message_compose_subject_hint">Aihe</string>
<string name="message_compose_content_hint">Viesti</string>
<string name="message_compose_fwd_header_fmt">\n-------- Alkuperäinen viesti --------\nSubject: <xliff:g id="subject">%s</xliff:g>\nLähettäjä: <xliff:g id="sender">%s</xliff:g>\nVastaanottaja: <xliff:g id="to">%s</xliff:g>\nKopio: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Alkuperäinen viesti --------</string>
<string name="message_compose_quote_header_subject">Subject:</string>
<string name="message_compose_quote_header_from">Lähettäjä:</string>
<string name="message_compose_quote_header_to">Vastaanottaja:</string>
<string name="message_compose_quote_header_cc">Kopio:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> kirjoitti:\n\n</string>
<string name="message_compose_quoted_text_label">Lainattu teksti</string>
<string name="message_compose_error_no_recipients">Valitse ainakin yksi vastaanottaja.</string>

View File

@ -241,7 +241,11 @@
<string name="message_compose_bcc_hint">Cci</string>
<string name="message_compose_subject_hint">Objet</string>
<string name="message_compose_content_hint">Texte du message</string>
<string name="message_compose_fwd_header_fmt">\n\n-------- Message d\'origine --------\nObjet\u00A0: <xliff:g id="subject">%s</xliff:g>\nDe\u00A0: <xliff:g id="sender">%s</xliff:g>\nÀ\u00A0: <xliff:g id="to">%s</xliff:g>\nCc\u00A0: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Message d\'origine --------</string>
<string name="message_compose_quote_header_subject">Objet\u00A0:</string>
<string name="message_compose_quote_header_from">De\u00A0:</string>
<string name="message_compose_quote_header_to">À\u00A0:</string>
<string name="message_compose_quote_header_cc">Cc\u00A0:</string>
<string name="message_compose_reply_header_fmt">\n<xliff:g id="sender">%s</xliff:g> a écrit\u00A0:\n\n</string>
<string name="message_compose_quoted_text_label">Texte cité</string>
<string name="message_compose_error_no_recipients">Vous devez ajouter au moins un destinataire.</string>

View File

@ -255,7 +255,11 @@ Benvenuto nella configurazione della posta di K-9. K-9 è un client di posta ope
<string name="message_compose_bcc_hint">Ccn</string>
<string name="message_compose_subject_hint">Oggetto</string>
<string name="message_compose_content_hint">Testo del messaggio</string>
<string name="message_compose_fwd_header_fmt">\n-------- Messaggio originale --------\nOggetto: <xliff:g id="subject">%s</xliff:g>\nDa: <xliff:g id="sender">%s</xliff:g>\nA: <xliff:g id="to">%s</xliff:g>\nCc: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Messaggio originale --------</string>
<string name="message_compose_quote_header_subject">Oggetto:</string>
<string name="message_compose_quote_header_from">Da:</string>
<string name="message_compose_quote_header_to">A:</string>
<string name="message_compose_quote_header_cc">Cc:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> ha scritto:\n\n</string>
<string name="message_compose_quoted_text_label">Testo quotato</string>
<string name="message_compose_error_no_recipients">È necessario aggiungere almeno un destinatario.</string>

View File

@ -255,7 +255,11 @@ K-9 Mail セットアップにようこそ。\nK-9 は標準のAndroidメール
<string name="message_compose_bcc_hint">Bcc</string>
<string name="message_compose_subject_hint">件名</string>
<string name="message_compose_content_hint">本文</string>
<string name="message_compose_fwd_header_fmt">\n-------- 元メール --------\n件名: <xliff:g id="subject">%s</xliff:g>\n送信者: <xliff:g id="sender">%s</xliff:g>\n宛先: <xliff:g id="to">%s</xliff:g>\nCC: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- 元メール --------</string>
<string name="message_compose_quote_header_subject">件名:</string>
<string name="message_compose_quote_header_from">送信者:</string>
<string name="message_compose_quote_header_to">宛先:</string>
<string name="message_compose_quote_header_cc">CC:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> wrote:\n\n</string>
<string name="message_compose_quoted_text_label">テキスト引用</string>
<string name="message_compose_error_no_recipients">少なくとも1つの受信者を追加する必要があります</string>

View File

@ -251,7 +251,11 @@ Welkom bij K-9 Mail setup. K-9 is een open source mail cliënt voor Android, ge
<string name="message_compose_bcc_hint">Bcc</string>
<string name="message_compose_subject_hint">Onderwerp</string>
<string name="message_compose_content_hint">Bericht tekst</string>
<string name="message_compose_fwd_header_fmt">\n-------- Origineel bericht --------\nSubject: <xliff:g id="subject">%s</xliff:g>\nFrom: <xliff:g id="sender">%s</xliff:g>\nTo: <xliff:g id="to">%s</xliff:g>\nCC: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Origineel bericht --------</string>
<string name="message_compose_quote_header_subject">Subject:</string>
<string name="message_compose_quote_header_from">From:</string>
<string name="message_compose_quote_header_to">To:</string>
<string name="message_compose_quote_header_cc">CC:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> wrote:\n\n</string>
<string name="message_compose_quoted_text_label">Ge-quote tekst</string>
<string name="message_compose_error_no_recipients">Minimaal 1 ontvanger kiezen.</string>

View File

@ -250,7 +250,11 @@ Witaj w K-9 Mail, darmowym programie pocztowym dla systemu Android. Najistotniej
<string name="message_compose_bcc_hint">UDW</string>
<string name="message_compose_subject_hint">Temat</string>
<string name="message_compose_content_hint">Treść wiadomości</string>
<string name="message_compose_fwd_header_fmt">\n-------- Wiadomość oryginalna --------\nTemat: <xliff:g id="subject">%s</xliff:g>\nOd: <xliff:g id="sender">%s</xliff:g>\nDo: <xliff:g id="to">%s</xliff:g>\nDW: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Wiadomość oryginalna --------</string>
<string name="message_compose_quote_header_subject">Temat:</string>
<string name="message_compose_quote_header_from">Od:</string>
<string name="message_compose_quote_header_to">Do:</string>
<string name="message_compose_quote_header_cc">DW:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> napisał:\n\n</string>
<string name="message_compose_quoted_text_label">Cytowany tekst</string>
<string name="message_compose_error_no_recipients">Musisz dodać co najmniej jednego odbiorcę.</string>

View File

@ -253,7 +253,11 @@ Bem-vindo à configuração do K-9 Mail. K-9 é um cliente de e-mail com código
<string name="message_compose_bcc_hint">Bcc</string>
<string name="message_compose_subject_hint">Assunto</string>
<string name="message_compose_content_hint">Texto da mensagem</string>
<string name="message_compose_fwd_header_fmt">\n-------- Mensagem original --------\nAssunto: <xliff:g id="subject">%s</xliff:g>\nDe: <xliff:g id="sender">%s</xliff:g>\nPara: <xliff:g id="to">%s</xliff:g>\nCC: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Mensagem original --------</string>
<string name="message_compose_quote_header_subject">Assunto:</string>
<string name="message_compose_quote_header_from">De:</string>
<string name="message_compose_quote_header_to">Para:</string>
<string name="message_compose_quote_header_cc">CC:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> escreveu:\n\n</string>
<string name="message_compose_quoted_text_label">Texto citado</string>
<string name="message_compose_error_no_recipients">Você deve incluir ao menos um destinatário.</string>

View File

@ -229,7 +229,11 @@
<string name="message_compose_bcc_hint">СК</string>
<string name="message_compose_subject_hint">Тема</string>
<string name="message_compose_content_hint">Текст сообщения</string>
<string name="message_compose_fwd_header_fmt">\n-------- Исходное сообщение --------\nТема: <xliff:g id="subject">%s</xliff:g>\nОт: <xliff:g id="sender">%s</xliff:g>\nДля: <xliff:g id="to">%s</xliff:g>\nКопия: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Исходное сообщение --------</string>
<string name="message_compose_quote_header_subject">Тема:</string>
<string name="message_compose_quote_header_from">От:</string>
<string name="message_compose_quote_header_to">Для:</string>
<string name="message_compose_quote_header_cc">Копия:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> написал(а):\n\n</string>
<string name="message_compose_quoted_text_label">Цитированный текст</string>
<string name="message_compose_error_no_recipients">Необходимо добавить хотя бы одного адресата.</string>

View File

@ -252,7 +252,11 @@ Välkommen till installationen av K-9 E-post. K-9 är en e-postklient med öppen
<string name="message_compose_bcc_hint">Bcc</string>
<string name="message_compose_subject_hint">Ämne</string>
<string name="message_compose_content_hint">Meddelandetext</string>
<string name="message_compose_fwd_header_fmt">\n-------- Originalmeddelande --------\nÄmne: <xliff:g id="subject">%s</xliff:g>\nFrån: <xliff:g id="sender">%s</xliff:g>\nTill: <xliff:g id="to">%s</xliff:g>\nCC: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Originalmeddelande --------</string>
<string name="message_compose_quote_header_subject">Ämne:</string>
<string name="message_compose_quote_header_from">Från:</string>
<string name="message_compose_quote_header_to">Till:</string>
<string name="message_compose_quote_header_cc">CC:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> skrev:\n\n</string>
<string name="message_compose_quoted_text_label">Citerad text</string>
<string name="message_compose_error_no_recipients">Du måste ange åtminstone en mottagare.</string>

View File

@ -239,7 +239,11 @@
<string name="message_compose_bcc_hint">暗送</string>
<string name="message_compose_subject_hint">主题</string>
<string name="message_compose_content_hint">邮件内容</string>
<string name="message_compose_fwd_header_fmt">\n--------原始邮件--------\主题:<xliff:g id="subject">%s</xliff:g>\发件人:<xliff:g id="sender">%s</xliff:g>\n收件人<xliff:g id="to">%s</xliff:g>\n抄送<xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">--------原始邮件--------</string>
<string name="message_compose_quote_header_subject">主题:</string>
<string name="message_compose_quote_header_from">发件人:</string>
<string name="message_compose_quote_header_to">收件人:</string>
<string name="message_compose_quote_header_cc">抄送:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g>写到:\n\n</string>
<string name="message_compose_quoted_text_label">引用文本</string>
<string name="message_compose_error_no_recipients">您必须添加至少一个收件人。</string>

View File

@ -126,7 +126,11 @@
<string name="message_compose_cc_hint">副本</string>
<string name="message_compose_downloading_attachments_toast">某些附件未下載。在傳送此訊息之前,將會自動下載附件。</string>
<string name="message_compose_error_no_recipients">必須新增至少一位收件者。</string>
<string name="message_compose_fwd_header_fmt">\n\n-------- 原始郵件 --------\n主旨<xliff:g id="subject">%s</xliff:g>\n寄件者<xliff:g id="sender">%s</xliff:g>\n收件者<xliff:g id="to">%s</xliff:g>\n副本<xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- 原始郵件 --------</string>
<string name="message_compose_quote_header_subject">主旨:</string>
<string name="message_compose_quote_header_from">寄件者:</string>
<string name="message_compose_quote_header_to">收件者:</string>
<string name="message_compose_quote_header_cc">副本:</string>
<string name="message_compose_quoted_text_label">引用的文字</string>
<string name="message_compose_reply_header_fmt">\n<xliff:g id="sender">%s</xliff:g> 說:\n\n</string>
<string name="message_compose_subject_hint">主旨</string>

View File

@ -653,7 +653,14 @@
<item>6</item>
</string-array>
<string-array name="account_settings_quote_style_entries">
<item>@string/account_settings_quote_style_prefix</item>
<item>@string/account_settings_quote_style_header</item>
</string-array>
<string-array name="account_settings_quote_style_values">
<item>PREFIX</item>
<item>HEADER</item>
</string-array>
</resources>

View File

@ -255,7 +255,12 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="message_compose_bcc_hint">Bcc</string>
<string name="message_compose_subject_hint">Subject</string>
<string name="message_compose_content_hint">Message text</string>
<string name="message_compose_fwd_header_fmt">\n-------- Original Message --------\nSubject: <xliff:g id="subject">%s</xliff:g>\nFrom: <xliff:g id="sender">%s</xliff:g>\nTo: <xliff:g id="to">%s</xliff:g>\nCC: <xliff:g id="cc">%s</xliff:g>\n\n</string>
<string name="message_compose_quote_header_separator">-------- Original Message --------</string>
<string name="message_compose_quote_header_subject">Subject:</string>
<string name="message_compose_quote_header_send_date">Sent:</string>
<string name="message_compose_quote_header_from">From:</string>
<string name="message_compose_quote_header_to">To:</string>
<string name="message_compose_quote_header_cc">Cc:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> wrote:\n\n</string>
<string name="message_compose_quoted_text_label">Quoted text</string>
<string name="message_compose_error_no_recipients">You must add at least one recipient.</string>
@ -554,6 +559,10 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="account_settings_reply_after_quote_label">Reply after quoted text</string>
<string name="account_settings_reply_after_quote_summary">When replying to messages, the original message will appear above your reply.</string>
<string name="account_settings_quote_style_label">Reply quoting style</string>
<string name="account_settings_quote_style_prefix">Prefix (like Gmail, Pine)</string>
<string name="account_settings_quote_style_header">Header (like Outlook, Yahoo!, Hotmail)</string>
<string name="account_settings_general_title">General settings</string>
<string name="account_settings_display_prefs_title">Display</string>
<string name="account_settings_sync">Fetching mail</string>

View File

@ -225,6 +225,13 @@
android:title="@string/account_settings_identities_label"
android:summary="@string/account_settings_identities_summary" />
<ListPreference
android:persistent="false"
android:key="quote_style"
android:title="@string/account_settings_quote_style_label"
android:entries="@array/account_settings_quote_style_entries"
android:entryValues="@array/account_settings_quote_style_values" />
<CheckBoxPreference
android:persistent="false"
android:key="reply_after_quote"

View File

@ -50,8 +50,8 @@ public class Account implements BaseAccount
public static final String TYPE_OTHER = "OTHER";
private static final String[] networkTypes = { TYPE_WIFI, TYPE_MOBILE, TYPE_OTHER };
private static final QuoteStyle DEFAULT_QUOTE_STYLE = QuoteStyle.PREFIX;
private static final String DEFAULT_QUOTE_PREFIX = ">";
private static final boolean DEFAULT_REPLY_AFTER_QUOTE = false;
/**
@ -119,6 +119,7 @@ public class Account implements BaseAccount
// Tracks if we have sent a notification for this account for
// current set of fetched messages
private boolean mRingNotified;
private QuoteStyle mQuoteStyle;
private String mQuotePrefix;
private boolean mReplyAfterQuote;
private boolean mSyncRemoteDeletions;
@ -159,6 +160,11 @@ public class Account implements BaseAccount
ALL, DISPLAYABLE, NONE
}
public enum QuoteStyle
{
PREFIX, HEADER
}
protected Account(Context context)
{
mUuid = UUID.randomUUID().toString();
@ -189,6 +195,7 @@ public class Account implements BaseAccount
subscribedFoldersOnly = false;
maximumPolledMessageAge = -1;
maximumAutoDownloadMessageSize = 32768;
mQuoteStyle = DEFAULT_QUOTE_STYLE;
mQuotePrefix = DEFAULT_QUOTE_PREFIX;
mReplyAfterQuote = DEFAULT_REPLY_AFTER_QUOTE;
mSyncRemoteDeletions = true;
@ -281,6 +288,7 @@ public class Account implements BaseAccount
+ ".maximumPolledMessageAge", -1);
maximumAutoDownloadMessageSize = prefs.getInt(mUuid
+ ".maximumAutoDownloadMessageSize", 32768);
mQuoteStyle = QuoteStyle.valueOf(prefs.getString(mUuid + ".quoteStyle", DEFAULT_QUOTE_STYLE.name()));
mQuotePrefix = prefs.getString(mUuid + ".quotePrefix", DEFAULT_QUOTE_PREFIX);
mReplyAfterQuote = prefs.getBoolean(mUuid + ".replyAfterQuote", DEFAULT_REPLY_AFTER_QUOTE);
for (String type : networkTypes)
@ -467,6 +475,7 @@ public class Account implements BaseAccount
editor.remove(mUuid + ".subscribedFoldersOnly");
editor.remove(mUuid + ".maximumPolledMessageAge");
editor.remove(mUuid + ".maximumAutoDownloadMessageSize");
editor.remove(mUuid + ".quoteStyle");
editor.remove(mUuid + ".quotePrefix");
editor.remove(mUuid + ".showPicturesEnum");
editor.remove(mUuid + ".replyAfterQuote");
@ -562,6 +571,7 @@ public class Account implements BaseAccount
editor.putBoolean(mUuid + ".subscribedFoldersOnly", subscribedFoldersOnly);
editor.putInt(mUuid + ".maximumPolledMessageAge", maximumPolledMessageAge);
editor.putInt(mUuid + ".maximumAutoDownloadMessageSize", maximumAutoDownloadMessageSize);
editor.putString(mUuid + ".quoteStyle", mQuoteStyle.name());
editor.putString(mUuid + ".quotePrefix", mQuotePrefix);
editor.putBoolean(mUuid + ".replyAfterQuote", mReplyAfterQuote);
editor.putString(mUuid + ".cryptoApp", mCryptoApp);
@ -1470,6 +1480,16 @@ public class Account implements BaseAccount
}
}
public QuoteStyle getQuoteStyle()
{
return mQuoteStyle;
}
public void setQuoteStyle(QuoteStyle quoteStyle)
{
this.mQuoteStyle = quoteStyle;
}
public synchronized String getQuotePrefix()
{
return mQuotePrefix;

View File

@ -79,7 +79,6 @@ import com.fsck.k9.mail.store.UnavailableStorageException;
public class MessageCompose extends K9Activity implements OnClickListener, OnFocusChangeListener
{
private static final int DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE = 1;
private static final int REPLY_WRAP_LINE_WIDTH = 72;
private static final String ACTION_REPLY = "com.fsck.k9.intent.action.REPLY";
private static final String ACTION_REPLY_ALL = "com.fsck.k9.intent.action.REPLY_ALL";
@ -1751,25 +1750,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
"text/plain");
if (part != null || mSourceMessageBody != null)
{
String quotedText = String.format(
getString(R.string.message_compose_reply_header_fmt),
Address.toString(mSourceMessage.getFrom()));
final String prefix = mAccount.getQuotePrefix();
// "$" and "\" in the quote prefix have to be escaped for
// the replaceAll() invocation.
final String escapedPrefix = prefix.replaceAll("(\\\\|\\$)", "\\\\$1");
final String text = (mSourceMessageBody != null) ?
mSourceMessageBody :
MimeUtility.getTextFromPart(part);
final String wrappedText = Utility.wrap(text, REPLY_WRAP_LINE_WIDTH - prefix.length());
quotedText += wrappedText.replaceAll("(?m)^", escapedPrefix);
quotedText = quotedText.replaceAll("\\\r", "");
mQuotedText.setText(quotedText);
mQuotedText.setText(quoteOriginalMessage(mSourceMessage, text, mAccount.getQuoteStyle()));
mQuotedTextBar.setVisibility(View.VISIBLE);
mQuotedText.setVisibility(View.VISIBLE);
@ -1889,20 +1874,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
if (quotedText != null)
{
String text = String.format(
getString(R.string.message_compose_fwd_header_fmt),
mSourceMessage.getSubject(),
Address.toString(mSourceMessage.getFrom()),
Address.toString(
mSourceMessage.getRecipients(RecipientType.TO)),
Address.toString(
mSourceMessage.getRecipients(RecipientType.CC)));
// Forwards always use the HEADER quote style.
// Not sure we have the replaceAll() at the end there -- achen.code 20110105
String text = quoteOriginalMessage(mSourceMessage, quotedText, Account.QuoteStyle.HEADER).replaceAll("\\\r", "");
if (quotedText != null)
{
quotedText = quotedText.replaceAll("\\\r", "");
mQuotedText.setText(text);
mQuotedText.append(quotedText);
}
mQuotedTextBar.setVisibility(View.VISIBLE);
mQuotedText.setVisibility(View.VISIBLE);
@ -2342,4 +2319,76 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
}
}
private static final int REPLY_WRAP_LINE_WIDTH = 72;
private static final int QUOTE_BUFFER_LENGTH = 512; // amount of extra buffer to allocate to accommodate quoting headers or prefixes
/**
* Add quoting markup to a message.
* @param originalMessage Metadata for message being quoted.
* @param body Text of the message to be quoted.
* @param quoteStyle Style of quoting.
* @return Quoted text.
* @throws MessagingException
*/
private String quoteOriginalMessage(final Message originalMessage, final String body, final Account.QuoteStyle quoteStyle) throws MessagingException
{
if (quoteStyle == Account.QuoteStyle.PREFIX)
{
StringBuilder quotedText = new StringBuilder(body.length() + QUOTE_BUFFER_LENGTH);
quotedText.append(String.format(
getString(R.string.message_compose_reply_header_fmt),
Address.toString(originalMessage.getFrom()))
);
final String prefix = mAccount.getQuotePrefix();
final String wrappedText = Utility.wrap(body, REPLY_WRAP_LINE_WIDTH - prefix.length());
// "$" and "\" in the quote prefix have to be escaped for
// the replaceAll() invocation.
final String escapedPrefix = prefix.replaceAll("(\\\\|\\$)", "\\\\$1");
quotedText.append(wrappedText.replaceAll("(?m)^", escapedPrefix));
return quotedText.toString().replaceAll("\\\r", "");
}
else if (quoteStyle == Account.QuoteStyle.HEADER)
{
StringBuilder quotedText = new StringBuilder(body.length() + QUOTE_BUFFER_LENGTH);
quotedText.append("\n");
quotedText.append(getString(R.string.message_compose_quote_header_separator)).append("\n");
if (originalMessage.getFrom() != null && Address.toString(originalMessage.getFrom()).length() != 0)
{
quotedText.append(getString(R.string.message_compose_quote_header_from)).append(" ").append(Address.toString(originalMessage.getFrom())).append("\n");
}
if (originalMessage.getSentDate() != null)
{
quotedText.append(getString(R.string.message_compose_quote_header_send_date)).append(" ").append(originalMessage.getSentDate()).append("\n");
}
if (originalMessage.getRecipients(RecipientType.TO) != null && originalMessage.getRecipients(RecipientType.TO).length != 0)
{
quotedText.append(getString(R.string.message_compose_quote_header_to)).append(" ").append(Address.toString(originalMessage.getRecipients(RecipientType.TO))).append("\n");
}
if (originalMessage.getRecipients(RecipientType.CC) != null && originalMessage.getRecipients(RecipientType.CC).length != 0)
{
quotedText.append(getString(R.string.message_compose_quote_header_cc)).append(": ").append(Address.toString(originalMessage.getRecipients(RecipientType.CC))).append("\n");
}
if (originalMessage.getSubject() != null)
{
quotedText.append(getString(R.string.message_compose_quote_header_subject)).append(" ").append(originalMessage.getSubject()).append("\n");
}
quotedText.append("\n");
if (body != null)
{
quotedText.append(body);
}
return quotedText.toString();
}
else
{
// Shouldn't ever happen.
return body;
}
}
}

View File

@ -7,11 +7,7 @@ import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Vibrator;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.RingtonePreference;
import android.preference.*;
import android.util.Log;
import android.view.KeyEvent;
@ -21,6 +17,7 @@ import java.util.List;
import com.fsck.k9.Account;
import com.fsck.k9.Account.FolderMode;
import com.fsck.k9.Account.QuoteStyle;
import com.fsck.k9.K9;
import com.fsck.k9.NotificationSetting;
import com.fsck.k9.Preferences;
@ -49,6 +46,8 @@ public class AccountSettings extends K9PreferenceActivity
private static final int ACTIVITY_MANAGE_IDENTITIES = 2;
private static final String PREFERENCE_SCREEN_COMPOSING = "composing";
private static final String PREFERENCE_DESCRIPTION = "account_description";
private static final String PREFERENCE_COMPOSITION = "composition";
private static final String PREFERENCE_MANAGE_IDENTITIES = "manage_identities";
@ -87,6 +86,7 @@ public class AccountSettings extends K9PreferenceActivity
private static final String PREFERENCE_MESSAGE_SIZE = "account_autodownload_size";
private static final String PREFERENCE_SAVE_ALL_HEADERS = "account_save_all_headers";
private static final String PREFERENCE_QUOTE_PREFIX = "account_quote_prefix";
private static final String PREFERENCE_QUOTE_STYLE = "quote_style";
private static final String PREFERENCE_REPLY_AFTER_QUOTE = "reply_after_quote";
private static final String PREFERENCE_SYNC_REMOTE_DELETIONS = "account_sync_remote_deletetions";
private static final String PREFERENCE_CRYPTO_APP = "crypto_app";
@ -108,6 +108,8 @@ public class AccountSettings extends K9PreferenceActivity
private boolean mIsPushCapable = false;
private boolean mIsExpungeCapable = false;
private PreferenceScreen mComposingScreen;
private EditTextPreference mAccountDescription;
private ListPreference mCheckFrequency;
private ListPreference mDisplayCount;
@ -138,6 +140,7 @@ public class AccountSettings extends K9PreferenceActivity
private Preference mLedColor;
private boolean mIncomingChanged = false;
private CheckBoxPreference mNotificationOpensUnread;
private ListPreference mQuoteStyle;
private EditTextPreference mAccountQuotePrefix;
private CheckBoxPreference mReplyAfterQuote;
private CheckBoxPreference mSyncRemoteDeletions;
@ -219,6 +222,33 @@ public class AccountSettings extends K9PreferenceActivity
mReplyAfterQuote = (CheckBoxPreference) findPreference(PREFERENCE_REPLY_AFTER_QUOTE);
mReplyAfterQuote.setChecked(mAccount.isReplyAfterQuote());
mComposingScreen = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_COMPOSING);
mQuoteStyle = (ListPreference) findPreference(PREFERENCE_QUOTE_STYLE);
mQuoteStyle.setValue(mAccount.getQuoteStyle().name());
mQuoteStyle.setSummary(mQuoteStyle.getEntry());
mQuoteStyle.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
{
@Override
public boolean onPreferenceChange(Preference preference, Object newValue)
{
final QuoteStyle style = QuoteStyle.valueOf(newValue.toString());
int index = mQuoteStyle.findIndexOfValue(newValue.toString());
mQuoteStyle.setSummary(mQuoteStyle.getEntries()[index]);
if (style == QuoteStyle.PREFIX)
{
mComposingScreen.addPreference(mAccountQuotePrefix);
mComposingScreen.addPreference(mReplyAfterQuote);
}
else if (style == QuoteStyle.HEADER)
{
mComposingScreen.removePreference(mAccountQuotePrefix);
mComposingScreen.removePreference(mReplyAfterQuote);
}
return true;
}
});
mCheckFrequency = (ListPreference) findPreference(PREFERENCE_FREQUENCY);
mCheckFrequency.setValue(String.valueOf(mAccount.getAutomaticCheckIntervalMinutes()));
mCheckFrequency.setSummary(mCheckFrequency.getEntry());
@ -716,6 +746,7 @@ public class AccountSettings extends K9PreferenceActivity
mAccount.setSyncRemoteDeletions(mSyncRemoteDeletions.isChecked());
mAccount.setSaveAllHeaders(mSaveAllHeaders.isChecked());
mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue()));
mAccount.setQuoteStyle(QuoteStyle.valueOf(mQuoteStyle.getValue()));
mAccount.setQuotePrefix(mAccountQuotePrefix.getText());
mAccount.setReplyAfterQuote(mReplyAfterQuote.isChecked());
mAccount.setCryptoApp(mCryptoApp.getValue());