mirror of
https://github.com/KDE/konsole.git
synced 2026-05-06 05:36:40 -04:00
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
This commit is contained in:
@@ -509,29 +509,22 @@ void MainWindow::showRemoteConnectionDialog()
|
||||
|
||||
void MainWindow::activateMenuBar()
|
||||
{
|
||||
QAction* fileAction;
|
||||
const QList<QAction*> menuActions = menuBar()->actions();
|
||||
|
||||
// Find action for "File" menu
|
||||
foreach(QAction* menuItem, menuBar()->actions())
|
||||
if (menuActions.isEmpty())
|
||||
return;
|
||||
|
||||
// First menu action should be 'File'
|
||||
QAction* fileAction = menuActions.first();
|
||||
|
||||
if (menuBar()->isHidden()) // Show menubar if hidden
|
||||
{
|
||||
QString itemText = KGlobal::locale()->removeAcceleratorMarker(menuItem->text());
|
||||
if (itemText == "File")
|
||||
{
|
||||
fileAction = menuItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fileAction)
|
||||
{
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user