diff --git a/CMakeLists.txt b/CMakeLists.txt index 920f43355..4ef9bcec5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,7 +189,7 @@ qt4_add_dbus_interfaces(okularpart_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.kde.KSpe kde4_add_plugin(okularpart ${okularpart_SRCS}) -target_link_libraries(okularpart okularcore ${KDE4_KPARTS_LIBS} ${KDE4_KPRINTUTILS_LIBS} ${MATH_LIB} ${QIMAGEBLITZ_LIBRARIES} ${KDE4_PHONON_LIBRARY}) +target_link_libraries(okularpart okularcore ${KDE4_KPARTS_LIBS} ${KDE4_KPRINTUTILS_LIBS} ${MATH_LIB} ${QIMAGEBLITZ_LIBRARIES} ${KDE4_PHONON_LIBRARY} ${KDE4_SOLID_LIBRARY}) install(TARGETS okularpart DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp index 7c3f6183e..cdcfc4b51 100644 --- a/ui/presentationwidget.cpp +++ b/ui/presentationwidget.cpp @@ -41,6 +41,8 @@ #include #include +#include + // system includes #include #include @@ -1391,14 +1393,19 @@ void PresentationWidget::applyNewScreenSize( const QSize & oldSize ) void PresentationWidget::inhibitScreenSaver() { + QString reason = i18nc( "Reason for inhibiting the screensaver activation, when the presentation mode is active", "Giving a presentation" ); QDBusMessage message = QDBusMessage::createMethodCall( "org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", "Inhibit" ); message << QString( "Okular" ); - message << i18nc( "Reason for inhibiting the screensaver activation, when the presentation mode is active", "Giving a presentation" ); + message << reason; QDBusReply reply = QDBusConnection::sessionBus().call( message ); if ( reply.isValid() ) m_screenSaverCookie = reply.value(); + + // Inhibit screen and sleep + m_screenInhibitCookie = Solid::PowerManagement::beginSuppressingScreenPowerManagement(reason); + m_sleepInhibitCookie = Solid::PowerManagement::beginSuppressingSleep(reason); } void PresentationWidget::allowScreenSaver() @@ -1410,6 +1417,10 @@ void PresentationWidget::allowScreenSaver() message << (uint)m_screenSaverCookie; QDBusConnection::sessionBus().send( message ); } + + // Remove cookies + Solid::PowerManagement::stopSuppressingScreenPowerManagement(m_screenInhibitCookie); + Solid::PowerManagement::stopSuppressingSleep(m_sleepInhibitCookie); } void PresentationWidget::showTopBar( bool show ) diff --git a/ui/presentationwidget.h b/ui/presentationwidget.h index d7b21d674..eac27310c 100644 --- a/ui/presentationwidget.h +++ b/ui/presentationwidget.h @@ -105,6 +105,8 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver QRect m_drawingRect; int m_screen; int m_screenSaverCookie; + int m_screenInhibitCookie; + int m_sleepInhibitCookie; // transition related QTimer * m_transitionTimer;