Moving PowerDevil to kdereview

Sebastian Kügler sebas at kde.org
Thu Sep 4 19:42:23 BST 2008


On Thursday 04 September 2008 20:24:21 Friedrich W. H. Kossebau wrote:
> Am Donnerstag, 4. September 2008, um 18:59 Uhr, schrieb Sebastian Kügler:
> > On Thursday 04 September 2008 15:18:09 Friedrich W. H. Kossebau wrote:
> > > > The core is the KDED module. Polling was removed thanks to a system
> > > > that sets the polling time to the next upcoming idle event. Every
> > > > time the polling function is called PowerDevil calculates the minimum
> > > > time for an idle event to come, and sets the timer accordingly. For
> > > > example, in a scenario where you have a lot of events in a small
> > > > amount of time, PowerDevil polls the system every minute. For
> > > > detecting system activity, it uses the same grabbing system used
> > > > previously in KDE4Powersave.
> > >
> > > Please tell me where I am wrong:
> > > So this is a per-user/session demon, right? But shouldn't this be a
> > > per-system demon? How are things supposed to work if two or more users
> > > are logged in at the same time, perhaps even running different
> > > environments (KDE3, KDE4, GNOME, ...) which all try to react to system
> > > changes?
> >
> > This one is covered by Solid and ultimately HAL, no? (I'm assuming that
> > powerdevil only offeres the options that it's allowed by the capability
> > checks, as indicated in the Capabilities tab, just like the shutdown
> > options in the ksmserver logout dialog).
>
> This code looks like the PowerDevil demon acts itself as events handler:
>
> --- 8< ----
>
> PowerDevilDaemon::PowerDevilDaemon(...)
>
> :        m_notifier(Solid::Control::PowerManager::notifier())
>
> {
> ...
>     connect(m_notifier, SIGNAL(buttonPressed(int)),
>       this, SLOT(buttonPressed(int)));
> ...
> }
>
> void PowerDevilDaemon::buttonPressed(int but)
> {
>     if (but == Solid::Control::PowerManager::LidClose) {
>
>         KConfigGroup *settings = getCurrentProfile();
>
>         if (!settings)
>             return;
>
>         switch (settings->readEntry("lidAction").toInt()) {
>         case Shutdown:
>             shutdown();
>             break;
>         case S2Disk:
>             suspendToDisk();
>             break;
>         case S2Ram:
>             suspendToRam();
>             break;
>         case Standby:
>             standby();
>             break;
>         case Lock:
>             lockScreen();
>             break;
>         default:
>             break;
>         }
>
>         delete settings;
>
>     }
> }
> --- 8< ----

I assume that the corresponding QActions won't be available when the 
capability check in Solid fails (otherwise, the call itself fails).

I didn't look at that part of the code though, so I might be wrong.
-- 
sebas

 http://www.kde.org | http://vizZzion.org |  GPG Key ID: 9119 0EF9 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 489 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080904/db0e6c2f/attachment.sig>


More information about the kde-core-devel mailing list