Understanding the kscreen plasmoid ("Display Configuration")

I’m new to widget development and trying to create a simple Plasma6 widget to prevent the system sleeping but still allowing the screen to lock automatically (like a manual switch for systemd-inhibit --what=“sleep” --mode “block” …).

So I am trying to understand how the “Presentation Mode” in the /usr/share/plasma/plasmoids/org.kde.kscreen/ widget is implemented - in particular the Plasma5Support stuff…

P5Support.DataSource {
    id: pmSource
    engine: "powermanagement"
    connectedSources: ["PowerDevil", "Inhibitions"]
    ...
}
...
const service = pmSource.serviceForSource("PowerDevil");
...
service.operationDescription("beginSuppressingScreenPowerManagement");

I found documentation for KDE API Reference - Plasma - Plasma5Support::DataSource, but nothing about valid connectedSources: ["PowerDevil", "Inhibitions"], or what the PowerDevil "beginSuppressingScreenPowerManagement" operation is.

Where can I find more information on the PowerDevil service and it’s valid operations?

I also note the Plasma5Support documentation indicates it’s for “plasma5 deprecated classes” - what is the Plasma6 way for a widget to control PowerDevil?

Thanks.

Ended up doing it in C++ with DBus…

    QDBusMessage msg = QDBusMessage::createMethodCall(
        "org.freedesktop.login1",
        "/org/freedesktop/login1",
        "org.freedesktop.login1.Manager",
        "Inhibit"
    );

    msg << "sleep"
        << "WHO"
        << "WHY"
        << "block";

    QDBusReply<QDBusUnixFileDescriptor> reply =
        QDBusConnection::systemBus().call(msg);