set changes monitoring on return by error

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3984 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2003-07-15 09:16:04 +00:00
parent 8c38dd91fc
commit 62df02c3e6
2 changed files with 23 additions and 2 deletions

View File

@ -60,8 +60,13 @@ StyledEditView::GetStyledText(BPositionIO * stream)
{
status_t result = B_OK;
fSuppressChanges = true;
result = BTranslationUtils::GetStyledText(stream, this, NULL);
if (result != B_OK) {
fSuppressChanges = false;
return result;
}
BNode * node = dynamic_cast<BNode*>(stream);
if (node != 0) {
ssize_t bytesRead;
@ -71,6 +76,7 @@ StyledEditView::GetStyledText(BPositionIO * stream)
if (bytesRead > 0) {
CharacterSetRoster * roster = CharacterSetRoster::Roster(&result);
if (result != B_OK) {
fSuppressChanges = false;
return result;
}
if (encoding == 65535) {

View File

@ -910,7 +910,22 @@ StyledEditWindow::OpenFile(entry_ref *ref)
result = fTextView->GetStyledText(&file); //he he he :)
if (result != B_OK) {
// TODO: notify user?
BEntry entry(ref, true);
char name[B_FILE_NAME_LENGTH];
entry.GetName(name);
BAlert *loadFailedAlert;
BString alertText;
if (result == B_TRANSLATION_ERROR_BASE) {
alertText.SetTo("Translation error loading \"");
} else {
alertText.SetTo("Unknown error loading \"");
}
alertText<< name;
alertText<<"\".";
loadFailedAlert= new BAlert("loadFailedAlert",alertText.String(), "Bummer", 0, 0,
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_STOP_ALERT);
loadFailedAlert->Go();
return;
}
// update alignment