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:
parent
d95a9b63f7
commit
2d42fb1a9a
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user