* 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.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33936 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-11-07 10:53:19 +00:00
parent ea0ba618c5
commit 93e60b1a4f
1 changed files with 21 additions and 12 deletions

View File

@ -2194,10 +2194,6 @@ TMailWindow::Send(bool now)
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 @@ TMailWindow::Send(bool now)
// 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 @@ TMailWindow::Send(bool now)
"その場合、代用文字が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 @@ TMailWindow::Send(bool now)
char errorMessage[256];
switch (result) {
case B_NO_ERROR:
case B_OK:
close = true;
fSent = true;
@ -2452,6 +2457,10 @@ TMailWindow::Send(bool now)
}
if (close)
PostMessage(B_QUIT_REQUESTED);
else {
// The window was hidden earlier
Show();
}
return result;
}