From b52da4ab2179079a6aff95891786d2f6598048b5 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Fri, 13 Aug 2010 12:27:55 +0200 Subject: 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 --- src/gui/kernel/qcocoamenuloader_mac.mm | 5 +++++ src/gui/kernel/qcocoamenuloader_mac_p.h | 1 + src/gui/widgets/qcocoamenu_mac.mm | 12 ++++++++++++ src/gui/widgets/qcocoamenu_mac_p.h | 1 + 4 files changed, 19 insertions(+) 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 -- cgit v0.12 From 13d35e19a2bf78dd6a63b35f06a07d2b6e9c67c4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 13 Aug 2010 14:01:49 +0200 Subject: qdoc: Added the fix to change qml-qml-file.name to qml-file.name --- tools/qdoc3/tree.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 56e3484..540ffa9 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -1963,8 +1963,8 @@ QString Tree::fullDocumentLocation(const Node *node) const if ((node->subType() == Node::QmlClass) || (node->subType() == Node::QmlBasicType)) { QString fb = node->fileBase(); - if (fb.startsWith(QLatin1String("QML:"))) - return node->fileBase() + ".html"; + if (fb.startsWith(QLatin1String("qml-"))) + return fb + ".html"; else return "qml-" + node->fileBase() + ".html"; } else @@ -1981,7 +1981,7 @@ QString Tree::fullDocumentLocation(const Node *node) const else if ((parentNode = node->parent())) { if (parentNode->subType() == Node::QmlPropertyGroup) { parentNode = parentNode->parent(); - parentName = "qml-" + parentNode->fileBase() + ".html"; + parentName = fullDocumentLocation(parentNode); } else parentName = fullDocumentLocation(node->parent()); -- cgit v0.12 From 6d0d767e63df3c997d6d7a8cb6cd4bf8c0dfc835 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 13 Aug 2010 14:05:17 +0200 Subject: Cocoa: Stacking order of modal dialogs is wrong Modal dialogs were sometimes hidden behind other normal windows on screen. The reason was that, upon going modal for a window, we actually resat the stacking level on the window in a faulty attempt to respect any stays-on-top window flags. This patch makes sure we avoid doing that, and at the same time, ensures we don't reintroduce the original bug as well. Task-number: QTBUG-12841 Reviewed-by: cduclos --- src/gui/kernel/qeventdispatcher_mac.mm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index e26fbde..89f01d8 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -785,7 +785,7 @@ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() // the stacking order of the windows while doing so, we put // up a block that is used in QCocoaWindow and QCocoaPanel: int stackSize = cocoaModalSessionStack.size(); - for (int i=stackSize-1; i>=0; --i) { + for (int i=0; i [window level]) + [window setLevel:levelBeforeEnterModal]; } currentModalSessionCached = info.session; } -- cgit v0.12