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:
parent
8c38dd91fc
commit
62df02c3e6
@ -60,7 +60,12 @@ StyledEditView::GetStyledText(BPositionIO * stream)
|
|||||||
{
|
{
|
||||||
status_t result = B_OK;
|
status_t result = B_OK;
|
||||||
fSuppressChanges = true;
|
fSuppressChanges = true;
|
||||||
|
|
||||||
result = BTranslationUtils::GetStyledText(stream, this, NULL);
|
result = BTranslationUtils::GetStyledText(stream, this, NULL);
|
||||||
|
if (result != B_OK) {
|
||||||
|
fSuppressChanges = false;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
BNode * node = dynamic_cast<BNode*>(stream);
|
BNode * node = dynamic_cast<BNode*>(stream);
|
||||||
if (node != 0) {
|
if (node != 0) {
|
||||||
@ -71,6 +76,7 @@ StyledEditView::GetStyledText(BPositionIO * stream)
|
|||||||
if (bytesRead > 0) {
|
if (bytesRead > 0) {
|
||||||
CharacterSetRoster * roster = CharacterSetRoster::Roster(&result);
|
CharacterSetRoster * roster = CharacterSetRoster::Roster(&result);
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
|
fSuppressChanges = false;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (encoding == 65535) {
|
if (encoding == 65535) {
|
||||||
|
@ -910,7 +910,22 @@ StyledEditWindow::OpenFile(entry_ref *ref)
|
|||||||
result = fTextView->GetStyledText(&file); //he he he :)
|
result = fTextView->GetStyledText(&file); //he he he :)
|
||||||
|
|
||||||
if (result != B_OK) {
|
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
|
// update alignment
|
||||||
|
Loading…
Reference in New Issue
Block a user