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

Merge pull request #400 from zjw/change_line_endings

Fix problems related to the saving and retrieval of drafts
This commit is contained in:
cketti 2013-10-19 21:22:29 +02:00
commit ef3ba02a89
34 changed files with 221 additions and 181 deletions

View File

@ -216,7 +216,8 @@
<!-- We have to use "wrap_content" (not "0dip") for "layout_height", otherwise the
EditText won't properly grow in height while the user is typing the message -->
<EditText
<view
class="com.fsck.k9.activity.MessageCompose$EolConvertingEditText"
android:id="@+id/message_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -228,7 +229,8 @@
android:minLines="3"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
<view
class="com.fsck.k9.activity.MessageCompose$EolConvertingEditText"
android:id="@+id/upper_signature"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -256,7 +258,8 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
<view
class="com.fsck.k9.activity.MessageCompose$EolConvertingEditText"
android:id="@+id/quoted_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -298,7 +301,8 @@
</RelativeLayout>
<EditText
<view
class="com.fsck.k9.activity.MessageCompose$EolConvertingEditText"
android:id="@+id/lower_signature"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

View File

@ -263,7 +263,7 @@ Si us plau, envia\'ns els errors, contribueix a millorar-lo a
<string name="message_compose_quote_header_from">De:</string>
<string name="message_compose_quote_header_to">A:</string>
<string name="message_compose_quote_header_cc">A/c:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> ha escrit:\n</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> ha escrit:</string>
<string name="message_compose_error_no_recipients">Has d\'afegir-hi, com a mínim, un destinatari.</string>
<string name="error_contact_address_not_found">No s\'ha trobat cap adreça de correu.</string>
<string name="message_compose_attachments_skipped_toast">Alguns adjunts no es poden reenviar perquè no s\'han carregat.</string>

View File

@ -267,7 +267,7 @@ Posílejte prosím chybová hlášení, přispívejte novými funkcemi a ptejte
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> napsal(a):</string>
<string name="message_compose_error_no_recipients">Musíte přidat alespoň jednoho příjemce.</string>
<string name="error_contact_address_not_found">Nemohla být nalezena adresa.</string>
<string name="message_compose_attachments_skipped_toast">Některé přílohy nelze přeposlat, protože ještě nebyly staženy.</string>

View File

@ -263,7 +263,7 @@ Vær venlig at sende fejlrapporter, anmodning om nye funktioner, og spørgsmål
<string name="message_compose_quote_header_from">Fra:</string>
<string name="message_compose_quote_header_to">Til:</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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> skrev:</string>
<string name="message_compose_error_no_recipients">Du skal angive mindst én modtager.</string>
<string name="error_contact_address_not_found">Mail addresse ikke fundet.</string>
<string name="message_compose_attachments_skipped_toast">Nogle vedhæftninger kunne ikke videresendes fordi de ikke er blevet hentet fra server.</string>

View File

@ -263,7 +263,7 @@ Um Fehler zu melden, neue Funktionen vorzuschlagen oder Fragen zu stellen, besuc
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> schrieb:</string>
<string name="message_compose_error_no_recipients">Sie müssen mindestens einen Empfänger wählen.</string>
<string name="error_contact_address_not_found">Es wurde keine E-Mail-Adresse für diesen Kontakt gefunden.</string>
<string name="message_compose_attachments_skipped_toast">Einige Anhänge können nicht weitergeleitet werden, da diese nicht heruntergeladen wurden.</string>

View File

@ -258,7 +258,7 @@
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> έγραψε:</string>
<string name="message_compose_error_no_recipients">Πρέπει να συμπεριλάβετε τουλάχιστον έναν παραλήπτη.</string>
<string name="error_contact_address_not_found">Δεν βρέθηκαν διευθύνσεις ηλεκτρονικού ταχυδρομείου.</string>
<string name="message_compose_attachments_skipped_toast">Μερικά συνημμένα δεν μπορούν να προωθηθούν γιατί δεν έχουν κατεβεί.</string>

View File

@ -262,7 +262,7 @@ Por favor, envía los errores detectados, contribuye con nuevas funcionalidades
<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> escribió:\n</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> escribió:</string>
<string name="message_compose_error_no_recipients">Debe añadir al menos un destinatario</string>
<string name="error_contact_address_not_found">Dirección e-mail no encontrada.</string>
<string name="message_compose_attachments_skipped_toast">Algunos adjuntos no pueden reenviarse porque no han sido descargados.</string>

View File

@ -264,7 +264,7 @@ Virheraportit, osallistuminen projektiin ja kysymykset: Mene osoitteeseen
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> kirjoitti:</string>
<string name="message_compose_error_no_recipients">Valitse vähintään yksi vastaanottaja.</string>
<string name="error_contact_address_not_found">Tämän henkilön sähköpostiosoitetta ei löytynyt.</string>
<string name="message_compose_attachments_skipped_toast">Joitakin liitteitä ei voida lähettää edelleen, koska niitä ei ole ladattu.</string>

View File

@ -288,7 +288,7 @@ de plus</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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> a écrit\u00A0:</string>
<string name="message_compose_error_no_recipients">Vous devez ajouter au moins un destinataire.</string>
<string name="error_contact_address_not_found">Aucune adresse e-mail trouvée</string>
<string name="message_compose_attachments_skipped_toast">Certaines pièces jointes ne peuvent pas être transmises car elles n\'ont pas été téléchargées.</string>

View File

