Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3204/src/gui
Modified Files:
wxComposeView.cpp
Log Message:
set the internal editor encoding to be the same used by the viewer, not UTF-8, for
Unicode messages
Index: wxComposeView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxComposeView.cpp,v
retrieving revision 1.373
retrieving revision 1.374
diff -b -u -2 -r1.373 -r1.374
--- wxComposeView.cpp 19 Sep 2004 15:52:15 -0000 1.373
+++ wxComposeView.cpp 28 Sep 2004 10:36:03 -0000 1.374
@@ -759,5 +759,5 @@
wxString content;
- const off_t len = file.Length();
+ const wxFileOffset len = file.Length();
if ( file.Read(wxStringBuffer(content, len + 1), len) != len )
{
@@ -2836,5 +2836,6 @@
// ----------------------------------------------------------------------------
-void wxComposeView::SetEncoding(wxFontEncoding encoding)
+void
+wxComposeView::SetEncoding(wxFontEncoding encoding, wxFontEncoding encConv)
{
if ( encoding == wxFONTENCODING_DEFAULT )
@@ -2851,5 +2852,5 @@
m_encoding = encoding;
- m_editor->SetEncoding(encoding);
+ m_editor->SetEncoding(encConv == wxFONTENCODING_SYSTEM ? encoding : encConv);
// check "Default" menu item if we use the system default encoding in absence
@@ -2860,22 +2861,46 @@
}
-void wxComposeView::SetEncodingToSameAs(Message *msg)
+bool wxComposeView::SetEncodingToSameAs(const MimePart *part)
{
- CHECK_RET( msg, _T("no message in SetEncodingToSameAs") );
-
- // find the first text part with non default encoding
- int count = msg->CountParts();
- for ( int part = 0; part < count; part++ )
+ while ( part )
{
- if ( msg->GetPartType(part) == MimeType::TEXT )
+ if ( part->GetType().GetPrimary() == MimeType::TEXT )
{
- wxFontEncoding enc = msg->GetTextPartEncoding(part);
+ wxFontEncoding enc = part->GetTextEncoding();
if ( enc != wxFONTENCODING_SYSTEM )
{
- SetEncoding(enc);
- break;
+ // Unicode parts are converted by the message viewer (from which we
+ // get our text) to another encoding, get it
+ wxFontEncoding encConv;
+ if ( enc == wxFONTENCODING_UTF7 || enc == wxFONTENCODING_UTF8 )
+ {
+ String textPart(part->GetTextContent());
+ encConv = ConvertUTFToMB(&textPart, enc);
+ }
+ else // not Unicode
+ {
+ encConv = wxFONTENCODING_SYSTEM;
+ }
+
+ SetEncoding(enc, encConv);
+ return true;
}
}
+
+ if ( SetEncodingToSameAs(part->GetNested()) )
+ return true;
+
+ part = part->GetNext();
}
+
+ return false;
+}
+
+void wxComposeView::SetEncodingToSameAs(const Message *msg)
+{
+ CHECK_RET( msg, _T("no message in SetEncodingToSameAs") );
+
+ // find the first text part with non default encoding
+ SetEncodingToSameAs(msg->GetTopMimePart());
}
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates