Ticket #13463: 0004-Tracker-Always-enable-the-Open-button-for-B_DIRECTOR.patch

File 0004-Tracker-Always-enable-the-Open-button-for-B_DIRECTOR.patch, 2.5 KB (added by owenca, 7 years ago)
  • src/kits/tracker/FilePanelPriv.cpp

    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)  
    552552}
    553553
    554554
     555bool
     556TFilePanel::IsOpenButtonAlwaysEnabled() const
     557{
     558    return !fIsSavePanel && (fNodeFlavors & B_DIRECTORY_NODE) != 0;
     559}
     560
     561
    555562void
    556563TFilePanel::AdjustButton()
    557564{
    TFilePanel::AdjustButton()  
    613620    }
    614621
    615622    button->SetLabel(buttonText.String());
    616     button->SetEnabled(enabled);
     623    button->SetEnabled(IsOpenButtonAlwaysEnabled() || enabled);
    617624}
    618625
    619626
    TFilePanel::Init(const BMessage*)  
    799806        B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
    800807    fBackView->AddChild(cancel_button);
    801808
    802     if (!fIsSavePanel)
     809    if (!fIsSavePanel && (fNodeFlavors & B_DIRECTORY_NODE) == 0)
    803810        default_button->SetEnabled(false);
    804811
    805812    default_button->MakeDefault(true);
    TFilePanel::HandleOpenButton()  
    16431650        }
    16441651    }
    16451652
    1646     // don't do anything unless there are items selected
    1647     // message->fMessage->message from here to end
    16481653    if (selection->CountItems()) {
     1654            // there are items selected
     1655            // message->fMessage->message from here to end
    16491656        BMessage message(*fMessage);
    16501657        // go through selection and add appropriate items
    16511658        for (int32 index = 0; index < selection->CountItems(); index++) {
    TFilePanel::HandleOpenButton()  
    16611668        }
    16621669
    16631670        OpenSelectionCommon(&message);
     1671    } else if (IsOpenButtonAlwaysEnabled()) {
     1672        BMessage message(*fMessage);
     1673        message.AddRef("refs", TargetModel()->EntryRef());
     1674        OpenSelectionCommon(&message);
    16641675    }
    16651676}
    16661677
  • src/kits/tracker/FilePanelPriv.h

    diff --git a/src/kits/tracker/FilePanelPriv.h b/src/kits/tracker/FilePanelPriv.h
    index 22acfd7..c45cd9a 100644
    a b private:  
    137137    bool SelectChildInParent(const entry_ref* parent,
    138138        const node_ref* child);
    139139    void OpenSelectionCommon(BMessage*);
     140    bool IsOpenButtonAlwaysEnabled() const;
    140141
    141142    bool fIsSavePanel;
    142143    uint32 fNodeFlavors;