From 04fbbc9145249743e5220743c16ebae21ab3c4c6 Mon Sep 17 00:00:00 2001
From: Owen <owenca@users.noreply.github.com>
Date: Mon, 1 May 2017 17:45:16 +0000
Subject: [PATCH 4/4] 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.
---
src/kits/tracker/FilePanelPriv.cpp | 19 +++++++++++++++----
src/kits/tracker/FilePanelPriv.h | 1 +
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/kits/tracker/FilePanelPriv.cpp b/src/kits/tracker/FilePanelPriv.cpp
index 7a367e3..59cc80d 100644
a
|
b
|
TFilePanel::SetClientObject(BFilePanel* panel)
|
552 | 552 | } |
553 | 553 | |
554 | 554 | |
| 555 | bool |
| 556 | TFilePanel::IsOpenButtonAlwaysEnabled() const |
| 557 | { |
| 558 | return !fIsSavePanel && (fNodeFlavors & B_DIRECTORY_NODE) != 0; |
| 559 | } |
| 560 | |
| 561 | |
555 | 562 | void |
556 | 563 | TFilePanel::AdjustButton() |
557 | 564 | { |
… |
… |
TFilePanel::AdjustButton()
|
613 | 620 | } |
614 | 621 | |
615 | 622 | button->SetLabel(buttonText.String()); |
616 | | button->SetEnabled(enabled); |
| 623 | button->SetEnabled(IsOpenButtonAlwaysEnabled() || enabled); |
617 | 624 | } |
618 | 625 | |
619 | 626 | |
… |
… |
TFilePanel::Init(const BMessage*)
|
799 | 806 | B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); |
800 | 807 | fBackView->AddChild(cancel_button); |
801 | 808 | |
802 | | if (!fIsSavePanel) |
| 809 | if (!fIsSavePanel && (fNodeFlavors & B_DIRECTORY_NODE) == 0) |
803 | 810 | default_button->SetEnabled(false); |
804 | 811 | |
805 | 812 | default_button->MakeDefault(true); |
… |
… |
TFilePanel::HandleOpenButton()
|
1643 | 1650 | } |
1644 | 1651 | } |
1645 | 1652 | |
1646 | | // don't do anything unless there are items selected |
1647 | | // message->fMessage->message from here to end |
1648 | 1653 | if (selection->CountItems()) { |
| 1654 | // there are items selected |
| 1655 | // message->fMessage->message from here to end |
1649 | 1656 | BMessage message(*fMessage); |
1650 | 1657 | // go through selection and add appropriate items |
1651 | 1658 | for (int32 index = 0; index < selection->CountItems(); index++) { |
… |
… |
TFilePanel::HandleOpenButton()
|
1661 | 1668 | } |
1662 | 1669 | |
1663 | 1670 | OpenSelectionCommon(&message); |
| 1671 | } else if (IsOpenButtonAlwaysEnabled()) { |
| 1672 | BMessage message(*fMessage); |
| 1673 | message.AddRef("refs", TargetModel()->EntryRef()); |
| 1674 | OpenSelectionCommon(&message); |
1664 | 1675 | } |
1665 | 1676 | } |
1666 | 1677 | |
diff --git a/src/kits/tracker/FilePanelPriv.h b/src/kits/tracker/FilePanelPriv.h
index 22acfd7..c45cd9a 100644
a
|
b
|
private:
|
137 | 137 | bool SelectChildInParent(const entry_ref* parent, |
138 | 138 | const node_ref* child); |
139 | 139 | void OpenSelectionCommon(BMessage*); |
| 140 | bool IsOpenButtonAlwaysEnabled() const; |
140 | 141 | |
141 | 142 | bool fIsSavePanel; |
142 | 143 | uint32 fNodeFlavors; |