@ -262,7 +262,7 @@ Por favor, envía os erros detectados, contribúe con novas funcionalidas e preg
<string name="message_compose_quote_header_from">Dende:</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> escribiu:\n</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> escribiu:</string>
<string name="message_compose_error_no_recipients">Debes engadir un destinatario</string>
<string name="error_contact_address_not_found">Non atopo enderezo electrónico.</string>
<string name="message_compose_attachments_skipped_toast">Algúns adxuntos non poden reenviarse porque non foron descargados.</string>

View File

@ -263,7 +263,7 @@ Hibajelentéseivel hozzájárul az újabb verziók tökéletesítéséhez, kérd
<string name="message_compose_quote_header_from">Feladó:</string>
<string name="message_compose_quote_header_to">Címzett:</string>
<string name="message_compose_quote_header_cc">Másolat:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> írta:\n</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> írta:</string>
<string name="message_compose_error_no_recipients">Legalább egy címzetted adjon meg.</string>
<string name="error_contact_address_not_found">E-mail cím nem található.</string>
<string name="message_compose_attachments_skipped_toast">Néhány mellékletet nem lehet továbbítani, mert nem lettek letöltve.</string>

View File

@ -263,7 +263,7 @@ Invia le tue segnalazioni, suggerisci nuove funzionalità e chiedi informazioni
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> ha scritto:</string>
<string name="message_compose_error_no_recipients">È necessario specificare almeno un destinatario.</string>
<string name="error_contact_address_not_found">Nessun indirizzo email trovato.</string>
<string name="message_compose_attachments_skipped_toast">Alcuni allegati non possono essere inoltrati in quanto non sono stati scaricati.</string>

View File

@ -263,7 +263,7 @@
<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> כותב:\n</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> כותב:</string>
<string name="message_compose_error_no_recipients">עליך להוסיף לפחות נמען אחד.</string>
<string name="error_contact_address_not_found">לא ניתן למצוא כתובת דוא\"ל.</string>
<string name="message_compose_attachments_skipped_toast">קבצים מסוימים אינם ניתנים להעברה בגלל שהם לא הורדו.</string>

View File

@ -262,7 +262,7 @@ K-9 は大多数のメールクライアントと同様に、ほとんどのフ
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> wrote:</string>
<string name="message_compose_error_no_recipients">少なくとも1つの受信者を追加する必要があります</string>
<string name="error_contact_address_not_found">メールアドレスが登録されていません</string>
<string name="message_compose_attachments_skipped_toast">ダウンロードしていないため、一部の添付ファイルを転送することはできません。</string>

View File

@ -261,7 +261,7 @@ K-9 메일은 대부분의 무료 hotmail 계정을 지원하지 않으며, 다
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g>이 씀:</string>
<string name="message_compose_error_no_recipients">한 명 이상의 받는 사람을 입력하십시오.</string>
<string name="error_contact_address_not_found">이메일 주소를 찾을 수 없습니다.</string>
<string name="message_compose_attachments_skipped_toast">일부 첨부 파일이 다운로드되지 않아 전달될 수 없습니다.</string>

View File

@ -262,7 +262,7 @@ Graag foutrapporten, bijdrage nieuwe functies en vragen stellen op
<string name="message_compose_quote_header_from">Van:</string>
<string name="message_compose_quote_header_to">Aan:</string>
<string name="message_compose_quote_header_cc">CC:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> schreef:\n</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> schreef:</string>
<string name="message_compose_error_no_recipients">Minimaal 1 ontvanger kiezen.</string>
<string name="error_contact_address_not_found">Geen e-mailadres gevonden.</string>
<string name="message_compose_attachments_skipped_toast">Sommige bijlagen kunnen niet worden doorgestuurd omdat ze niet zijn gedownload.</string>

View File

@ -268,7 +268,7 @@ Wszelkie zgłoszenia usterek, zapytania oraz nowe pomysły prosimy przesyłać z
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> napisał:</string>
<string name="message_compose_error_no_recipients">Musisz dodać co najmniej jednego odbiorcę.</string>
<string name="error_contact_address_not_found">Żaden adres email nie został znaleziony.</string>
<string name="message_compose_attachments_skipped_toast">Niektóre załączniki nie mogą być przesłane dalej ponieważ nie zostały wcześniej pobrane.</string>

View File

@ -259,7 +259,7 @@ Por favor, nos envie relatórios de bugs, contribua para novas melhorias e faça
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> escreveu:</string>
<string name="message_compose_error_no_recipients">Você deve incluir ao menos um destinatário.</string>
<string name="error_contact_address_not_found">Não foi possível encontrar o endereço de e-mail.</string>
<string name="message_compose_attachments_skipped_toast">Alguns anexos não podem ser encaminhados porque não foram inclusos na mensagem.</string>

View File

@ -258,7 +258,7 @@ K-9 Mail — почтовый клиент для Android.
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> пишет:</string>
<string name="message_compose_error_no_recipients">Укажите адресата</string>
<string name="error_contact_address_not_found">Контакт не содержит сведений о email</string>
<string name="message_compose_attachments_skipped_toast">Некоторые вложения не были загружены и не могут быть отправлены</string>

View File

@ -263,7 +263,7 @@ Prosím nahlasujte prípadné chyby, prispievajte novými funkciami a pýtajte s
<string name="message_compose_quote_header_from">Od:</string>
<string name="message_compose_quote_header_to">Komu:</string>
<string name="message_compose_quote_header_cc">Kópia:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> napísal(-a):\n</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> napísal(-a):</string>
<string name="message_compose_error_no_recipients">Musíte pridať aspoň jedného príjemcu.</string>
<string name="error_contact_address_not_found">Nebola nájdená žiadna e-mailová adresa pre tento kontakt.</string>
<string name="message_compose_attachments_skipped_toast">Niektoré prílohy nemožno preposlať, pretože neboli stiahnuté.</string>

