From a9591c50fd95ced07c48accaf961a9145db055ec Mon Sep 17 00:00:00 2001 From: Fredrik Modeen Date: Thu, 19 Nov 2009 21:51:36 +0000 Subject: [PATCH] Change back _FindValidFileName to use BString, don't know what I was thinking, thanks Jerome and Stephan. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34141 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/screenshot/ScreenshotWindow.cpp | 12 ++++++------ src/apps/screenshot/ScreenshotWindow.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/apps/screenshot/ScreenshotWindow.cpp b/src/apps/screenshot/ScreenshotWindow.cpp index 9da3232dc7..d3999e68de 100644 --- a/src/apps/screenshot/ScreenshotWindow.cpp +++ b/src/apps/screenshot/ScreenshotWindow.cpp @@ -169,7 +169,7 @@ ScreenshotWindow::MessageReceived(BMessage* message) case kImageOutputFormat: message->FindInt32("be:type", &fImageFileType); message->FindInt32("be:translator", &fTranslator); - fNameControl->SetText(_FindValidFileName(fNameControl->Text())); + fNameControl->SetText(_FindValidFileName(fNameControl->Text()).String()); break; case kLocationChanged: @@ -178,7 +178,7 @@ ScreenshotWindow::MessageReceived(BMessage* message) if (message->FindPointer("source", &source) == B_OK) fLastSelectedPath = static_cast (source); - fNameControl->SetText(_FindValidFileName(fNameControl->Text())); + fNameControl->SetText(_FindValidFileName(fNameControl->Text()).String()); break; } @@ -377,7 +377,7 @@ ScreenshotWindow::_SetupSecondLayoutItem(BCardLayout* layout) _SetupOutputPathMenu(new BMenu("Please select"), settings); BMenuField* menuField2 = new BMenuField("Save in:", fOutputPathMenu); - fNameControl->SetText(_FindValidFileName("screenshot1")); + fNameControl->SetText(_FindValidFileName("screenshot1").String()); _SetupTranslatorMenu(new BMenu("Please select"), settings); BMenuField* menuField = new BMenuField("Save as:", fTranslatorMenu); @@ -557,7 +557,7 @@ ScreenshotWindow::_UpdatePreviewPanel() } -const char* +BString ScreenshotWindow::_FindValidFileName(const char* name) { BString baseName(name); @@ -616,7 +616,7 @@ ScreenshotWindow::_FindValidFileName(const char* name) entry.SetTo(outputPath.Path()); } while (entry.Exists()); - return BString(filename).String(); + return BString(filename); } @@ -772,7 +772,7 @@ ScreenshotWindow::_SaveScreenshot() return B_ERROR; if (fSaveScreenshotSilent) - path.Append(_FindValidFileName("screenshot1")); + path.Append(_FindValidFileName("screenshot1").String()); else path.Append(fNameControl->Text()); diff --git a/src/apps/screenshot/ScreenshotWindow.h b/src/apps/screenshot/ScreenshotWindow.h index 4fa8b13206..f556a9c467 100644 --- a/src/apps/screenshot/ScreenshotWindow.h +++ b/src/apps/screenshot/ScreenshotWindow.h @@ -56,7 +56,7 @@ private: BString& label, int32 index, bool markItem); void _UpdatePreviewPanel(); - const char* _FindValidFileName(const char* name); + BString _FindValidFileName(const char* name); int32 _PathIndexInMenu(const BString& path) const; BMessage _ReadSettings() const;