Tracker: Always enable the Open button for B_DIRECTORY_NODE.
Always enable the default button in Open File Panel if the node flavors include B_DIRECTORY_NODE. Fixes #13463. Signed-off-by: Axel Dörfler <[email protected]>
This commit is contained in:
@@ -552,6 +552,13 @@ TFilePanel::SetClientObject(BFilePanel* panel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TFilePanel::IsOpenButtonAlwaysEnabled() const
|
||||||
|
{
|
||||||
|
return !fIsSavePanel && (fNodeFlavors & B_DIRECTORY_NODE) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TFilePanel::AdjustButton()
|
TFilePanel::AdjustButton()
|
||||||
{
|
{
|
||||||
@@ -613,7 +620,7 @@ TFilePanel::AdjustButton()
|
|||||||
}
|
}
|
||||||
|
|
||||||
button->SetLabel(buttonText.String());
|
button->SetLabel(buttonText.String());
|
||||||
button->SetEnabled(enabled);
|
button->SetEnabled(IsOpenButtonAlwaysEnabled() || enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -799,7 +806,7 @@ TFilePanel::Init(const BMessage*)
|
|||||||
B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
|
B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
|
||||||
fBackView->AddChild(cancel_button);
|
fBackView->AddChild(cancel_button);
|
||||||
|
|
||||||
if (!fIsSavePanel)
|
if (!fIsSavePanel && (fNodeFlavors & B_DIRECTORY_NODE) == 0)
|
||||||
default_button->SetEnabled(false);
|
default_button->SetEnabled(false);
|
||||||
|
|
||||||
default_button->MakeDefault(true);
|
default_button->MakeDefault(true);
|
||||||
@@ -1643,9 +1650,9 @@ TFilePanel::HandleOpenButton()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't do anything unless there are items selected
|
|
||||||
// message->fMessage->message from here to end
|
|
||||||
if (selection->CountItems()) {
|
if (selection->CountItems()) {
|
||||||
|
// there are items selected
|
||||||
|
// message->fMessage->message from here to end
|
||||||
BMessage message(*fMessage);
|
BMessage message(*fMessage);
|
||||||
// go through selection and add appropriate items
|
// go through selection and add appropriate items
|
||||||
for (int32 index = 0; index < selection->CountItems(); index++) {
|
for (int32 index = 0; index < selection->CountItems(); index++) {
|
||||||
@@ -1660,6 +1667,10 @@ TFilePanel::HandleOpenButton()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OpenSelectionCommon(&message);
|
||||||
|
} else if (IsOpenButtonAlwaysEnabled()) {
|
||||||
|
BMessage message(*fMessage);
|
||||||
|
message.AddRef("refs", TargetModel()->EntryRef());
|
||||||
OpenSelectionCommon(&message);
|
OpenSelectionCommon(&message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ private:
|
|||||||
bool SelectChildInParent(const entry_ref* parent,
|
bool SelectChildInParent(const entry_ref* parent,
|
||||||
const node_ref* child);
|
const node_ref* child);
|
||||||
void OpenSelectionCommon(BMessage*);
|
void OpenSelectionCommon(BMessage*);
|
||||||
|
bool IsOpenButtonAlwaysEnabled() const;
|
||||||
|
|
||||||
bool fIsSavePanel;
|
bool fIsSavePanel;
|
||||||
uint32 fNodeFlavors;
|
uint32 fNodeFlavors;
|
||||||
|
|||||||
Reference in New Issue
Block a user