Tracker: Adjust open button status when B_DIRECTORY_NODE is set.

In hrev51155, it was changed to be always enabled no matter what,
so that the current directory (without anything selected) could be opened.
But this means it would also be enabled for files, which is misleading.

Instead, remove the function, and adjust the logic detecting whether
to enable the button or not to take B_DIRECTORY_NODE into account.
This commit is contained in:
Augustin Cavalier 2023-09-23 16:34:31 -04:00
parent d95a9b63f7
commit 2d42fb1a9a
2 changed files with 6 additions and 10 deletions

View File

@ -581,13 +581,6 @@ TFilePanel::SetClientObject(BFilePanel* panel)
}
bool
TFilePanel::IsOpenButtonAlwaysEnabled() const
{
return !fIsSavePanel && (fNodeFlavors & B_DIRECTORY_NODE) != 0;
}
void
TFilePanel::AdjustButton()
{
@ -645,11 +638,14 @@ TFilePanel::AdjustButton()
break;
}
}
} else if ((fNodeFlavors & B_DIRECTORY_NODE) != 0) {
// No selection, but the current directory could be opened.
enabled = true;
}
}
button->SetLabel(buttonText.String());
button->SetEnabled(IsOpenButtonAlwaysEnabled() || enabled);
button->SetEnabled(enabled);
}
@ -1725,7 +1721,8 @@ TFilePanel::HandleOpenButton()
}
OpenSelectionCommon(&message);
} else if (IsOpenButtonAlwaysEnabled()) {
} else if ((fNodeFlavors & B_DIRECTORY_NODE) != 0) {
// Open the current directory.
BMessage message(*fMessage);
message.AddRef("refs", TargetModel()->EntryRef());
OpenSelectionCommon(&message);

View File

@ -140,7 +140,6 @@ private:
void AdjustButton();
bool SelectChildInParent(const entry_ref* parent, const node_ref* child);
void OpenSelectionCommon(BMessage*);
bool IsOpenButtonAlwaysEnabled() const;
bool fIsSavePanel;
uint32 fNodeFlavors;