[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-frameworks-devel
Subject:    Re: KApplicationTrader API
From:       Ivan =?utf-8?B?xIx1a2nEhw==?= <ivan.cukic () kde ! org>
Date:       2020-01-12 20:07:32
Message-ID: 6137095.31r3eYUQgx () drako
[Download RAW message or body]

> 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@kde.org, https://cukic.co/
gpg key fingerprint: 8FE4 D32F 7061 EA9C 8232  07AE 01C6 CE2B FF04 1C12


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic