StyledEdit now alerts with "unsupported format" instead of "Bad argument type passed to function" (bug #3071)

OpenFile() now returns early when the format is unsupported (don't add the document to recent documents, don't allow to save the document) (bug #3072)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28565 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2008-11-08 15:58:06 +00:00
parent 52de6dce94
commit 6cd5f90f73
+6 -1
View File
@@ -892,7 +892,11 @@ StyledEditWindow::_LoadFile(entry_ref* ref)
strcpy(name, "???"); strcpy(name, "???");
BString text("Error loading \""); BString text("Error loading \"");
text << name << "\":\n\t" << strerror(status); text << name << "\":\n\t";
if (status == B_BAD_TYPE)
text << "Unsupported format";
else
text << strerror(status);
_ShowAlert(text, "OK", "", "", B_STOP_ALERT); _ShowAlert(text, "OK", "", "", B_STOP_ALERT);
return status; return status;
@@ -924,6 +928,7 @@ StyledEditWindow::OpenFile(entry_ref* ref)
if (_LoadFile(ref) != B_OK) { if (_LoadFile(ref) != B_OK) {
fSaveItem->SetEnabled(true); fSaveItem->SetEnabled(true);
// allow saving new files // allow saving new files
return;
} }
be_roster->AddToRecentDocuments(ref, APP_SIGNATURE); be_roster->AddToRecentDocuments(ref, APP_SIGNATURE);