Ticket #12241: 0001-ShowImage-Adds-an-option-to-launch-tracker-file-info.patch

File 0001-ShowImage-Adds-an-option-to-launch-tracker-file-info.patch, 2.4 KB (added by artcodex, 9 years ago)

Updated to conform to code review guidelines and with fixes

  • src/apps/showimage/ShowImageWindow.cpp

    From 763f409c2f3cf9429313eed7207eefb1ad4ef63e Mon Sep 17 00:00:00 2001
    From: Avi Brenner <avi.brenner@gmail.com>
    Date: Thu, 31 Dec 2015 11:54:47 +0000
    Subject: [PATCH] ShowImage: Adds an option to launch tracker file info for
     currently viewed file.
    
    Fixes #12241
    ---
     src/apps/showimage/ShowImageWindow.cpp | 17 +++++++++++++++++
     src/apps/showimage/ShowImageWindow.h   |  2 ++
     2 files changed, 19 insertions(+)
    
    diff --git a/src/apps/showimage/ShowImageWindow.cpp b/src/apps/showimage/ShowImageWindow.cpp
    index 9844119..e873eb3 100644
    a b enum {  
    9494    MSG_SHOW_CAPTION            = 'mSCP',
    9595    MSG_PAGE_SETUP              = 'mPSU',
    9696    MSG_PREPARE_PRINT           = 'mPPT',
     97    MSG_GET_INFO                = 'mGFI',
    9798    MSG_SET_RATING              = 'mSRT',
    9899    kMsgFitToWindow             = 'mFtW',
    99100    kMsgOriginalSize            = 'mOSZ',
    ShowImageWindow::_AddMenus(BMenuBar* bar)  
    392393    menu->AddItem(menuSaveAs);
    393394    _AddItemMenu(menu, B_TRANSLATE("Close"), B_QUIT_REQUESTED, 'W', 0, this);
    394395    _AddItemMenu(menu, B_TRANSLATE("Move to Trash"), kMsgDeleteCurrentFile, 'T', 0, this);
     396    _AddItemMenu(menu, B_TRANSLATE("Get info" B_UTF8_ELLIPSIS),
     397        MSG_GET_INFO, 'I', 0, this);
    395398    menu->AddSeparatorItem();
    396399    _AddItemMenu(menu, B_TRANSLATE("Page setup" B_UTF8_ELLIPSIS),
    397400        MSG_PAGE_SETUP, 0, 0, this);
    ShowImageWindow::MessageReceived(BMessage* message)  
    872875            fImageView->Flip(false);
    873876            break;
    874877
     878        case MSG_GET_INFO:
     879            _GetFileInfo(fNavigator.CurrentRef());
     880            break;
     881
    875882        case MSG_SLIDE_SHOW:
    876883        {
    877884            bool fullScreen = false;
    ShowImageWindow::MessageReceived(BMessage* message)  
    10621069
    10631070
    10641071void
     1072ShowImageWindow::_GetFileInfo(const entry_ref& ref)
     1073{
     1074    BMessage message('Tinf');
     1075    BMessenger tracker("application/x-vnd.Be-TRAK");
     1076    message.AddRef("refs", &ref);
     1077    tracker.SendMessage(&message);
     1078}
     1079
     1080
     1081void
    10651082ShowImageWindow::_UpdateStatusText(const BMessage* message)
    10661083{
    10671084    BString frameText;
  • src/apps/showimage/ShowImageWindow.h

    diff --git a/src/apps/showimage/ShowImageWindow.h b/src/apps/showimage/ShowImageWindow.h
    index 32fc6d1..1fb2871 100644
    a b private:  
    104104
    105105            void                _UpdateRatingMenu();
    106106
     107            void                _GetFileInfo(const entry_ref& ref);
     108
    107109            void                _SetToolBarVisible(bool visible,
    108110                                    bool animate = false);
    109111            void                _SetToolBarBorder(bool visible);