mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: no notify be sent when plugin's qt version is incompatible
This commit is contained in:
parent
bb8714a1a5
commit
c34ca9b227
@ -159,24 +159,31 @@ void AbstractPluginsController::loadPlugin(const QString &pluginFile)
|
||||
QPluginLoader *pluginLoader = new QPluginLoader(pluginFile);
|
||||
const QJsonObject &meta = pluginLoader->metaData().value("MetaData").toObject();
|
||||
const QString &pluginApi = meta.value("api").toString();
|
||||
bool pluginIsValid = true;
|
||||
if (pluginApi.isEmpty() || !CompatiblePluginApiList.contains(pluginApi))
|
||||
{
|
||||
QString notifyMessage(tr("The plugin %1 is not compatible with the system."));
|
||||
Dtk::Core::DUtil::DNotifySender(notifyMessage.arg(QFileInfo(pluginFile).fileName())).appIcon("dialog-warning").call();
|
||||
|
||||
qWarning() << objectName()
|
||||
<< "plugin api version not matched! expect versions:" << CompatiblePluginApiList
|
||||
<< ", got version:" << pluginApi
|
||||
<< ", the plugin file is:" << pluginFile;
|
||||
return;
|
||||
|
||||
pluginIsValid = false;
|
||||
}
|
||||
|
||||
PluginsItemInterface *interface = qobject_cast<PluginsItemInterface *>(pluginLoader->instance());
|
||||
if (!interface)
|
||||
{
|
||||
qWarning() << objectName() << "load plugin failed!!!" << pluginLoader->errorString() << pluginFile;
|
||||
|
||||
pluginLoader->unload();
|
||||
pluginLoader->deleteLater();
|
||||
|
||||
pluginIsValid = false;
|
||||
}
|
||||
|
||||
if (!pluginIsValid) {
|
||||
QString notifyMessage(tr("The plugin %1 is not compatible with the system."));
|
||||
Dtk::Core::DUtil::DNotifySender(notifyMessage.arg(QFileInfo(pluginFile).fileName())).appIcon("dialog-warning").call();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user