aboutsummaryrefslogtreecommitdiffstats
path: root/ui/macosx
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2018-04-09 17:39:49 +0800
committerRoland Knall <rknall@gmail.com>2018-04-09 15:44:22 +0000
commitd347091da962a3bb095c62339fc6faa07d189a9f (patch)
tree73aad2fe50975b92451a21dfb0ba4ec5bbfd8615 /ui/macosx
parent31aece5d75aac59396ed194cdd94f654cb0c0f7e (diff)
Qt: Fix MacOSX menu entries
Remove various menu items added automatically on Mac OS X. The following menu items have been removed: - Edit / Start Dictation - Edit / Emoji & Symbols - View / Enter Fullscreen Mode - View / Show Tab Bar - Hide Tab Bar Bug: 13366 Change-Id: I44deae7ee8ea7a43926820e4f5d0517ece246939 Reviewed-on: https://code.wireshark.org/review/26823 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/macosx')
-rw-r--r--ui/macosx/cocoa_bridge.h39
-rw-r--r--ui/macosx/cocoa_bridge.mm47
2 files changed, 86 insertions, 0 deletions
diff --git a/ui/macosx/cocoa_bridge.h b/ui/macosx/cocoa_bridge.h
new file mode 100644
index 0000000000..e164922c60
--- /dev/null
+++ b/ui/macosx/cocoa_bridge.h
@@ -0,0 +1,39 @@
+/* cocoa_bridge.h
+ *
+ * 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
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef COCOABRIDGE_H
+#define COCOABRIDGE_H
+
+class CocoaBridge
+{
+
+ CocoaBridge() {}
+
+public:
+ static void cleanOSGeneratedMenuItems();
+
+};
+
+#endif // COCOABRIDGE_H
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/macosx/cocoa_bridge.mm b/ui/macosx/cocoa_bridge.mm
new file mode 100644
index 0000000000..93116b0e22
--- /dev/null
+++ b/ui/macosx/cocoa_bridge.mm
@@ -0,0 +1,47 @@
+/* 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
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <ui/macosx/cocoa_bridge.h>
+
+#import <Cocoa/Cocoa.h>
+
+void CocoaBridge::cleanOSGeneratedMenuItems()
+{
+#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
+
+ if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
+ NSWindow.allowsAutomaticWindowTabbing = NO;
+#endif
+
+ [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
+
+ // Remove (disable) the "Start Dictation..." and "Emoji & Symbols" menu items
+ // from the "Edit" menu
+
+ [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"];
+ [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledCharacterPaletteMenuItem"];
+}
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */