KService: deprecate KServiceType
Open, Needs TriagePublic

Related Objects

StatusAssignedTask
OpenNone
Openalex
mart created this task.Nov 23 2019, 5:02 PM
alex moved this task from Backlog to Waiting on Other Tasks on the KF6 board.Aug 1 2021, 11:04 AM
alex added a subscriber: alex.Dec 8 2021, 9:11 AM

Deprecating this seems like a mess, because it is used quite often internally.

How about emitting a deprecation warning for the external users and making it a implementation Detail in KF6? Then we could clean it up at any time during the KF6 lifetime (if we don't need it anymore).

Looking at the usages I only see one in a KIO test, though it seems not that useful IMHO.

dfaure added a subscriber: dfaure.Dec 14 2021, 5:31 PM

AFAICS the KServiceType class should be deprecated as well.

alex added a comment.EditedDec 14 2021, 6:01 PM

@dfaure But there are still usages in ApplicationTrader (the usage in KService should be deprecated as well, since it will not be useful in KF6)

(this was the part where I got stuck when using the deprecation macros, but I somehow was unable to find it when we talked in the meeting ๐Ÿ˜… )

KService::List KApplicationTrader::query(FilterFunc filterFunc)
{
    // Get all applications
    KSycoca::self()->ensureCacheValid();
    KServiceType::Ptr servTypePtr = KSycocaPrivate::self()->serviceTypeFactory()->findServiceTypeByName(QStringLiteral("Application"));
    Q_ASSERT(servTypePtr);
    if (servTypePtr->serviceOffersOffset() == -1) {
        return KService::List();
    }

    KService::List lst = KSycocaPrivate::self()->serviceFactory()->serviceOffers(servTypePtr);

    applyFilter(lst, filterFunc, true); // true = filter out service with NotShowIn=KDE or equivalent

    qCDebug(SERVICES) << "query returning" << lst.count() << "offers";
    return lst;
}

Yeah that's because ksycoca still contains all sorts of service types: "Application" but also all others. So when querying that DB, we still need to filter on "Application". Once we get rid of non-application desktop files in ksycoca, we can also get rid of that filtering.

I guess that means deprecating KServiceType has to wait indeed.

alex added a comment.Dec 14 2021, 8:09 PM

Would the deprecation message I had originally in the KServiceTypeTrader deprecation MR (https://invent.kde.org/frameworks/kservice/-/merge_requests/71/diffs?diff_id=220762&start_sha=4c1e4fbb57df8273c19abb842aba528fe28f204f#f720654fa73490c7f3a67a876cb9a5bac40e0c35_33_32) be enough to inform users about this change?

Then we can clean it up when KF6 is branched.

Yep that message seems fine. You were right from the start :-)

alex claimed this task.Dec 14 2021, 8:32 PM
alex moved this task from Waiting on Other Tasks to Waiting on KF6 Branching on the KF6 board.

Done with commit https://invent.kde.org/frameworks/kservice/commit/d9a958b7925b5442aa39dcab280146243fe134b2

I look forward to cleaning it up on KF6 branching :)

alex moved this task from In Progress to Done on the KF6 board.Apr 9 2023, 6:00 PM