Commit df16adb7 authored by Ahmad Samir's avatar Ahmad Samir Committed by Kurt Hindenburg
Browse files

Instead of hiding the Plugins menu, show a "no plugins available" action

E.g. https://bugs.kde.org/show_bug.cgi?id=186382

This reverts 8ee53cc5.
parent 4930a710
......@@ -121,18 +121,7 @@ MainWindow *Application::newMainWindow()
connect(window, &Konsole::MainWindow::newWindowRequest, this, &Konsole::Application::createWindow);
connect(window, &Konsole::MainWindow::terminalsDetached, this, &Konsole::Application::detachTerminals);
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);
}
}
m_pluginManager.registerMainWindow(window);
return window;
}
......
......@@ -10,9 +10,12 @@
#include "IKonsolePlugin.h"
#include "MainWindow.h"
#include <KLocalizedString>
#include <KPluginLoader>
#include <KPluginMetaData>
#include <QAction>
namespace Konsole
{
struct PluginManagerPrivate {
......@@ -59,6 +62,12 @@ void PluginManager::registerMainWindow(Konsole::MainWindow *window)
window->addPlugin(plugin);
}
if (internalPluginSubmenus.isEmpty()) {
auto *emptyMenuAct = new QAction(i18n("No plugins available"), this);
emptyMenuAct->setEnabled(false);
internalPluginSubmenus.append(emptyMenuAct);
}
window->plugActionList(QStringLiteral("plugin-submenu"), internalPluginSubmenus);
}
......
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