From f5c4a083572c6811780c3196145e3fea52da2001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 11 Jan 2009 14:22:49 +0000 Subject: [PATCH] * 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 --- src/apps/stylededit/StyledEditWindow.cpp | 25 ++++++++++-------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index ae38c919cc..b01b0d9f2e 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -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. * * Authors: @@ -741,10 +741,10 @@ StyledEditWindow::QuitRequested() if (index == 0) return false; // "cancel": dont save, dont close the window - + if (index == 1) return true; // "don't save": just close the window - + if (!fSaveMessage) { SaveAs(new BMessage(SAVE_THEN_QUIT)); return false; @@ -759,7 +759,7 @@ StyledEditWindow::Save(BMessage *message) { if (!message) message = fSaveMessage; - + if (!message) return B_ERROR; @@ -771,24 +771,19 @@ StyledEditWindow::Save(BMessage *message) BDirectory dir(&dirRef); BEntry entry(&dir, name); - + status_t status = B_ERROR; if (dir.InitCheck() == B_OK && entry.InitCheck() == B_OK) { BFile file(&entry, B_READ_WRITE | B_CREATE_FILE); if (file.InitCheck() == B_OK) status = fTextView->WriteStyledEditFile(&file); } - + if (status != B_OK) { - BString alertText; - if (status == B_TRANSLATION_ERROR_BASE) - alertText.SetTo("Translation error saving \""); - else - alertText.SetTo("Unknown error saving \""); + BString alertText("Error saving \""); + alertText << name << "\":\n" << strerror(status); - alertText << name << "\"."; _ShowAlert(alertText, "OK", "", "", B_STOP_ALERT); - return status; } @@ -1321,14 +1316,14 @@ StyledEditWindow::_ShowAlert(const BString& text, const BString& label, const char* button2 = NULL; if (label2.Length() > 0) button2 = label2.String(); - + const char* button3 = NULL; button_spacing spacing = B_EVEN_SPACING; if (label3.Length() > 0) { button3 = label3.String(); spacing = B_OFFSET_SPACING; } - + BAlert* alert = new BAlert("Alert", text.String(), label.String(), button2, button3, B_WIDTH_AS_USUAL, spacing, type); alert->SetShortcut(0, B_ESCAPE);