|
|
|
@ -57,27 +57,21 @@ void PowerManagementInhibitor::requestIdle()
@@ -57,27 +57,21 @@ void PowerManagementInhibitor::requestIdle()
|
|
|
|
|
if ((m_state == Error) || (m_state == Idle) || (m_state == RequestIdle) || (m_state == RequestBusy)) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
qDebug("D-Bus: PowerManagementInhibitor: Requesting idle"); |
|
|
|
|
|
|
|
|
|
QDBusMessage call; |
|
|
|
|
if (!m_useGSM) |
|
|
|
|
call = QDBusMessage::createMethodCall( |
|
|
|
|
u"org.freedesktop.PowerManagement"_qs, |
|
|
|
|
u"/org/freedesktop/PowerManagement/Inhibit"_qs, |
|
|
|
|
u"org.freedesktop.PowerManagement.Inhibit"_qs, |
|
|
|
|
u"UnInhibit"_qs); |
|
|
|
|
else |
|
|
|
|
call = QDBusMessage::createMethodCall( |
|
|
|
|
u"org.gnome.SessionManager"_qs, |
|
|
|
|
u"/org/gnome/SessionManager"_qs, |
|
|
|
|
u"org.gnome.SessionManager"_qs, |
|
|
|
|
u"Uninhibit"_qs); |
|
|
|
|
|
|
|
|
|
m_state = RequestIdle; |
|
|
|
|
qDebug("D-Bus: PowerManagementInhibitor: Requesting idle"); |
|
|
|
|
|
|
|
|
|
QList<QVariant> args; |
|
|
|
|
args << m_cookie; |
|
|
|
|
call.setArguments(args); |
|
|
|
|
QDBusMessage call = m_useGSM |
|
|
|
|
? QDBusMessage::createMethodCall( |
|
|
|
|
u"org.gnome.SessionManager"_qs, |
|
|
|
|
u"/org/gnome/SessionManager"_qs, |
|
|
|
|
u"org.gnome.SessionManager"_qs, |
|
|
|
|
u"Uninhibit"_qs) |
|
|
|
|
: QDBusMessage::createMethodCall( |
|
|
|
|
u"org.freedesktop.PowerManagement"_qs, |
|
|
|
|
u"/org/freedesktop/PowerManagement/Inhibit"_qs, |
|
|
|
|
u"org.freedesktop.PowerManagement.Inhibit"_qs, |
|
|
|
|
u"UnInhibit"_qs); |
|
|
|
|
call.setArguments({m_cookie}); |
|
|
|
|
|
|
|
|
|
QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); |
|
|
|
|
auto *watcher = new QDBusPendingCallWatcher(pcall, this); |
|
|
|
@ -91,28 +85,27 @@ void PowerManagementInhibitor::requestBusy()
@@ -91,28 +85,27 @@ void PowerManagementInhibitor::requestBusy()
|
|
|
|
|
if ((m_state == Error) || (m_state == Busy) || (m_state == RequestBusy) || (m_state == RequestIdle)) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
m_state = RequestBusy; |
|
|
|
|
qDebug("D-Bus: PowerManagementInhibitor: Requesting busy"); |
|
|
|
|
|
|
|
|
|
QDBusMessage call; |
|
|
|
|
if (!m_useGSM) |
|
|
|
|
call = QDBusMessage::createMethodCall( |
|
|
|
|
QDBusMessage call = m_useGSM |
|
|
|
|
? QDBusMessage::createMethodCall( |
|
|
|
|
u"org.gnome.SessionManager"_qs, |
|
|
|
|
u"/org/gnome/SessionManager"_qs, |
|
|
|
|
u"org.gnome.SessionManager"_qs, |
|
|
|
|
u"Inhibit"_qs) |
|
|
|
|
: QDBusMessage::createMethodCall( |
|
|
|
|
u"org.freedesktop.PowerManagement"_qs, |
|
|
|
|
u"/org/freedesktop/PowerManagement/Inhibit"_qs, |
|
|
|
|
u"org.freedesktop.PowerManagement.Inhibit"_qs, |
|
|
|
|
u"Inhibit"_qs); |
|
|
|
|
else |
|
|
|
|
call = QDBusMessage::createMethodCall( |
|
|
|
|
u"org.gnome.SessionManager"_qs, |
|
|
|
|
u"/org/gnome/SessionManager"_qs, |
|
|
|
|
u"org.gnome.SessionManager"_qs, |
|
|
|
|
u"Inhibit"_qs); |
|
|
|
|
|
|
|
|
|
m_state = RequestBusy; |
|
|
|
|
|
|
|
|
|
QList<QVariant> args = {u"qBittorrent"_qs}; |
|
|
|
|
if (m_useGSM) args << 0u; |
|
|
|
|
if (m_useGSM) |
|
|
|
|
args << 0u; |
|
|
|
|
args << u"Active torrents are presented"_qs; |
|
|
|
|
if (m_useGSM) args << 8u; |
|
|
|
|
if (m_useGSM) |
|
|
|
|
args << 8u; |
|
|
|
|
call.setArguments(args); |
|
|
|
|
|
|
|
|
|
QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); |
|
|
|
|