* Actually show the error that happened - are we Windows or what?
* Automatic whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28880 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2008, Haiku, Inc. All Rights Reserved.
|
* Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -741,10 +741,10 @@ StyledEditWindow::QuitRequested()
|
|||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
return false; // "cancel": dont save, dont close the window
|
return false; // "cancel": dont save, dont close the window
|
||||||
|
|
||||||
if (index == 1)
|
if (index == 1)
|
||||||
return true; // "don't save": just close the window
|
return true; // "don't save": just close the window
|
||||||
|
|
||||||
if (!fSaveMessage) {
|
if (!fSaveMessage) {
|
||||||
SaveAs(new BMessage(SAVE_THEN_QUIT));
|
SaveAs(new BMessage(SAVE_THEN_QUIT));
|
||||||
return false;
|
return false;
|
||||||
@@ -759,7 +759,7 @@ StyledEditWindow::Save(BMessage *message)
|
|||||||
{
|
{
|
||||||
if (!message)
|
if (!message)
|
||||||
message = fSaveMessage;
|
message = fSaveMessage;
|
||||||
|
|
||||||
if (!message)
|
if (!message)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
@@ -771,24 +771,19 @@ StyledEditWindow::Save(BMessage *message)
|
|||||||
|
|
||||||
BDirectory dir(&dirRef);
|
BDirectory dir(&dirRef);
|
||||||
BEntry entry(&dir, name);
|
BEntry entry(&dir, name);
|
||||||
|
|
||||||
status_t status = B_ERROR;
|
status_t status = B_ERROR;
|
||||||
if (dir.InitCheck() == B_OK && entry.InitCheck() == B_OK) {
|
if (dir.InitCheck() == B_OK && entry.InitCheck() == B_OK) {
|
||||||
BFile file(&entry, B_READ_WRITE | B_CREATE_FILE);
|
BFile file(&entry, B_READ_WRITE | B_CREATE_FILE);
|
||||||
if (file.InitCheck() == B_OK)
|
if (file.InitCheck() == B_OK)
|
||||||
status = fTextView->WriteStyledEditFile(&file);
|
status = fTextView->WriteStyledEditFile(&file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
BString alertText;
|
BString alertText("Error saving \"");
|
||||||
if (status == B_TRANSLATION_ERROR_BASE)
|
alertText << name << "\":\n" << strerror(status);
|
||||||
alertText.SetTo("Translation error saving \"");
|
|
||||||
else
|
|
||||||
alertText.SetTo("Unknown error saving \"");
|
|
||||||
|
|
||||||
alertText << name << "\".";
|
|
||||||
_ShowAlert(alertText, "OK", "", "", B_STOP_ALERT);
|
_ShowAlert(alertText, "OK", "", "", B_STOP_ALERT);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1321,14 +1316,14 @@ StyledEditWindow::_ShowAlert(const BString& text, const BString& label,
|
|||||||
const char* button2 = NULL;
|
const char* button2 = NULL;
|
||||||
if (label2.Length() > 0)
|
if (label2.Length() > 0)
|
||||||
button2 = label2.String();
|
button2 = label2.String();
|
||||||
|
|
||||||
const char* button3 = NULL;
|
const char* button3 = NULL;
|
||||||
button_spacing spacing = B_EVEN_SPACING;
|
button_spacing spacing = B_EVEN_SPACING;
|
||||||
if (label3.Length() > 0) {
|
if (label3.Length() > 0) {
|
||||||
button3 = label3.String();
|
button3 = label3.String();
|
||||||
spacing = B_OFFSET_SPACING;
|
spacing = B_OFFSET_SPACING;
|
||||||
}
|
}
|
||||||
|
|
||||||
BAlert* alert = new BAlert("Alert", text.String(), label.String(), button2,
|
BAlert* alert = new BAlert("Alert", text.String(), label.String(), button2,
|
||||||
button3, B_WIDTH_AS_USUAL, spacing, type);
|
button3, B_WIDTH_AS_USUAL, spacing, type);
|
||||||
alert->SetShortcut(0, B_ESCAPE);
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
|
|||||||
Reference in New Issue
Block a user