* now use source and destination as initial directory for file panels. This fixes bug #3175.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28855 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2009-01-07 21:52:07 +00:00
parent d5ec380523
commit 359176d906
+24 -6
View File
@@ -189,6 +189,12 @@ ExpanderWindow::ValidateDest()
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
alert->Go(); alert->Go();
return false; return false;
} else if (!entry.IsDirectory()) {
BAlert *alert = new BAlert("destAlert", "The destination"
" is not a directory.", "Cancel", NULL, NULL,
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
alert->Go();
return false;
} else { } else {
entry.GetRef(&fDestRef); entry.GetRef(&fDestRef);
return true; return true;
@@ -213,23 +219,35 @@ ExpanderWindow::MessageReceived(BMessage *msg)
{ {
switch (msg->what) { switch (msg->what) {
case MSG_SOURCE: case MSG_SOURCE:
{
BEntry entry(fSourceText->Text(), true);
entry_ref srcRef;
if (entry.Exists() && entry.IsDirectory())
entry.GetRef(&srcRef);
if (!fSourcePanel) { if (!fSourcePanel) {
BMessenger messenger(this); BMessenger messenger(this);
fSourcePanel = new BFilePanel(B_OPEN_PANEL, &messenger, NULL, fSourcePanel = new BFilePanel(B_OPEN_PANEL, &messenger, &srcRef,
B_FILE_NODE, false, NULL, new RuleRefFilter(fRules), true); B_FILE_NODE, false, NULL, new RuleRefFilter(fRules), true);
} } else
fSourcePanel->SetPanelDirectory(&srcRef);
fSourcePanel->Show(); fSourcePanel->Show();
break; break;
}
case MSG_DEST: case MSG_DEST:
{
BEntry entry(fDestText->Text(), true);
entry_ref destRef;
if (entry.Exists() && entry.IsDirectory())
entry.GetRef(&destRef);
if (!fDestPanel) { if (!fDestPanel) {
BMessenger messenger(this); BMessenger messenger(this);
fDestPanel = new DirectoryFilePanel(B_OPEN_PANEL, &messenger, NULL, fDestPanel = new DirectoryFilePanel(B_OPEN_PANEL, &messenger, &destRef,
B_DIRECTORY_NODE, false, NULL, new DirectoryRefFilter(), true); B_DIRECTORY_NODE, false, NULL, new DirectoryRefFilter(), true);
} } else
fDestPanel->SetPanelDirectory(&destRef);
fDestPanel->Show(); fDestPanel->Show();
break; break;
}
case MSG_DIRECTORY: case MSG_DIRECTORY:
{ {
entry_ref ref; entry_ref ref;