ShowImage: fix saving
As investigated and suggested by jackburton in ticket #14693: outTranslator wasn't initialized correctly (due to type mismatch on 64 bit platform). Also set the image's file name as default in the save dialog. Fixes #14693 Change-Id: I741e3616b935315a707ea3949a330d41d577fd91 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7102 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -1182,10 +1182,9 @@ void
|
|||||||
ShowImageWindow::_SaveAs(BMessage* message)
|
ShowImageWindow::_SaveAs(BMessage* message)
|
||||||
{
|
{
|
||||||
// Read the translator and output type the user chose
|
// Read the translator and output type the user chose
|
||||||
translator_id outTranslator;
|
int32 outTranslator;
|
||||||
uint32 outType;
|
uint32 outType;
|
||||||
if (message->FindInt32(kTranslatorField,
|
if (message->FindInt32(kTranslatorField, &outTranslator) != B_OK
|
||||||
reinterpret_cast<int32 *>(&outTranslator)) != B_OK
|
|
||||||
|| message->FindInt32(kTypeField,
|
|| message->FindInt32(kTypeField,
|
||||||
reinterpret_cast<int32 *>(&outType)) != B_OK)
|
reinterpret_cast<int32 *>(&outType)) != B_OK)
|
||||||
return;
|
return;
|
||||||
@@ -1200,6 +1199,7 @@ ShowImageWindow::_SaveAs(BMessage* message)
|
|||||||
BMessenger target(this);
|
BMessenger target(this);
|
||||||
fSavePanel = new (std::nothrow) BFilePanel(B_SAVE_PANEL,
|
fSavePanel = new (std::nothrow) BFilePanel(B_SAVE_PANEL,
|
||||||
&target, NULL, 0, false, &panelMsg);
|
&target, NULL, 0, false, &panelMsg);
|
||||||
|
|
||||||
if (!fSavePanel)
|
if (!fSavePanel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1211,6 +1211,12 @@ ShowImageWindow::_SaveAs(BMessage* message)
|
|||||||
settings->Unlock();
|
settings->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prefill current image's file name in save dialog
|
||||||
|
BEntry entry = fImageView->Image();
|
||||||
|
BPath path(&entry);
|
||||||
|
const char* filename = path.Leaf();
|
||||||
|
fSavePanel->SetSaveText(filename);
|
||||||
|
|
||||||
fSavePanel->Window()->SetWorkspaces(B_CURRENT_WORKSPACE);
|
fSavePanel->Window()->SetWorkspaces(B_CURRENT_WORKSPACE);
|
||||||
fSavePanel->Show();
|
fSavePanel->Show();
|
||||||
}
|
}
|
||||||
@@ -1230,10 +1236,9 @@ ShowImageWindow::_SaveToFile(BMessage* message)
|
|||||||
|
|
||||||
// Read in the translator and type to be used
|
// Read in the translator and type to be used
|
||||||
// to save the output image
|
// to save the output image
|
||||||
translator_id outTranslator;
|
int32 outTranslator;
|
||||||
uint32 outType;
|
uint32 outType;
|
||||||
if (message->FindInt32(kTranslatorField,
|
if (message->FindInt32(kTranslatorField, &outTranslator) != B_OK
|
||||||
reinterpret_cast<int32 *>(&outTranslator)) != B_OK
|
|
||||||
|| message->FindInt32(kTypeField,
|
|| message->FindInt32(kTypeField,
|
||||||
reinterpret_cast<int32 *>(&outType)) != B_OK)
|
reinterpret_cast<int32 *>(&outType)) != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user