View File

@ -263,7 +263,7 @@ Vänligen skicka felrapporter, hjälp till med nya funktioner och ställ frågor
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> skrev:</string>
<string name="message_compose_error_no_recipients">Du måste ange åtminstone en mottagare.</string>
<string name="error_contact_address_not_found">Kan inte hitta e-postadress för denna kontakt.</string>
<string name="message_compose_attachments_skipped_toast">Några bilagor kan inte vidarebefordras eftersom de inte har hämtats.</string>

View File

@ -263,7 +263,7 @@ Lütfen hata raporlarınızı, istediğiniz yeni özellikleri ve sorularınızı
<string name="message_compose_quote_header_from">Kimden:</string>
<string name="message_compose_quote_header_to">Alıcı:</string>
<string name="message_compose_quote_header_cc">Cc:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> yazdı:\n</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> yazdı:</string>
<string name="message_compose_error_no_recipients">En az bir Alıcı eklemelisiniz.</string>
<string name="error_contact_address_not_found">E-posta adresi bulunamadı.</string>
<string name="message_compose_attachments_skipped_toast">Bazı ekler iletilemedi çünkü indirilemedi.</string>

View File

@ -263,7 +263,7 @@ K-9 Mail це поштовий клієнт з відкритим вихідни
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> написав(ла):</string>
<string name="message_compose_error_no_recipients">Вам необхідно додати хоча б одного одержувача.</string>
<string name="error_contact_address_not_found">Не знайденої адреси електронної пошти.</string>
<string name="message_compose_attachments_skipped_toast">Деякі вкладення не можуть бути переслані бо вони не завантажилися.</string>

View File

@ -256,7 +256,7 @@ K-9改进的功能包括
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g>写到:</string>
<string name="message_compose_error_no_recipients">您必须添加至少一个收件人。</string>
<string name="error_contact_address_not_found">没有找到收件地址。</string>
<string name="message_compose_attachments_skipped_toast">由于一些附件还没有被下载,因此无法转发这些附件。</string>

View File

@ -230,9 +230,7 @@
<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">"%s寫到:
"</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g>寫到:</string>
<string name="message_compose_error_no_recipients">至少必須加入一位收件人。</string>
<string name="error_contact_address_not_found">沒有發現電子郵件地址</string>
<string name="message_compose_attachments_skipped_toast">由於一些附件還沒有被下載,因此無法轉寄這些附件。</string>

View File

@ -268,7 +268,7 @@ Please submit bug reports, contribute new features and ask questions at
<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</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> wrote:</string>
<string name="message_compose_error_no_recipients">You must add at least one recipient.</string>
<string name="error_contact_address_not_found">No email address could be found for this contact.</string>
<string name="message_compose_attachments_skipped_toast">Some attachments cannot be forwarded because they have not been downloaded.</string>

View File

