KApplicationTrader API
Albert Astals Cid
aacid at kde.org
Sun Jan 12 22:09:30 GMT 2020
El diumenge, 12 de gener de 2020, a les 11:50:03 CET, David Faure va escriure:
> I wrote a KApplicationTrader class in https://phabricator.kde.org/D25698
> and I need input on API.
>
> Use case: the user types "km" in krunner.
> In order to find all applications that contain "km" (case insensitive), do we want to write
>
> auto offers = KApplicationTrader::self()->query("'km' ~~ Name");
>
> or
>
> auto filter = [](const KService::Ptr &service) { return service->name().contains("km", Qt::CaseInsensitive); }
> auto offers = KApplicationTrader::self()->query(filter);
>
> ?
The second one fails if i type service->name() wrong, the first one doesn't if i write NaMe, so the second one is millions of times better in that regard in my opinion.
I mean i already know how to write C++ why should i learn "weird language"?
Cheers,
Albert
More information about the Kde-frameworks-devel
mailing list