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;