From fcb79a75fb93dbfc0d574c1f57f1d9258cbc671a Mon Sep 17 00:00:00 2001 From: "rhp%netscape.com" Date: Fri, 12 Nov 1999 02:58:22 +0000 Subject: [PATCH] Changes for multipart alternative UI - Bug #: 17770 - r: jefft git-svn-id: svn://10.0.0.236/trunk@53309 18797224-902f-48f8-a5cc-f745e15eee43 --- .../compose/public/nsIMsgCompFields.idl | 3 ++ .../resources/content/MsgComposeCommands.js | 29 ++++++++++- .../locale/en-US/messengercompose.dtd | 8 +-- .../mailnews/compose/src/nsMsgCompFields.cpp | 14 +++++ .../mailnews/compose/src/nsMsgCompFields.h | 3 ++ mozilla/mailnews/compose/src/nsMsgSend.cpp | 48 +++++++++++------- .../mime/emitters/resources/skin/addcard.gif | Bin 955 -> 963 bytes .../mime/emitters/resources/skin/attach.gif | Bin 879 -> 887 bytes .../mailnews/compose/messengercompose.dtd | 8 +-- 9 files changed, 87 insertions(+), 26 deletions(-) diff --git a/mozilla/mailnews/compose/public/nsIMsgCompFields.idl b/mozilla/mailnews/compose/public/nsIMsgCompFields.idl index 5516531a95a..7aca5bf4c18 100644 --- a/mozilla/mailnews/compose/public/nsIMsgCompFields.idl +++ b/mozilla/mailnews/compose/public/nsIMsgCompFields.idl @@ -116,6 +116,9 @@ interface nsIMsgCompFields : nsISupports { void SetUUEncodeAttachments(in boolean value); boolean GetUUEncodeAttachments(); + void SetUseMultipartAlternativeFlag(in boolean value); + boolean GetUseMultipartAlternativeFlag(); + void SetTheForcePlainText(in boolean value); boolean GetTheForcePlainText(); }; diff --git a/mozilla/mailnews/compose/resources/content/MsgComposeCommands.js b/mozilla/mailnews/compose/resources/content/MsgComposeCommands.js index a208aa83133..5d54ec70f90 100644 --- a/mozilla/mailnews/compose/resources/content/MsgComposeCommands.js +++ b/mozilla/mailnews/compose/resources/content/MsgComposeCommands.js @@ -464,7 +464,34 @@ function UUEncodeMenuSelect() function OutputFormatMenuSelect(target) { -// dump(target.getAttribute('id') + "\n"); + dump("Set Message Format to " + target.getAttribute('id') + "\n"); + if (msgCompose) + { + var msgCompFields = msgCompose.compFields; + + if (msgCompFields) + { + switch (target.getAttribute('id')) + { + case "1": + break; + case "2": + msgCompFields.SetTheForcePlainText(true); + msgCompFields.SetUseMultipartAlternativeFlag(false); + break; + case "3": + msgCompFields.SetTheForcePlainText(false); + msgCompFields.SetUseMultipartAlternativeFlag(false); + break; + case "4": + msgCompFields.SetTheForcePlainText(false); + msgCompFields.SetUseMultipartAlternativeFlag(true); + break; + default: + break; + } + } + } } function SelectAddress() diff --git a/mozilla/mailnews/compose/resources/locale/en-US/messengercompose.dtd b/mozilla/mailnews/compose/resources/locale/en-US/messengercompose.dtd index 68cc24dec4a..de7f5de9faf 100644 --- a/mozilla/mailnews/compose/resources/locale/en-US/messengercompose.dtd +++ b/mozilla/mailnews/compose/resources/locale/en-US/messengercompose.dtd @@ -77,11 +77,11 @@ - + - - - + + + diff --git a/mozilla/mailnews/compose/src/nsMsgCompFields.cpp b/mozilla/mailnews/compose/src/nsMsgCompFields.cpp index f1c5020c7f4..464de2a4d1f 100644 --- a/mozilla/mailnews/compose/src/nsMsgCompFields.cpp +++ b/mozilla/mailnews/compose/src/nsMsgCompFields.cpp @@ -483,6 +483,20 @@ nsMsgCompFields::GetTheForcePlainText(PRBool *_retval) return NS_OK; } +nsresult +nsMsgCompFields::SetUseMultipartAlternativeFlag(PRBool value) +{ + m_multipart_alt = value; + return NS_OK; +} + +nsresult +nsMsgCompFields::GetUseMultipartAlternativeFlag(PRBool *_retval) +{ + *_retval = m_multipart_alt; + return NS_OK; +} + HJ36954 { diff --git a/mozilla/mailnews/compose/src/nsMsgCompFields.h b/mozilla/mailnews/compose/src/nsMsgCompFields.h index eb3838c3800..9e75c6e866b 100644 --- a/mozilla/mailnews/compose/src/nsMsgCompFields.h +++ b/mozilla/mailnews/compose/src/nsMsgCompFields.h @@ -215,6 +215,9 @@ public: void SetForcePlainText(PRBool value) {m_force_plain_text = value;} PRBool GetForcePlainText() {return m_force_plain_text;} + NS_IMETHOD SetUseMultipartAlternativeFlag(PRBool value); + NS_IMETHOD GetUseMultipartAlternativeFlag(PRBool *_retval); + void SetUseMultipartAlternative(PRBool value) {m_multipart_alt = value;} PRBool GetUseMultipartAlternative() {return m_multipart_alt;} diff --git a/mozilla/mailnews/compose/src/nsMsgSend.cpp b/mozilla/mailnews/compose/src/nsMsgSend.cpp index fa9d31c667d..6a3f93ea4cf 100644 --- a/mozilla/mailnews/compose/src/nsMsgSend.cpp +++ b/mozilla/mailnews/compose/src/nsMsgSend.cpp @@ -687,28 +687,42 @@ nsMsgComposeAndSend::GatherMimeAttachments() // Setup the maincontainer stuff... status = maincontainer->SetType(MULTIPART_ALTERNATIVE); if (status < 0) - goto FAIL; + goto FAIL; - mpartcontainer = new nsMsgSendPart(this); - if (!mpartcontainer) - goto FAILMEM; + // Only create multipart related if its really necessary... + if (mMultipartRelatedAttachmentCount > 0) + { + mpartcontainer = new nsMsgSendPart(this); + if (!mpartcontainer) + goto FAILMEM; - status = mpartcontainer->SetType(MULTIPART_RELATED); - if (status < 0) - goto FAIL; + status = mpartcontainer->SetType(MULTIPART_RELATED); + if (status < 0) + goto FAIL; - status = mpartcontainer->AddChild(htmlpart); - if (status < 0) - goto FAIL; + status = mpartcontainer->AddChild(htmlpart); + if (status < 0) + goto FAIL; - // Hang stuff off of the maincontainer... - status = maincontainer->AddChild(plainpart); - if (status < 0) - goto FAIL; + // Hang stuff off of the maincontainer... + status = maincontainer->AddChild(plainpart); + if (status < 0) + goto FAIL; - status = maincontainer->AddChild(mpartcontainer); - if (status < 0) - goto FAIL; + status = maincontainer->AddChild(mpartcontainer); + if (status < 0) + goto FAIL; + } + else // Just a single HTML doc for the HTML mail + { + status = maincontainer->AddChild(plainpart); + if (status < 0) + goto FAIL; + + status = maincontainer->AddChild(htmlpart); + if (status < 0) + goto FAIL; + } // Create the encoder for the plaintext part here, // because we aren't the main part (attachment1). diff --git a/mozilla/mailnews/mime/emitters/resources/skin/addcard.gif b/mozilla/mailnews/mime/emitters/resources/skin/addcard.gif index ff5491e984daa5e7e6540871c2a3f113fdd8c923..4f0d3e55807c7e721f0803311686aa6c93f7e486 100644 GIT binary patch delta 47 vcmdnZewba--P6s&GEtO4gyA~_1A}2Q9Bq{R!o;EYlZBCifsJ7@FY`J85%CKA delta 38 wcmV+>0NMY;2fGIuM@dFFIbjt56ae=C0DFwRgmbN&l(n3k#<3an0+SU3t^i&R(f|Me diff --git a/mozilla/mailnews/mime/emitters/resources/skin/attach.gif b/mozilla/mailnews/mime/emitters/resources/skin/attach.gif index 828ebe335fa8a64983ef3289dd0504307faf61e7..40cfbf24ecbff18380061531fbb07059b666c3e2 100644 GIT binary patch delta 38 ucmaFQ_MJ_@-P6s&GEsm*fZ;m>1A}4mMuERf9Ev|#7#SFt7$);FCjkJ=2MI&~ delta 29 lcmey)_MT0^-P6s&GEsm*fZ;m>Lrd}6jRJp}CW|sB0RW0$2{Qly diff --git a/mozilla/suite/locales/en-US/chrome/mailnews/compose/messengercompose.dtd b/mozilla/suite/locales/en-US/chrome/mailnews/compose/messengercompose.dtd index 68cc24dec4a..de7f5de9faf 100644 --- a/mozilla/suite/locales/en-US/chrome/mailnews/compose/messengercompose.dtd +++ b/mozilla/suite/locales/en-US/chrome/mailnews/compose/messengercompose.dtd @@ -77,11 +77,11 @@ - + - - - + + +