Ticket #9602: 0001-Added-location-bar-shortcut-to-Tracker.patch

File 0001-Added-location-bar-shortcut-to-Tracker.patch, 2.8 KB (added by puckipedia, 11 years ago)
  • src/kits/tracker/ContainerWindow.cpp

    From 67344f4d2f157658a8f2d5a24bf366a2fe300788 Mon Sep 17 00:00:00 2001
    From: Puck Meerburg <puck@puckipedia.nl>
    Date: Tue, 19 Nov 2013 17:01:29 +0000
    Subject: [PATCH] Added location bar shortcut to Tracker
    
    * Uses new constant message to message the Navigator to focus the location bar
    ---
     src/kits/tracker/ContainerWindow.cpp | 6 ++++++
     src/kits/tracker/Navigator.cpp       | 9 ++++++++-
     src/kits/tracker/Navigator.h         | 4 +++-
     3 files changed, 17 insertions(+), 2 deletions(-)
    
    diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp
    index 294bca4..6d77e8b 100644
    a b BContainerWindow::ShowNavigator(bool show)  
    39953995                Navigator()->MoveTo(0, KeyMenuBar()->Bounds().Height() + 1);
    39963996                // This is if the navigator was created with a .top = 0.
    39973997            Navigator()->Show();
     3998
    39983999        }
    39994000
    40004001        float displacement = Navigator()->Frame().Height() + 1;
    BContainerWindow::SetSingleWindowBrowseShortcuts(bool enabled)  
    40564057            new BMessage(kNavigatorCommandUp), Navigator());
    40574058        AddShortcut(B_DOWN_ARROW, B_OPTION_KEY | B_COMMAND_KEY,
    40584059            new BMessage(kOpenSelection), PoseView());
     4060        AddShortcut('L', B_COMMAND_KEY,
     4061            new BMessage(kNavigatorCommandFocusLocation), Navigator());
     4062
    40594063
    40604064    } else {
     4065        RemoveShortcut('L', B_COMMAND_KEY);
     4066
    40614067        RemoveShortcut(B_LEFT_ARROW, B_COMMAND_KEY);
    40624068        RemoveShortcut(B_RIGHT_ARROW, B_COMMAND_KEY);
    40634069        RemoveShortcut(B_UP_ARROW, B_COMMAND_KEY);
  • src/kits/tracker/Navigator.cpp

    diff --git a/src/kits/tracker/Navigator.cpp b/src/kits/tracker/Navigator.cpp
    index 3d0ef5c..8d1e8e1 100644
    a b BNavigator::MessageReceived(BMessage* message)  
    229229        case kNavigatorCommandUp:
    230230            GoUp((modifiers() & B_OPTION_KEY) == B_OPTION_KEY);
    231231            break;
    232 
     232        case kNavigatorCommandFocusLocation:
     233            FocusLocation();
     234            break;
    233235        case kNavigatorCommandLocation:
    234236            GoTo();
    235237            break;
    BNavigator::MessageReceived(BMessage* message)  
    255257    }
    256258}
    257259
     260void
     261BNavigator::FocusLocation()
     262{
     263    fLocation->MakeFocus();
     264}
    258265
    259266void
    260267BNavigator::GoBackward(bool option)
  • src/kits/tracker/Navigator.h

    diff --git a/src/kits/tracker/Navigator.h b/src/kits/tracker/Navigator.h
    index d290a2f..19e7eea 100644
    a b enum NavigationAction  
    5858    kNavigatorCommandBackward = 'NVBW',
    5959    kNavigatorCommandForward = 'NVFW',
    6060    kNavigatorCommandUp = 'NVUP',
    61     kNavigatorCommandLocation = 'NVLC'
     61    kNavigatorCommandLocation = 'NVLC',
     62    kNavigatorCommandFocusLocation = 'NVFL'
    6263};
    6364
    6465
    protected:  
    104105    void GoBackward(bool option);
    105106    void GoUp(bool option);
    106107    void SendNavigationMessage(NavigationAction, BEntry*, bool option);
     108    void FocusLocation();
    107109
    108110    void GoTo();
    109111