UPowerSuspendJob::UPowerSuspendJob(OrgFreedesktopUPowerInterface *upowerInterface,
                                   PowerDevil::BackendInterface::SuspendMethod method,
                                   PowerDevil::BackendInterface::SuspendMethods supported)
    : KJob(), m_upowerInterface(upowerInterface)
{
    kDebug() << "Stancing Suspend job";
    m_method = method;
    m_supported = supported;

    connect(m_upowerInterface, SIGNAL(Resuming()), this, SLOT(resumeDone()));
}
Esempio n. 2
0
PowerManagement::PowerManagement()
    : inhibitSuspendWhilstPlaying(false)
    , cookie(-1)
{
    policy = new OrgKdeSolidPowerManagementPolicyAgentInterface(OrgKdeSolidPowerManagementPolicyAgentInterface::staticInterfaceName(),
                                                                QLatin1String("/org/kde/Solid/PowerManagement/PolicyAgent"),
                                                                QDBusConnection::sessionBus(), this);
    inhibit = new OrgFreedesktopPowerManagementInhibitInterface(OrgFreedesktopPowerManagementInhibitInterface::staticInterfaceName(),
                                                                QLatin1String("/org/freedesktop/PowerManagement/Inhibit"),
                                                                QDBusConnection::sessionBus(), this);
    upower = new OrgFreedesktopUPowerInterface(OrgFreedesktopUPowerInterface::staticInterfaceName(),
                                               QLatin1String("/org/freedesktop/UPower"), QDBusConnection::systemBus(), this);
    login1 = new OrgFreedesktopLogin1ManagerInterface("org.freedesktop.login1",
                                                      QLatin1String("/org/freedesktop/login1"), QDBusConnection::systemBus(), this);
    connect(upower, SIGNAL(Resuming()), this, SIGNAL(resuming()));
    connect(login1, SIGNAL(PrepareForSleep(bool)), this, SLOT(prepareForSleep(bool)));
}