diff --git a/shell/plugincontroller.h b/shell/plugincontroller.h --- a/shell/plugincontroller.h +++ b/shell/plugincontroller.h @@ -137,6 +137,8 @@ void resetToDefaults(); bool isEnabled(const KPluginMetaData& info) const; + /* list of failed plugins with error messages */ + QList> failedPlugins() const; private: /** * Directly unload the given \a plugin, either deleting it now or \a deletion. diff --git a/shell/plugincontroller.cpp b/shell/plugincontroller.cpp --- a/shell/plugincontroller.cpp +++ b/shell/plugincontroller.cpp @@ -146,6 +146,7 @@ { public: QVector plugins; + QList> failedToLoad; //map plugin infos to currently loaded plugins typedef QHash InfoToPluginMap; @@ -566,6 +567,8 @@ << "Disabling the plugin now."; group.writeEntry(info.pluginId() + KEY_Suffix_Enabled(), false); // do the same as KPluginInfo did group.sync(); + d->failedToLoad << qMakePair(info.name(), plugin->errorDescription()); + qDebug() << "Adding the" << info.name() << "into the failed to load"; unloadPlugin(pluginId); return nullptr; } @@ -580,6 +583,9 @@ return plugin; } +QList> PluginController::failedPlugins() const { + return d->failedToLoad; +} IPlugin* PluginController::plugin( const QString& pluginId ) { diff --git a/shell/settings/pluginpreferences.cpp b/shell/settings/pluginpreferences.cpp --- a/shell/settings/pluginpreferences.cpp +++ b/shell/settings/pluginpreferences.cpp @@ -25,6 +25,7 @@ #include #include +#include #include @@ -41,7 +42,7 @@ { QVBoxLayout* lay = new QVBoxLayout(this ); selector = new KPluginSelector( this ); - lay->addWidget( selector ); + QMap> plugins; const QMap categories = { { "Core", i18nc("@title:group", "Core") }, @@ -55,6 +56,25 @@ { "Analyzers", i18nc("@title:group", "Analyzers") }, { "Other", i18nc("@title:group", "Other") } }; + + /* If the plugin was marked to be loaded, but it's failing, this applies */ + PluginController* controller = qobject_cast(Core::self()->pluginControllerInternal()); + QList> failedPlugins = controller->failedPlugins(); + qDebug() << "Traying to get the failed to load stuff."; + if (failedPlugins.count()) { + qDebug() << "Passou por aqui"; + auto messageWidget = new KMessageWidget(this); + messageWidget->setCloseButtonVisible(false); + QString text = i18n("Some plugins failed do load:\n"); + foreach(const auto& plugin, failedPlugins) { + text += plugin.first + " " + plugin.second + "\n"; + } + messageWidget->setText(text); + lay->addWidget(messageWidget); + messageWidget->show(); + } + + lay->addWidget( selector ); foreach (const KPluginMetaData& info, Core::self()->pluginControllerInternal()->allPluginInfos()) { const QString loadMode = info.value(QStringLiteral("X-KDevelop-LoadMode")); if( loadMode.isEmpty() || loadMode == QLatin1String("UserSelectable") ) @@ -94,7 +114,7 @@ qCDebug(SHELL) << "Plugins before apply: " << Core::self()->pluginControllerInternal()->allPluginNames(); Core::self()->pluginControllerInternal()->updateLoadedPlugins(); qCDebug(SHELL) << "Plugins after apply: " << Core::self()->pluginControllerInternal()->allPluginNames(); - selector->load(); // Some plugins may have failed to load, they must be unchecked. + selector->load(); } void PluginPreferences::reset()