Commit 8ee53cc5 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

Hide the Plugins menu if no plugins were loaded

Apparently KXmlGUI sets the action object name to the "name=" tag from the
ui.rc XML file.

BUG: 441199
FIXED-IN: 21.12
parent 1374d853
......@@ -13,6 +13,7 @@
#include <QFileInfo>
#include <QDir>
#include <QCommandLineParser>
#include <QMenuBar>
#include <QStandardPaths>
#include <QTimer>
......@@ -167,7 +168,18 @@ MainWindow *Application::newMainWindow()
&Konsole::Application::createWindow);
connect(window, &Konsole::MainWindow::terminalsDetached, this, &Konsole::Application::detachTerminals);
m_pluginManager.registerMainWindow(window);
if (!m_pluginManager.plugins().empty()) {
m_pluginManager.registerMainWindow(window);
} else {
const QList<QAction *> allActions = window->menuBar()->actions();
auto it = std::find_if(allActions.cbegin(), allActions.cend(), [](QAction *action) {
return action->objectName() == QLatin1String("plugins");
});
if (it != allActions.cend()) {
(*it)->setVisible(false);
}
}
return window;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment