diff options
Diffstat (limited to 'ui/macosx')
-rw-r--r-- | ui/macosx/cocoa_bridge.h | 4 | ||||
-rw-r--r-- | ui/macosx/cocoa_bridge.mm | 13 |
2 files changed, 13 insertions, 4 deletions
diff --git a/ui/macosx/cocoa_bridge.h b/ui/macosx/cocoa_bridge.h index 4665fc29..5cf01dd6 100644 --- a/ui/macosx/cocoa_bridge.h +++ b/ui/macosx/cocoa_bridge.h @@ -1,6 +1,6 @@ /** @file * - * This code was taken directly from: + * This code is based upon: * https://forum.qt.io/topic/82609/remove-native-mac-menu-items-such-as-show-tab-bar * * Wireshark - Network traffic analyzer @@ -21,6 +21,8 @@ class CocoaBridge public: static void cleanOSGeneratedMenuItems(); + static void showInFinder(char const *file_path); + }; #endif // COCOABRIDGE_H diff --git a/ui/macosx/cocoa_bridge.mm b/ui/macosx/cocoa_bridge.mm index 909bf223..4f20d4f7 100644 --- a/ui/macosx/cocoa_bridge.mm +++ b/ui/macosx/cocoa_bridge.mm @@ -1,8 +1,5 @@ /* cocoa_bridge.mm * - * This code was taken directly from: - * https://forum.qt.io/topic/82609/remove-native-mac-menu-items-such-as-show-tab-bar - * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs @@ -17,6 +14,9 @@ void CocoaBridge::cleanOSGeneratedMenuItems() { + // This code was taken directly from: + // https://forum.qt.io/topic/82609/remove-native-mac-menu-items-such-as-show-tab-bar + #ifdef AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER // Remove (don't allow) the "Show Tab Bar" menu item from the "View" menu, if // supported @@ -33,3 +33,10 @@ void CocoaBridge::cleanOSGeneratedMenuItems() [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"]; [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSDisabledCharacterPaletteMenuItem"]; } + +void CocoaBridge::showInFinder(char const *file_path) +{ + NSURL *url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:file_path]]; + + [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:@[url]]; +} |