pluginloader: Remove deprecated version checks
Task: https://phabricator.kde.org/T14302 The explicit version checks are not needed anymore, the plugins are installed into a specific namespace for each major version. Also the plasma-frameworks API is stable during the lifetime of a major version.
This commit is contained in:
parent
a81a78becd
commit
b63335d10a
|
@ -188,9 +188,6 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
|
||||||
|
|
||||||
if (!plugins.isEmpty()) {
|
if (!plugins.isEmpty()) {
|
||||||
KPluginLoader loader(plugins.first().fileName());
|
KPluginLoader loader(plugins.first().fileName());
|
||||||
if (!isPluginVersionCompatible(loader)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
KPluginFactory *factory = loader.factory();
|
KPluginFactory *factory = loader.factory();
|
||||||
if (factory) {
|
if (factory) {
|
||||||
QVariantList allArgs;
|
QVariantList allArgs;
|
||||||
|
@ -334,9 +331,6 @@ Service *PluginLoader::loadService(const QString &name, const QVariantList &args
|
||||||
|
|
||||||
if (!plugins.isEmpty()) {
|
if (!plugins.isEmpty()) {
|
||||||
KPluginLoader loader(plugins.first().fileName());
|
KPluginLoader loader(plugins.first().fileName());
|
||||||
if (!isPluginVersionCompatible(loader)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
KPluginFactory *factory = loader.factory();
|
KPluginFactory *factory = loader.factory();
|
||||||
if (factory) {
|
if (factory) {
|
||||||
service = factory->create<Plasma::Service>(nullptr, args);
|
service = factory->create<Plasma::Service>(nullptr, args);
|
||||||
|
@ -392,10 +386,6 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co
|
||||||
KService::Ptr offer = offers.first();
|
KService::Ptr offer = offers.first();
|
||||||
KPluginLoader plugin(*offer);
|
KPluginLoader plugin(*offer);
|
||||||
|
|
||||||
if (!isPluginVersionCompatible(plugin)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantList allArgs;
|
QVariantList allArgs;
|
||||||
allArgs << offer->storageId() << args;
|
allArgs << offer->storageId() << args;
|
||||||
QString error;
|
QString error;
|
||||||
|
@ -921,29 +911,6 @@ KPluginInfo::List PluginLoader::standardInternalServiceInfo() const
|
||||||
return standardInternalInfo(QStringLiteral("services"));
|
return standardInternalInfo(QStringLiteral("services"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PluginLoader::isPluginVersionCompatible(KPluginLoader &loader)
|
|
||||||
{
|
|
||||||
const quint32 version = loader.pluginVersion();
|
|
||||||
if (version == quint32(-1)) {
|
|
||||||
// unversioned, just let it through
|
|
||||||
qCWarning(LOG_PLASMA) << loader.fileName() << "unversioned plugin detected, may result in instability";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we require PLASMA_VERSION_MAJOR and PLASMA_VERSION_MINOR
|
|
||||||
const quint32 minVersion = PLASMA_MAKE_VERSION(PLASMA_VERSION_MAJOR, 0, 0);
|
|
||||||
const quint32 maxVersion = PLASMA_MAKE_VERSION(PLASMA_VERSION_MAJOR, PLASMA_VERSION_MINOR, 60);
|
|
||||||
|
|
||||||
if (version < minVersion || version > maxVersion) {
|
|
||||||
qCWarning(LOG_PLASMA) << loader.fileName() << ": this plugin is compiled against incompatible Plasma version" << version
|
|
||||||
<< "This build is compatible with" << PLASMA_VERSION_MAJOR << ".0.0 (" << minVersion << ") to" << PLASMA_VERSION_STRING << "("
|
|
||||||
<< maxVersion << ")";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<KPluginMetaData> PluginLoaderPrivate::Cache::findPluginsById(const QString &name, const QStringList &dirs)
|
QVector<KPluginMetaData> PluginLoaderPrivate::Cache::findPluginsById(const QString &name, const QStringList &dirs)
|
||||||
{
|
{
|
||||||
const qint64 now = qRound64(QDateTime::currentMSecsSinceEpoch() / 1000.0);
|
const qint64 now = qRound64(QDateTime::currentMSecsSinceEpoch() / 1000.0);
|
||||||
|
|
|
@ -577,8 +577,6 @@ protected:
|
||||||
virtual ~PluginLoader();
|
virtual ~PluginLoader();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isPluginVersionCompatible(KPluginLoader &loader);
|
|
||||||
|
|
||||||
PluginLoaderPrivate *const d;
|
PluginLoaderPrivate *const d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user