@ -19,6 +19,7 @@ import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.text.TextWatcher;
import android.text.util.Rfc822Tokenizer;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
@ -273,14 +274,14 @@ public class MessageCompose extends K9Activity implements OnClickListener,
private MultiAutoCompleteTextView mCcView;
private MultiAutoCompleteTextView mBccView;
private EditText mSubjectView;
private EditText mSignatureView;
private EditText mMessageContentView;
private EolConvertingEditText mSignatureView;
private EolConvertingEditText mMessageContentView;
private LinearLayout mAttachments;
private Button mQuotedTextShow;
private View mQuotedTextBar;
private ImageButton mQuotedTextEdit;
private ImageButton mQuotedTextDelete;
private EditText mQuotedText;
private EolConvertingEditText mQuotedText;
private MessageWebView mQuotedHTML;
private InsertableHtmlContent mQuotedHtmlContent; // Container for HTML reply as it's being built.
private View mEncryptLayout;
@ -588,10 +589,10 @@ public class MessageCompose extends K9Activity implements OnClickListener,
onAddCcBcc();
}
EditText upperSignature = (EditText)findViewById(R.id.upper_signature);
EditText lowerSignature = (EditText)findViewById(R.id.lower_signature);
EolConvertingEditText upperSignature = (EolConvertingEditText)findViewById(R.id.upper_signature);
EolConvertingEditText lowerSignature = (EolConvertingEditText)findViewById(R.id.lower_signature);
mMessageContentView = (EditText)findViewById(R.id.message_content);
mMessageContentView = (EolConvertingEditText)findViewById(R.id.message_content);
mMessageContentView.getInputExtras(true).putBoolean("allowEmoji", true);
mAttachments = (LinearLayout)findViewById(R.id.attachments);
@ -599,7 +600,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
mQuotedTextBar = findViewById(R.id.quoted_text_bar);
mQuotedTextEdit = (ImageButton)findViewById(R.id.quoted_text_edit);
mQuotedTextDelete = (ImageButton)findViewById(R.id.quoted_text_delete);
mQuotedText = (EditText)findViewById(R.id.quoted_text);
mQuotedText = (EolConvertingEditText)findViewById(R.id.quoted_text);
mQuotedText.getInputExtras(true).putBoolean("allowEmoji", true);
mQuotedHTML = (MessageWebView) findViewById(R.id.quoted_html);
@ -949,7 +950,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
CharSequence text = intent.getCharSequenceExtra(Intent.EXTRA_TEXT);
// Only use EXTRA_TEXT if the body hasn't already been set by the mailto URI
if (text != null && mMessageContentView.getText().length() == 0) {
mMessageContentView.setText(text);
mMessageContentView.setCharacters(text);
}
String type = intent.getType();
@ -1307,7 +1308,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
boolean signatureBeforeQuotedText = mAccount.isSignatureBeforeQuotedText();
// Get the user-supplied text
String text = mMessageContentView.getText().toString();
String text = mMessageContentView.getCharacters();
// Handle HTML separate from the rest of the text content
if (messageFormat == SimpleMessageFormat.HTML) {
@ -1390,13 +1391,13 @@ public class MessageCompose extends K9Activity implements OnClickListener,
}
}
if (includeQuotedText) {
String quotedText = mQuotedText.getText().toString();
String quotedText = mQuotedText.getCharacters();
if (includeQuotedText && quotedText.length() > 0) {
if (replyAfterQuote) {
composedMessageOffset = quotedText.length() + "\n".length();
text = quotedText + "\n" + text;
composedMessageOffset = quotedText.length() + "\r\n".length();
text = quotedText + "\r\n" + text;
} else {
text += "\n\n" + quotedText.toString();
text += "\r\n\r\n" + quotedText.toString();
}
}
@ -1540,7 +1541,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
* header value (all parameters at once) will be encoded by
* MimeHeader.writeTo().
*/
bp.addHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\n name=\"%s\"",
bp.addHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\r\n name=\"%s\"",
contentType,
EncoderUtil.encodeIfNecessary(attachment.name,
EncoderUtil.Usage.WORD_ENTITY, 7)));
@ -1563,7 +1564,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
* title*3="isn't it!"
*/
bp.addHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format(
"attachment;\n filename=\"%s\";\n size=%d",
"attachment;\r\n filename=\"%s\";\r\n size=%d",
attachment.name, attachment.size));
mp.addBodyPart(bp);
@ -1661,7 +1662,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
// If we're not using the standard identity of signature, append it on to the identity blob.
if (mIdentity.getSignatureUse() && mSignatureChanged) {
uri.appendQueryParameter(IdentityField.SIGNATURE.value(), mSignatureView.getText().toString());
uri.appendQueryParameter(IdentityField.SIGNATURE.value(), mSignatureView.getCharacters());
}
if (mIdentityChanged) {
@ -1766,10 +1767,10 @@ public class MessageCompose extends K9Activity implements OnClickListener,
private String appendSignature(String originalText) {
String text = originalText;
if (mIdentity.getSignatureUse()) {
String signature = mSignatureView.getText().toString();
String signature = mSignatureView.getCharacters();
if (signature != null && !signature.contentEquals("")) {
text += "\n" + signature;
text += "\r\n" + signature;
}
}
@ -1783,9 +1784,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
private String getSignatureHtml() {
String signature = "";
if (mIdentity.getSignatureUse()) {
signature = mSignatureView.getText().toString();
signature = mSignatureView.getCharacters();
if(!StringUtils.isNullOrEmpty(signature)) {
signature = HtmlConverter.textToHtmlFragment("\n" + signature);
signature = HtmlConverter.textToHtmlFragment("\r\n" + signature);
}
}
return signature;
@ -2320,7 +2321,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
private void updateSignature() {
if (mIdentity.getSignatureUse()) {
mSignatureView.setText(mIdentity.getSignature());
mSignatureView.setCharacters(mIdentity.getSignature());
mSignatureView.setVisibility(View.VISIBLE);
} else {
mSignatureView.setVisibility(View.GONE);
@ -3006,7 +3007,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
// we'll display the whole message (including the quoted part) in the
// composition window. If that's the case, try and convert it to text to
// match the behavior in text mode.
mMessageContentView.setText(getBodyTextFromMessage(message, SimpleMessageFormat.TEXT));
mMessageContentView.setCharacters(getBodyTextFromMessage(message, SimpleMessageFormat.TEXT));
mForcePlainText = true;
showOrHideQuotedText(quotedMode);
@ -3023,9 +3024,15 @@ public class MessageCompose extends K9Activity implements OnClickListener,
Log.d(K9.LOG_TAG, "Loading message with offset " + bodyOffset + ", length " + bodyLength + ". Text length is " + text.length() + ".");
}
if (bodyOffset + bodyLength > text.length()) {
// The draft was edited outside of K-9 Mail?
Log.d(K9.LOG_TAG, "The identity field from the draft contains an invalid LENGTH/OFFSET");
bodyOffset = 0;
bodyLength = 0;
}
// Grab our reply text.
String bodyText = text.substring(bodyOffset, bodyOffset + bodyLength);
mMessageContentView.setText(HtmlConverter.htmlToText(bodyText));
mMessageContentView.setCharacters(HtmlConverter.htmlToText(bodyText));
// Regenerate the quoted html without our user content in it.
StringBuilder quotedHTML = new StringBuilder();
@ -3064,7 +3071,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
showOrHideQuotedText(quotedMode);
}
/*
/**
* Pull out the parts of the now loaded source message and apply them to the new message
* depending on the type of message being composed.
* @param message Source message
@ -3084,27 +3091,40 @@ public class MessageCompose extends K9Activity implements OnClickListener,
// If we had a body length (and it was valid), separate the composition from the quoted text
// and put them in their respective places in the UI.
if (bodyLength != null && bodyLength + 1 < text.length()) { // + 1 to get rid of the newline we added when saving the draft
if (bodyLength > 0) {
try {
String bodyText = text.substring(bodyOffset, bodyOffset + bodyLength);
// Regenerate the quoted text without our user content in it nor added newlines.
StringBuilder quotedText = new StringBuilder();
if (bodyOffset == 0 && text.substring(bodyLength, bodyLength + 2).equals("\n\n")) {
if (bodyOffset == 0 && text.substring(bodyLength, bodyLength + 4).equals("\r\n\r\n")) {
// top-posting: ignore two newlines at start of quote
quotedText.append(text.substring(bodyLength + 2));
quotedText.append(text.substring(bodyLength + 4));
} else if (bodyOffset + bodyLength == text.length() &&
text.substring(bodyOffset - 1, bodyOffset).equals("\n")) {
text.substring(bodyOffset - 2, bodyOffset).equals("\r\n")) {
// bottom-posting: ignore newline at end of quote
quotedText.append(text.substring(0, bodyOffset - 1));
quotedText.append(text.substring(0, bodyOffset - 2));
} else {
quotedText.append(text.substring(0, bodyOffset)); // stuff before the reply
quotedText.append(text.substring(bodyOffset + bodyLength));
}
if (viewMessageContent) mMessageContentView.setText(bodyText);
mQuotedText.setText(quotedText.toString());
if (viewMessageContent) {
mMessageContentView.setCharacters(bodyText);
}
mQuotedText.setCharacters(quotedText);
} catch (IndexOutOfBoundsException e) {
// Invalid bodyOffset or bodyLength. The draft was edited outside of K-9 Mail?
Log.d(K9.LOG_TAG, "The identity field from the draft contains an invalid bodyOffset/bodyLength");
if (viewMessageContent) {
mMessageContentView.setCharacters(text);
}
}
} else {
if (viewMessageContent) mMessageContentView.setText(text);
if (viewMessageContent) {
mMessageContentView.setCharacters(text);
}
}
}
}
@ -3228,7 +3248,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
mQuotedHTML.setText(mQuotedHtmlContent.getQuotedContent());
// TODO: Also strip the signature from the text/plain part
mQuotedText.setText(quoteOriginalTextMessage(mSourceMessage,
mQuotedText.setCharacters(quoteOriginalTextMessage(mSourceMessage,
getBodyTextFromMessage(mSourceMessage, SimpleMessageFormat.TEXT), mQuoteStyle));
} else if (mQuotedTextFormat == SimpleMessageFormat.TEXT) {
@ -3239,7 +3259,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
}
}
mQuotedText.setText(quoteOriginalTextMessage(mSourceMessage, content, mQuoteStyle));
mQuotedText.setCharacters(quoteOriginalTextMessage(mSourceMessage, content, mQuoteStyle));
}
if (showQuotedText) {
@ -3308,7 +3328,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
private static final int FIND_INSERTION_POINT_FIRST_GROUP = 1;
// HTML bits to insert as appropriate
// TODO is it safe to assume utf-8 here?
private static final String FIND_INSERTION_POINT_HTML_CONTENT = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n<html>";
private static final String FIND_INSERTION_POINT_HTML_CONTENT = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\r\n<html>";
private static final String FIND_INSERTION_POINT_HTML_END_CONTENT = "</html>";
private static final String FIND_INSERTION_POINT_HEAD_CONTENT = "<head><meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\"></head>";
// Index of the start of the beginning of a String.
@ -3558,7 +3578,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
// Read message body from the "body" parameter.
List<String> body = uri.getQueryParameters("body");
if (!body.isEmpty()) {
mMessageContentView.setText(body.get(0));
mMessageContentView.setCharacters(body.get(0));
}
}
@ -3686,7 +3706,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
if (quoteStyle == QuoteStyle.PREFIX) {
StringBuilder quotedText = new StringBuilder(body.length() + QUOTE_BUFFER_LENGTH);
quotedText.append(String.format(
getString(R.string.message_compose_reply_header_fmt),
getString(R.string.message_compose_reply_header_fmt) + "\r\n",
Address.toString(originalMessage.getFrom()))
);
@ -3701,24 +3721,24 @@ public class MessageCompose extends K9Activity implements OnClickListener,
return quotedText.toString().replaceAll("\\\r", "");
} else if (quoteStyle == 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");
quotedText.append("\r\n");
quotedText.append(getString(R.string.message_compose_quote_header_separator)).append("\r\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");
quotedText.append(getString(R.string.message_compose_quote_header_from)).append(" ").append(Address.toString(originalMessage.getFrom())).append("\r\n");
}
if (originalMessage.getSentDate() != null) {
quotedText.append(getString(R.string.message_compose_quote_header_send_date)).append(" ").append(originalMessage.getSentDate()).append("\n");
quotedText.append(getString(R.string.message_compose_quote_header_send_date)).append(" ").append(originalMessage.getSentDate()).append("\r\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");
quotedText.append(getString(R.string.message_compose_quote_header_to)).append(" ").append(Address.toString(originalMessage.getRecipients(RecipientType.TO))).append("\r\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");
quotedText.append(getString(R.string.message_compose_quote_header_cc)).append(" ").append(Address.toString(originalMessage.getRecipients(RecipientType.CC))).append("\r\n");
}
if (originalMessage.getSubject() != null) {
quotedText.append(getString(R.string.message_compose_quote_header_subject)).append(" ").append(originalMessage.getSubject()).append("\n");
quotedText.append(getString(R.string.message_compose_quote_header_subject)).append(" ").append(originalMessage.getSubject()).append("\r\n");
}
quotedText.append("\n");
quotedText.append("\r\n");
quotedText.append(body);
@ -3743,13 +3763,12 @@ public class MessageCompose extends K9Activity implements OnClickListener,
if (quoteStyle == QuoteStyle.PREFIX) {
StringBuilder header = new StringBuilder(QUOTE_BUFFER_LENGTH);
header.append("<div class=\"gmail_quote\">");
// Remove all trailing newlines so that the quote starts immediately after the header. "Be like Gmail!"
header.append(HtmlConverter.textToHtmlFragment(String.format(
getString(R.string.message_compose_reply_header_fmt).replaceAll("\n$", ""),
getString(R.string.message_compose_reply_header_fmt),
Address.toString(originalMessage.getFrom()))
));
header.append("<blockquote class=\"gmail_quote\" " +
"style=\"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;\">\n");
"style=\"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;\">\r\n");
String footer = "</blockquote></div>";
@ -3758,35 +3777,35 @@ public class MessageCompose extends K9Activity implements OnClickListener,
} else if (quoteStyle == QuoteStyle.HEADER) {
StringBuilder header = new StringBuilder();
header.append("<div style='font-size:10.0pt;font-family:\"Tahoma\",\"sans-serif\";padding:3.0pt 0in 0in 0in'>\n");
header.append("<hr style='border:none;border-top:solid #E1E1E1 1.0pt'>\n"); // This gets converted into a horizontal line during html to text conversion.
header.append("<div style='font-size:10.0pt;font-family:\"Tahoma\",\"sans-serif\";padding:3.0pt 0in 0in 0in'>\r\n");
header.append("<hr style='border:none;border-top:solid #E1E1E1 1.0pt'>\r\n"); // This gets converted into a horizontal line during html to text conversion.
if (mSourceMessage.getFrom() != null && Address.toString(mSourceMessage.getFrom()).length() != 0) {
header.append("<b>").append(getString(R.string.message_compose_quote_header_from)).append("</b> ")
.append(HtmlConverter.textToHtmlFragment(Address.toString(mSourceMessage.getFrom())))
.append("<br>\n");
.append("<br>\r\n");
}
if (mSourceMessage.getSentDate() != null) {
header.append("<b>").append(getString(R.string.message_compose_quote_header_send_date)).append("</b> ")
.append(mSourceMessage.getSentDate())
.append("<br>\n");
.append("<br>\r\n");
}
if (mSourceMessage.getRecipients(RecipientType.TO) != null && mSourceMessage.getRecipients(RecipientType.TO).length != 0) {
header.append("<b>").append(getString(R.string.message_compose_quote_header_to)).append("</b> ")
.append(HtmlConverter.textToHtmlFragment(Address.toString(mSourceMessage.getRecipients(RecipientType.TO))))
.append("<br>\n");
.append("<br>\r\n");
}
if (mSourceMessage.getRecipients(RecipientType.CC) != null && mSourceMessage.getRecipients(RecipientType.CC).length != 0) {
header.append("<b>").append(getString(R.string.message_compose_quote_header_cc)).append("</b> ")
.append(HtmlConverter.textToHtmlFragment(Address.toString(mSourceMessage.getRecipients(RecipientType.CC))))
.append("<br>\n");
.append("<br>\r\n");
}
if (mSourceMessage.getSubject() != null) {
header.append("<b>").append(getString(R.string.message_compose_quote_header_subject)).append("</b> ")
.append(HtmlConverter.textToHtmlFragment(mSourceMessage.getSubject()))
.append("<br>\n");
.append("<br>\r\n");
}
header.append("</div>\n");
header.append("<br>\n");
header.append("</div>\r\n");
header.append("<br>\r\n");
insertable.insertIntoQuotedHeader(header.toString());
}
@ -3970,4 +3989,35 @@ public class MessageCompose extends K9Activity implements OnClickListener,
private boolean includeQuotedText() {
return (mQuotedTextMode == QuotedTextMode.SHOW);
}
/**
* An {@link EditText} extension with methods that convert line endings from
* {@code \r\n} to {@code \n} and back again when setting and getting text.
*
*/
private static class EolConvertingEditText extends EditText {
public EolConvertingEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
/**
* Return the text the EolConvertingEditText is displaying.
*
* @return A string with any line endings converted to {@code \r\n}.
*/
public String getCharacters() {
return getText().toString().replace("\n", "\r\n");
}
/**
* Sets the string value of the EolConvertingEditText. Any line endings
* in the string will be converted to {@code \n}.
*
* @param text
*/
public void setCharacters(CharSequence text) {
setText(text.toString().replace("\r\n", "\n"));
}
}
}

View File

@ -70,7 +70,7 @@ public class HtmlConverter {
if (tag.equals("hr") && opening) {
// In the case of an <hr>, replace it with a bunch of underscores. This is roughly
// the behaviour of Outlook in Rich Text mode.
output.append("_____________________________________________\n");
output.append("_____________________________________________\r\n");
} else if (TAGS_WITH_IGNORED_CONTENT.contains(tag)) {
handleIgnoredTag(opening, output);
}
@ -282,11 +282,16 @@ public class HtmlConverter {
// Replace lines of -,= or _ with horizontal rules
text = text.replaceAll("\\s*([-=_]{30,}+)\\s*", "<hr />");
// TODO: reverse engineer (or troll history) and document
/*
* Unwrap multi-line paragraphs into single line paragraphs that are
* wrapped when displayed. But try to avoid unwrapping consecutive lines
* of text that are not paragraphs, such as lists of system log entries
* or long URLs that are on their own line.
*/
text = text.replaceAll("(?m)^([^\r\n]{4,}[\\s\\w,:;+/])(?:\r\n|\n|\r)(?=[a-z]\\S{0,10}[\\s\\n\\r])", "$1 ");
// Compress four or more newlines down to two newlines
text = text.replaceAll("(?m)(\r\n|\n|\r){4,}", "\n\n");
text = text.replaceAll("(?m)(\r\n|\n|\r){4,}", "\r\n\r\n");
StringBuffer sb = new StringBuffer(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH);
@ -1315,7 +1320,7 @@ public class HtmlConverter {
//
// For some reason, TextUtils.htmlEncode escapes ' into &apos;, which is technically part of the XHTML 1.0
// standard, but Gmail doesn't recognize it as an HTML entity. We unescape that here.
return linkified.toString().replace("\n", "<br>\n").replace("&apos;", "&#39;");
return linkified.toString().replaceAll("\r?\n", "<br>\r\n").replace("&apos;", "&#39;");
}
/**
@ -1345,10 +1350,10 @@ public class HtmlConverter {
lastChar = output.charAt(output.length() - 1);
}
if (lastChar != '\n') {
output.append("\n");
output.append("\r\n");
}
} else {
output.append("\n");
output.append("\r\n");
}
}
@ -1356,7 +1361,7 @@ public class HtmlConverter {
if (opening) {
output.append("\t• ");
} else {
output.append("\n");
output.append("\r\n");
}
}
}

View File

@ -282,7 +282,7 @@ public class Utility {
StringBuilder result = new StringBuilder();
for (String piece : str.split(NEWLINE_REGEX)) {
result.append(wrap(piece, wrapLength, null, false));
result.append("\n");
result.append("\r\n");
}
return result.toString();
}
@ -330,7 +330,7 @@ public class Utility {
return null;
}
if (newLineStr == null) {
newLineStr = "\n";
newLineStr = "\r\n";
}
if (wrapLength < 1) {
wrapLength = 1;

View File

@ -1732,7 +1732,7 @@ public class MimeUtility {
text.append(context.getString(R.string.message_compose_quote_header_from));
text.append(' ');
text.append(Address.toString(from));
text.append("\n");
text.append("\r\n");
}
// To: <recipients>
@ -1741,7 +1741,7 @@ public class MimeUtility {
text.append(context.getString(R.string.message_compose_quote_header_to));
text.append(' ');
text.append(Address.toString(to));
text.append("\n");
text.append("\r\n");
}
// Cc: <recipients>
@ -1750,7 +1750,7 @@ public class MimeUtility {
text.append(context.getString(R.string.message_compose_quote_header_cc));
text.append(' ');
text.append(Address.toString(cc));
text.append("\n");
text.append("\r\n");
}
// Date: <date>
@ -1759,7 +1759,7 @@ public class MimeUtility {
text.append(context.getString(R.string.message_compose_quote_header_send_date));
text.append(' ');
text.append(date.toString());
text.append("\n");
text.append("\r\n");
}
// Subject: <subject>
@ -1771,7 +1771,7 @@ public class MimeUtility {
} else {
text.append(subject);
}
text.append("\n\n");
text.append("\r\n\r\n");
}
/**
@ -1919,7 +1919,7 @@ public class MimeUtility {
if (prependDivider) {
String filename = getPartName(part);
text.append("\n\n");
text.append("\r\n\r\n");
int len = filename.length();
if (len > 0) {
if (len > TEXT_DIVIDER_LENGTH - FILENAME_PREFIX_LENGTH - FILENAME_SUFFIX_LENGTH) {
@ -1934,7 +1934,7 @@ public class MimeUtility {
} else {
text.append(TEXT_DIVIDER);
}
text.append("\n\n");
text.append("\r\n\r\n");
}
}
@ -3416,7 +3416,7 @@ public class MimeUtility {
if (part.isMimeType("text/plain")) {
String bodyText = getTextFromPart(part);
if (bodyText != null) {
text = fixDraftTextBody(bodyText);
text = bodyText;
html = HtmlConverter.textToHtml(text);
}
} else if (part.isMimeType("multipart/alternative") &&
@ -3427,9 +3427,9 @@ public class MimeUtility {
String bodyText = getTextFromPart(bodyPart);
if (bodyText != null) {
if (text.length() == 0 && bodyPart.isMimeType("text/plain")) {
text = fixDraftTextBody(bodyText);
text = bodyText;
} else if (html.length() == 0 && bodyPart.isMimeType("text/html")) {
html = fixDraftTextBody(bodyText);
html = bodyText;
}
}
}
@ -3437,21 +3437,4 @@ public class MimeUtility {
return new ViewableContainer(text, html, attachments);
}
/**
* Fix line endings of text bodies in draft messages.
*
* <p>
* We create drafts with LF line endings. The values in the identity header are based on that.
* So we replace CRLF with LF when loading messages (from the server).
* </p>
*
* @param text
* The body text with CRLF line endings
*
* @return The text with LF line endings
*/
private static String fixDraftTextBody(String text) {
return text.replace("\r\n", "\n");
}
}

View File

@ -1917,7 +1917,7 @@ public class ImapStore extends Store {
* of them.
*/
for (int i = 0, count = bodyParams.size(); i < count; i += 2) {
contentType.append(String.format(";\n %s=\"%s\"",
contentType.append(String.format(";\r\n %s=\"%s\"",
bodyParams.getString(i),
bodyParams.getString(i + 1)));
}
@ -1952,7 +1952,7 @@ public class ImapStore extends Store {
* about the attachment out.
*/
for (int i = 0, count = bodyDispositionParams.size(); i < count; i += 2) {
contentDisposition.append(String.format(";\n %s=\"%s\"",
contentDisposition.append(String.format(";\r\n %s=\"%s\"",
bodyDispositionParams.getString(i).toLowerCase(Locale.US),
bodyDispositionParams.getString(i + 1)));
}
@ -1960,7 +1960,7 @@ public class ImapStore extends Store {
}
if (MimeUtility.getHeaderParameter(contentDisposition.toString(), "size") == null) {
contentDisposition.append(String.format(";\n size=%d", size));
contentDisposition.append(String.format(";\r\n size=%d", size));
}
/*

View File

@ -1964,18 +1964,18 @@ public class LocalStore extends Store implements Serializable {
bp.setEncoding(encoding);
if (name != null) {
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
String.format("%s;\n name=\"%s\"",
String.format("%s;\r\n name=\"%s\"",
type,
name));
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION,
String.format("%s;\n filename=\"%s\";\n size=%d",
String.format("%s;\r\n filename=\"%s\";\r\n size=%d",
contentDisposition,
name, // TODO: Should use encoded word defined in RFC 2231.
size));
} else {
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE, type);
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION,
String.format("%s;\n size=%d",
String.format("%s;\r\n size=%d",
contentDisposition,
size));
}

View File

@ -12,16 +12,16 @@ public class HtmlConverterTest extends TestCase {
private static final String OUTPUT_FILE = "C:/temp/parse.html";
public void testTextQuoteToHtmlBlockquote() {
String message = "Panama!\n" +
"\n" +
"Bob Barker <bob@aol.com> wrote:\n" +
"> a canal\n" +
">\n" +
"> Dorothy Jo Gideon <dorothy@aol.com> espoused:\n" +
"> >A man, a plan...\n" +
"> Too easy!\n" +
"\n" +
"Nice job :)\n" +
String message = "Panama!\r\n" +
"\r\n" +
"Bob Barker <bob@aol.com> wrote:\r\n" +
"> a canal\r\n" +
">\r\n" +
"> Dorothy Jo Gideon <dorothy@aol.com> espoused:\r\n" +
"> >A man, a plan...\r\n" +
"> Too easy!\r\n" +
"\r\n" +
"Nice job :)\r\n" +
">> Guess!";
String result = HtmlConverter.textToHtml(message);
writeToFile(result);
@ -49,13 +49,13 @@ public class HtmlConverterTest extends TestCase {
}
public void testTextQuoteToHtmlBlockquoteIndented() {
String message = "*facepalm*\n" +
"\n" +
"Bob Barker <bob@aol.com> wrote:\n" +
"> A wise man once said...\n" +
">\n" +
"> LOL F1RST!!!!!\n" +
">\n" +
String message = "*facepalm*\r\n" +
"\r\n" +
"Bob Barker <bob@aol.com> wrote:\r\n" +
"> A wise man once said...\r\n" +
">\r\n" +
"> LOL F1RST!!!!!\r\n" +
">\r\n" +
"> :)";
String result = HtmlConverter.textToHtml(message);
writeToFile(result);
@ -84,12 +84,12 @@ public class HtmlConverterTest extends TestCase {
assertEquals(HtmlConverter.getQuoteColor(0), HtmlConverter.QUOTE_COLOR_DEFAULT);
assertEquals(HtmlConverter.getQuoteColor(6), HtmlConverter.QUOTE_COLOR_DEFAULT);
String message = "zero\n" +
"> one\n" +
">> two\n" +
">>> three\n" +
">>>> four\n" +
">>>>> five\n" +
String message = "zero\r\n" +
"> one\r\n" +
">> two\r\n" +
">>> three\r\n" +
">>>> four\r\n" +
">>>>> five\r\n" +
">>>>>> six";
String result = HtmlConverter.textToHtml(message);
writeToFile(result);
@ -136,9 +136,9 @@ public class HtmlConverterTest extends TestCase {
}
public void testPreserveSpacesAtFirst() {
String message = "foo\n"
+ " bar\n"
+ " baz\n";
String message = "foo\r\n"
+ " bar\r\n"
+ " baz\r\n";
String result = HtmlConverter.textToHtml(message);
writeToFile(result);
assertEquals("<pre class=\"k9mail\">"
@ -150,11 +150,11 @@ public class HtmlConverterTest extends TestCase {
public void testPreserveSpacesAtFirstForSpecialCharacters() {
String message =
" \n"
+ " &\n"
+ " \r\n"
+ " <\n"
+ " > \n";
" \r\n"
+ " &\r\n"
+ " \n"
+ " <\r\n"
+ " > \r\n";
String result = HtmlConverter.textToHtml(message);
writeToFile(result);
assertEquals("<pre class=\"k9mail\">"

View File

@ -81,8 +81,8 @@ public class ViewablesTest extends AndroidTestCase {
ViewableContainer container = MimeUtility.extractTextAndAttachments(getContext(), message);
String expectedText =
bodyText1 + "\n\n" +
"------------------------------------------------------------------------\n\n" +
bodyText1 + "\r\n\r\n" +
"------------------------------------------------------------------------\r\n\r\n" +
bodyText2;
String expectedHtml =
"<pre class=\"k9mail\">" +
@ -138,14 +138,14 @@ public class ViewablesTest extends AndroidTestCase {
String expectedText =
bodyText +
"\n\n" +
"\r\n\r\n" +
"----- message.eml ------------------------------------------------------" +
"\n\n" +
"From: from@example.com" + "\n" +
"To: to@example.com" + "\n" +
"Sent: Sat Mar 17 00:00:00 GMT+01:00 2012" + "\n" +
"Subject: Subject" + "\n" +
"\n" +
"\r\n\r\n" +
"From: from@example.com" + "\r\n" +
"To: to@example.com" + "\r\n" +
"Sent: Sat Mar 17 00:00:00 GMT+01:00 2012" + "\r\n" +
"Subject: Subject" + "\r\n" +
"\r\n" +
innerBodyText;
String expectedHtml =
"<pre class=\"k9mail\">" +