KApplicationTrader API

Ivan Čukić ivan.cukic at kde.org
Sun Jan 12 20:07:32 GMT 2020


> auto filter = [](const KService::Ptr &service) { return
> service->name().contains("km", Qt::CaseInsensitive); } auto offers =
> KApplicationTrader::self()->query(filter);

I'd vote for lambda/function object/callable (hello std::invoke in KF6?). If a 
more terse syntax is needed, it could be later provided with an eDSL along the 
lines of:

KApplicationTrader::query(name.contains("km", Qt::CaseInsensitive));
KApplicationTrader::query(
        filter::name.endsWith("km") &&
        filter::showInKDE);


> auto offers = KApplicationTrader::query(...);

+1, no need to put everything in an object.


> Note that the least-porting-effort solution is self() and trader language,
> since the code currently uses KServiceTypeTrader for this.

I'm aware I voted for the most-porting-effort solution ;)


Cheers,
Ivan


-- 
dr Ivan Čukić
KDE, ivan.cukic at kde.org, https://cukic.co/
gpg key fingerprint: 8FE4 D32F 7061 EA9C 8232  07AE 01C6 CE2B FF04 1C12




More information about the Kde-frameworks-devel mailing list