From 5cf21b4e2e0dea00628fa5c900081cbee93007a1 Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Fri, 18 Mar 2011 10:59:03 -0400 Subject: [PATCH] Don't search for 'File' but grab the menu's first qaction. As pinotree on IRC kindly pointed out, searching for 'File' won't work in non-English menus. Now we grab the first action in the menu which should always be in for the File menu in Konsole. CCBUG: 170878 --- src/MainWindow.cpp | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 32fc4179..fbae223d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -509,29 +509,22 @@ void MainWindow::showRemoteConnectionDialog() void MainWindow::activateMenuBar() { - QAction* fileAction; + const QList menuActions = menuBar()->actions(); - // Find action for "File" menu - foreach(QAction* menuItem, menuBar()->actions()) - { - QString itemText = KGlobal::locale()->removeAcceleratorMarker(menuItem->text()); - if (itemText == "File") - { - fileAction = menuItem; - break; - } - } - if (fileAction) + if (menuActions.isEmpty()) + return; + + // First menu action should be 'File' + QAction* fileAction = menuActions.first(); + + if (menuBar()->isHidden()) // Show menubar if hidden { - if (menuBar()->isHidden()) // Show menubar if hidden - { - _toggleMenuBarAction->setChecked(true); - menuBar()->setVisible(true); - } - // TODO: Handle when menubar is top level (MacOS) - menuBar()->setActiveAction(fileAction); + _toggleMenuBarAction->setChecked(true); + menuBar()->setVisible(true); } + // TODO: Handle when menubar is top level (MacOS) + menuBar()->setActiveAction(fileAction); } void MainWindow::setupWidgets()