summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-08-13 10:27:55 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-08-13 10:44:28 (GMT)
commitb52da4ab2179079a6aff95891786d2f6598048b5 (patch)
tree5e422343842469f02c47be1c2bc408df74589048 /src
parent167b63d2250e7923d7b660076a80e82af07d9cdb (diff)
downloadQt-b52da4ab2179079a6aff95891786d2f6598048b5.zip
Qt-b52da4ab2179079a6aff95891786d2f6598048b5.tar.gz
Qt-b52da4ab2179079a6aff95891786d2f6598048b5.tar.bz2
Multiple "Edit/Special Characters" menu entries on Mac OS X (Cocoa)
Every time [NSApp setMainMenu:] is called, Cocoa will add the 'Special Characters' item to the 'Edit' menu. Before adding a new entry it will make sure that menu items list doesn't contain an item with the selector 'orderFrontCharacterPalette' & a 'nil' target. We need to return the index for the first entry (we have QCocoaMenuLoader as target). Task-number: QTBUG-12842 Reviewed-by: Denis
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm5
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac_p.h1
-rw-r--r--src/gui/widgets/qcocoamenu_mac.mm12
-rw-r--r--src/gui/widgets/qcocoamenu_mac_p.h1
4 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index 8d65aa1..8d38f45 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -255,5 +255,10 @@ QT_USE_NAMESPACE
qApp->quit();
}
}
+
+ - (void)orderFrontCharacterPalette:(id)sender
+ {
+ [NSApp orderFrontCharacterPalette:sender];
+ }
@end
#endif // QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qcocoamenuloader_mac_p.h b/src/gui/kernel/qcocoamenuloader_mac_p.h
index a75ad0a..edacfa5 100644
--- a/src/gui/kernel/qcocoamenuloader_mac_p.h
+++ b/src/gui/kernel/qcocoamenuloader_mac_p.h
@@ -88,6 +88,7 @@
- (IBAction)hide:(id)sender;
- (IBAction)qtDispatcherToQAction:(id)sender;
- (void)qtUpdateMenubar;
+- (void)orderFrontCharacterPalette:(id)sender;
@end
#endif // QT_MAC_USE_COCOA
diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm
index ce85919..15fae23 100644
--- a/src/gui/widgets/qcocoamenu_mac.mm
+++ b/src/gui/widgets/qcocoamenu_mac.mm
@@ -188,6 +188,18 @@ QT_USE_NAMESPACE
return NO;
}
+- (NSInteger)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector
+{
+ NSInteger index = [super indexOfItemWithTarget:anObject andAction:actionSelector];
+ static SEL selForOFCP = NSSelectorFromString(@"orderFrontCharacterPalette:");
+ if (index == -1 && selForOFCP == actionSelector) {
+ // Check if the 'orderFrontCharacterPalette' SEL exists for QCocoaMenuLoader object
+ QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
+ return [super indexOfItemWithTarget:loader andAction:actionSelector];
+ }
+ return index;
+}
+
@end
QT_BEGIN_NAMESPACE
diff --git a/src/gui/widgets/qcocoamenu_mac_p.h b/src/gui/widgets/qcocoamenu_mac_p.h
index d6ac8c5..1a42642 100644
--- a/src/gui/widgets/qcocoamenu_mac_p.h
+++ b/src/gui/widgets/qcocoamenu_mac_p.h
@@ -76,6 +76,7 @@ QT_FORWARD_DECLARE_CLASS(QAction)
}
- (id)initWithQMenu:(QMenu*)menu;
- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action;
+- (NSInteger)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector;
@end
#endif