Fix #8706 in Poorman - Selecting a web dir
There is no 'name' entry in the message from a B_OPEN_PANEL BFilePanel. Also fix a little memory leak along the way.
This commit is contained in:
@@ -142,12 +142,15 @@ PoorManPreferencesWindow::MessageReceived(BMessage* message)
|
|||||||
Quit();
|
Quit();
|
||||||
break;
|
break;
|
||||||
case MSG_PREF_SITE_BTN_SELECT:
|
case MSG_PREF_SITE_BTN_SELECT:
|
||||||
|
{
|
||||||
// Select the Web Directory, root directory to look in.
|
// Select the Web Directory, root directory to look in.
|
||||||
fWebDirFilePanel->SetTarget(this);
|
fWebDirFilePanel->SetTarget(this);
|
||||||
fWebDirFilePanel->SetMessage(new BMessage(MSG_FILE_PANEL_SELECT_WEB_DIR));
|
BMessage webDirSelectedMsg(MSG_FILE_PANEL_SELECT_WEB_DIR);
|
||||||
|
fWebDirFilePanel->SetMessage(&webDirSelectedMsg);
|
||||||
if (!fWebDirFilePanel->IsShowing())
|
if (!fWebDirFilePanel->IsShowing())
|
||||||
fWebDirFilePanel->Show();
|
fWebDirFilePanel->Show();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MSG_FILE_PANEL_SELECT_WEB_DIR:
|
case MSG_FILE_PANEL_SELECT_WEB_DIR:
|
||||||
// handle the open BMessage from the Select Web Directory File Panel
|
// handle the open BMessage from the Select Web Directory File Panel
|
||||||
PRINT(("Select Web Directory:\n"));
|
PRINT(("Select Web Directory:\n"));
|
||||||
@@ -177,13 +180,10 @@ void
|
|||||||
PoorManPreferencesWindow::SelectWebDir(BMessage* message)
|
PoorManPreferencesWindow::SelectWebDir(BMessage* message)
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
const char* name;
|
|
||||||
BPath path;
|
BPath path;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
|
|
||||||
if (message->FindRef("refs", &ref) != B_OK
|
if (message->FindRef("refs", &ref) != B_OK || entry.SetTo(&ref) != B_OK) {
|
||||||
|| message->FindString("name", &name) != B_OK
|
|
||||||
|| entry.SetTo(&ref) != B_OK) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
entry.GetPath(&path);
|
entry.GetPath(&path);
|
||||||
|
|||||||
Reference in New Issue
Block a user