[haiku-commits] r33936 - haiku/trunk/src/apps/mail

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 7 Nov 2009 11:53:19 +0100 (CET)

Author: axeld
Date: 2009-11-07 11:53:19 +0100 (Sat, 07 Nov 2009)
New Revision: 33936
Changeset: http://dev.haiku-os.org/changeset/33936/haiku

Modified:
   haiku/trunk/src/apps/mail/MailWindow.cpp
Log:
* Hide() was called too early, and wasn't reverted in case the mail couldn't
  be encoded, either. This fixes bug #4613.
* Ideally, the mail would automatically be changed to an encoding that can
  express all characters silently. Added a TODO comment for this.


Modified: haiku/trunk/src/apps/mail/MailWindow.cpp
===================================================================
--- haiku/trunk/src/apps/mail/MailWindow.cpp    2009-11-07 10:44:11 UTC (rev 
33935)
+++ haiku/trunk/src/apps/mail/MailWindow.cpp    2009-11-07 10:53:19 UTC (rev 
33936)
@@ -2194,10 +2194,6 @@
                return status;
        }
 
-       Hide();
-               // depending on the system (and I/O) load, this could take a 
while
-               // but the user shouldn't be left waiting
-
        if (fHeaderView != NULL)
                characterSetToUse = fHeaderView->fCharacterSetUserSees;
 
@@ -2245,17 +2241,20 @@
                        // Check for any characters which don't fit in a 7 bit 
encoding.
                        int i;
                        bool has8Bit = false;
-                       for (i = 0; i < tempStringLength; i++)
+                       for (i = 0; i < tempStringLength; i++) {
                                if (tempString[i] == 0 || (tempString[i] & 
0x80)) {
                                        has8Bit = true;
                                        break;
                                }
+                       }
                        if (!has8Bit)
                                encodingForBody = seven_bit;
                        tempString.UnlockBuffer (tempStringLength);
 
                        // Count up the number of unencoded characters and warn 
the user about them.
                        if (fApp->WarnAboutUnencodableCharacters()) {
+                               // TODO: ideally, the encoding should be 
silently changed to
+                               // one that can express this character
                                int32 offset = 0;
                                int count = 0;
                                while (offset >= 0) {
@@ -2283,18 +2282,24 @@
                                                        
"その場合、代用文字がUnicode化可能な文字に代わって使われます。"
                                                        
"文字セットを変更する場合は「中止」ボタンを押して下さい。"
                                                );
-                                       userAnswer = (new BAlert ("Question", 
messageString.String(),
+                                       userAnswer = (new BAlert("Question", 
messageString.String(),
                                                MDR_DIALECT_CHOICE 
("Send","送信"),
-                                               MDR_DIALECT_CHOICE 
("Cancel","中止"), // Default is cancel.
-                                               NULL, B_WIDTH_AS_USUAL, 
B_OFFSET_SPACING, B_WARNING_ALERT))
-                                               ->Go();
-                                       if (userAnswer == 1)
-                                               return -1; // Cancel was picked.
+                                               MDR_DIALECT_CHOICE 
("Cancel","中止"),
+                                               NULL, B_WIDTH_AS_USUAL, 
B_OFFSET_SPACING,
+                                               B_WARNING_ALERT))->Go();
+                                       if (userAnswer == 1) {
+                                               // Cancel was picked.
+                                               return -1;
+                                       }
                                }
                        }
                }
        }
 
+       Hide();
+               // depending on the system (and I/O) load, this could take a 
while
+               // but the user shouldn't be left waiting
+
        status_t result;
 
        if (fResending) {
@@ -2394,7 +2399,7 @@
        char errorMessage[256];
 
        switch (result) {
-               case B_NO_ERROR:
+               case B_OK:
                        close = true;
                        fSent = true;
 
@@ -2452,6 +2457,10 @@
        }
        if (close)
                PostMessage(B_QUIT_REQUESTED);
+       else {
+               // The window was hidden earlier
+               Show();
+       }
 
        return result;
 }


Other related posts:

  • » [haiku-commits] r33936 - haiku/trunk/src/apps/mail - axeld