]> git.lyx.org Git - features.git/commitdiff
Fix disabling of submenus that are empty.
authorVincent van Ravesteijn <vfr@lyx.org>
Wed, 7 Jan 2009 17:59:10 +0000 (17:59 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Wed, 7 Jan 2009 17:59:10 +0000 (17:59 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28027 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/Menus.cpp

index 4ab32e21be72b7fad0e5bf83fc5a6f8b8a925dd7..d067fa71e3e357ea35788b6146df977c10a06010 100644 (file)
@@ -339,8 +339,8 @@ void MenuDefinition::addWithStatusCheck(MenuItem const & i)
        }
 
        case MenuItem::Submenu: {
+               bool enabled = false;
                if (i.hasSubmenu()) {
-                       bool enabled = false;
                        for (const_iterator cit = i.submenu().begin();
                             cit != i.submenu().end(); ++cit) {
                                if ((cit->kind() == MenuItem::Command
@@ -350,13 +350,11 @@ void MenuDefinition::addWithStatusCheck(MenuItem const & i)
                                        break;
                                }
                        }
-                       if (enabled || !i.optional()) {
-                               items_.push_back(i);
-                               items_.back().status().setEnabled(enabled);
-                       }
                }
-               else
+               if (enabled || !i.optional()) {
                        items_.push_back(i);
+                       items_.back().status().setEnabled(enabled);
+               }
                break;
        }