Warning: KPluginInfo::property("X-KDE-PluginInfo-Name") is deprecated

Alexander Richardson arichardson.kde at gmail.com
Sat Feb 21 12:34:08 GMT 2015


2015-02-21 10:02 GMT+00:00 Marco Martin <notmart at gmail.com>:
> Hi all,
> As you may have noticed, right now starting plasma is a big spam of
> the following error:
> Calling KPluginInfo::property("X-KDE-PluginInfo-Name") is deprecated,
> use KPluginInfo::pluginName() in "/whatever/plugin.so" instead.
>
> i tried to see where it happens, and seems it's in
> ktradeparsetree.cpp , line 30
> QVariant ParseContext::property(const QString &_key) const
>
> I don't think this "properly" fixable, since from the stack trace it
> seems an appropriate use.. i see two ways to fix it:
>
> 1) in ParseContext::property stuf a very long if.. else.. that makes
> it call the proper KPluginInfo::correctAccessor() .. but is ugly and
> slows it down
>
> 2) since this is an appropriate use, consider it not wrong anymore,
> and just get rid of the warning.
>
> Opinions? ideas?
I guess most of these would result from a call to
KServiceTypeTrader::self()->query("KMyApp/Plugin",
"[X-KDE-PluginInfo-Name] = Foo").
My suggestion would be to add an overload to
KServiceTypeTrader::query() that takes a std::function<bool(const
KPluginInfo&)> instead of the constraints string.
Ideally we could then deprecate the string based version and use the
std::function version everywhere since that should be safer (and
faster).

KServiceTypeTrader::self()->query("KMyApp/Plugin", [](const
KPluginInfo &info) {
 return info.property("X-KMyApp-InterfaceVersion).toInt() > 15;
}
instead of
KServiceTypeTrader::self()->query("KMyApp/Plugin",
"[X-KMyApp-InterfaceVersion] > 15");

and then we could also have something like
KServiceTypeTrader::findPlugin(serviceType, name) that expands to
KServiceTypeTrader::self()->query(serviceType, [](const  KPluginInfo &info) {
 return info.pluginName() == name;
}

I have been meaning to add this for quite a while, but I am really
busy at the moment.

Alex
_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel at kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel


More information about the kde-core-devel mailing list