Review Request 126650: [WIP] Add PM/ScreenSaver Inhibition capabilities to KIdleTime

Martin Gräßlin mgraesslin at kde.org
Fri Jan 29 12:45:19 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126650/#review91774
-----------------------------------------------------------




src/inhibition.h (line 136)
<https://git.reviewboard.kde.org/r/126650/#comment62673>

    QScopedPointer?



src/inhibition.cpp (line 96)
<https://git.reviewboard.kde.org/r/126650/#comment62674>

    please use categorized logging



src/inhibition.cpp (line 101)
<https://git.reviewboard.kde.org/r/126650/#comment62675>

    I'm sure you are aware of it: this is blocking
    
    A non blocking variant is:
    
        QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DBus"),
                                                              QStringLiteral("/"),
                                                              QStringLiteral("org.freedesktop.DBus"),
                                                              QStringLiteral("ListNames"));
        QDBusPendingReply<QStringList> async = QDBusConnection::sessionBus().asyncCall(message);
        QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(async, this);
        connect(callWatcher, &QDBusPendingCallWatcher::finished, this,
            [this](QDBusPendingCallWatcher *self) {
                QDBusPendingReply<QStringList> reply = *self;
                self->deleteLater();
                if (!reply.isValid()) {
                    return;
                }
                if (reply.value().contains(QStringLiteral("ord.kde.Solid..."))) {
                    // Whatever needs to be done
                }
            }
        );
        
    What could be considered is also adding a service watcher to check whether it becomes available later on. But I'd say that's outside the scope of this class.


- Martin Gräßlin


On Jan. 26, 2016, 7:13 p.m., Martin Klapetek wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126650/
> -----------------------------------------------------------
> 
> (Updated Jan. 26, 2016, 7:13 p.m.)
> 
> 
> Review request for KDE Frameworks and Kai Uwe Broulik.
> 
> 
> Repository: kidletime
> 
> 
> Description
> -------
> 
> This is a work-in-progress, but I'm putting it up for a feedback now
> as most people are gone for the day when I wake up :)
> 
> ---
> 
> After some discussion in https://git.reviewboard.kde.org/r/126627/
> and then with Kai Uwe Broulik, I've added a PM/ScreenSaver inhibition
> capabilities to KIdleItem.
> 
> We decided with Kai that we want simple stuff, encapsulated away for
> the client as much as possible. So the Inhibition class has a static
> "constructors" which make the usage as easy as follows:
> 
> KIdleTime::Inhibition::createInhibition(KIdleTime::Inhibition::InhibitScreen, QStringLiteral("Playing Movie"), mainWindow);
> 
> That call would return an Inhibition* object which has methods to set
> the inhibition type and reason and to activate/deactivate the inhibition.
> The static method above would activate() on the Inhibition right away;
> this allows a simple fire-and-forget usage. The Inhibition object can
> be parented to any other object; the inhibition will be deactivated when
> the Inhibition object is destroyed. The user can also keep the pointer
> around and call deactivate() whenever actually needed.
> 
> The inhibition itself first looks for Solid and if present, it uses the
> Solid interface. If not present, it goes for the FDO interfaces.
> 
> It comes with an autotest.
> 
> 
> Diffs
> -----
> 
>   CMakeLists.txt ed5dc0c 
>   autotests/CMakeLists.txt PRE-CREATION 
>   autotests/fakePMServer.h PRE-CREATION 
>   autotests/fakePMServer.cpp PRE-CREATION 
>   autotests/inhibition_test.cpp PRE-CREATION 
>   autotests/qtest_dbus.h PRE-CREATION 
>   src/CMakeLists.txt 23e5e29 
>   src/inhibition.h PRE-CREATION 
>   src/inhibition.cpp PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/126650/diff/
> 
> 
> Testing
> -------
> 
> Everything works as expected, plus there's an autotest.
> 
> 
> Thanks,
> 
> Martin Klapetek
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160129/fa242396/attachment.html>


More information about the Kde-frameworks-devel mailing list