]> git.lyx.org Git - features.git/commitdiff
correct mac specific menu code for Cocoa based Qt build
authorStephan Witt <switt@lyx.org>
Tue, 2 Aug 2011 16:57:13 +0000 (16:57 +0000)
committerStephan Witt <switt@lyx.org>
Tue, 2 Aug 2011 16:57:13 +0000 (16:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39411 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/Menus.cpp

index eb4d0b2a86b452915f2c12b37a4978ad125ede40..8689b32f05b834e1fd6c6be55807743daa0c2092 100644 (file)
@@ -1746,9 +1746,10 @@ void Menus::Impl::macxMenuBarInit(GuiView * view, QMenuBar * qmb)
                {LFUN_LYX_QUIT, "", "Quit LyX", QAction::QuitRole}
        };
        const size_t num_entries = sizeof(entries) / sizeof(entries[0]);
+       const bool first_call = mac_special_menu_.size() == 0;
 
        // the special menu for Menus. Fill it up only once.
-       if (mac_special_menu_.size() == 0) {
+       if (first_call) {
                for (size_t i = 0 ; i < num_entries ; ++i) {
                        FuncRequest const func(entries[i].action,
                                from_utf8(entries[i].arg));
@@ -1756,17 +1757,26 @@ void Menus::Impl::macxMenuBarInit(GuiView * view, QMenuBar * qmb)
                                entries[i].label, func));
                }
        }
-       
+
        // add the entries to a QMenu that will eventually be empty
        // and therefore invisible.
        QMenu * qMenu = qmb->addMenu("special");
        MenuDefinition::const_iterator cit = mac_special_menu_.begin();
        MenuDefinition::const_iterator end = mac_special_menu_.end();
        for (size_t i = 0 ; cit != end ; ++cit, ++i) {
+#if defined(QT_MAC_USE_COCOA) && (QT_MAC_USE_COCOA > 0)
+               if (first_call || entries[i].role != QAction::ApplicationSpecificRole) {
+                       Action * action = new Action(view, QIcon(), cit->label(),
+                                cit->func(), QString(), qMenu);
+                       action->setMenuRole(entries[i].role);
+                       qMenu->addAction(action);
+               }
+#else
                Action * action = new Action(view, QIcon(), cit->label(),
                        cit->func(), QString(), qMenu);
                action->setMenuRole(entries[i].role);
                qMenu->addAction(action);
+#endif
        }
 }