Hi all,

        I'm writing my first plasmoid and I'd like to make a plasmoid that show 
the Energy Rate using the lib org.freedesktop.upower.

My script is something like this:

QDBusInterface *battInterface   =       new 
QDBusInterface("org.freedesktop.UPower",
                                                
"/org/freedesktop/UPower/devices/battery_BAT1",
                                                
"org.freedesktop.UPower.Device", 
                                                QDBusConnection::systemBus(), 
this);
    
QDBusReply<double> wattUsage    =       battInterface->call( "EnergyRate" );
    
if ( wattUsage.isValid() )
{
        if( wattUsage.value() > 0 ) {
        wattString      =       QString::number( wattUsage.value() , 'd' , 2 ) 
+ "W";
        }
        else    {
        wattString      =       "AC";
        }
}
else
        wattString      =       wattUsage.error().message();

but I receive the error <Method "EnergyRate" with signature "" on interface 
"org.freedesktop.UPower.Device" Doesn't exist">

According to you, where is the problem?

Thank you :)

SoulEdge
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to