mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-25 02:45:38 +00:00
Since KDE 4.8, suppressing screen power management also inhibits the screensaver. Removing relevant now redundant code paths which are no longer needed since 4.8
REVIEW:103723
(cherry picked from commit 551d00a972
)
This commit is contained in:
parent
cc3d80dc33
commit
ca1c209ec0
|
@ -129,7 +129,7 @@ class PresentationToolBar : public QToolBar
|
|||
|
||||
PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc, KActionCollection * collection )
|
||||
: QWidget( 0 /* must be null, to have an independent widget */, Qt::FramelessWindowHint ),
|
||||
m_pressedLink( 0 ), m_handCursor( false ), m_drawingEngine( 0 ), m_screenSaverCookie( -1 ),
|
||||
m_pressedLink( 0 ), m_handCursor( false ), m_drawingEngine( 0 ),
|
||||
m_parentWidget( parent ),
|
||||
m_document( doc ), m_frameIndex( -1 ), m_topBar( 0 ), m_pagesEdit( 0 ), m_searchBar( 0 ),
|
||||
m_screenSelect( 0 ), m_isSetup( false ), m_blockNotifications( false ), m_inBlackScreenMode( false )
|
||||
|
@ -232,8 +232,8 @@ PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc
|
|||
|
||||
setupActions( collection );
|
||||
|
||||
// inhibit the screen saver
|
||||
inhibitScreenSaver();
|
||||
// inhibit power management
|
||||
inhibitPowerManagement();
|
||||
|
||||
show();
|
||||
|
||||
|
@ -245,8 +245,8 @@ PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc
|
|||
|
||||
PresentationWidget::~PresentationWidget()
|
||||
{
|
||||
// allow the screen saver again
|
||||
allowScreenSaver();
|
||||
// allow power management saver again
|
||||
allowPowerManagement();
|
||||
|
||||
// stop the audio playbacks
|
||||
Okular::AudioPlayer::instance()->stopPlaybacks();
|
||||
|
@ -1391,33 +1391,18 @@ void PresentationWidget::applyNewScreenSize( const QSize & oldSize )
|
|||
generatePage( true /* no transitions */ );
|
||||
}
|
||||
|
||||
void PresentationWidget::inhibitScreenSaver()
|
||||
void PresentationWidget::inhibitPowerManagement()
|
||||
{
|
||||
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 << reason;
|
||||
|
||||
QDBusReply<uint> reply = QDBusConnection::sessionBus().call( message );
|
||||
if ( reply.isValid() )
|
||||
m_screenSaverCookie = reply.value();
|
||||
|
||||
// Inhibit screen and sleep
|
||||
// Note: beginSuppressingScreenPowerManagement inhibits DPMS, automatic brightness change and screensaver
|
||||
m_screenInhibitCookie = Solid::PowerManagement::beginSuppressingScreenPowerManagement(reason);
|
||||
m_sleepInhibitCookie = Solid::PowerManagement::beginSuppressingSleep(reason);
|
||||
}
|
||||
|
||||
void PresentationWidget::allowScreenSaver()
|
||||
void PresentationWidget::allowPowerManagement()
|
||||
{
|
||||
if ( m_screenSaverCookie != -1 )
|
||||
{
|
||||
QDBusMessage message = QDBusMessage::createMethodCall( "org.freedesktop.ScreenSaver", "/ScreenSaver",
|
||||
"org.freedesktop.ScreenSaver", "UnInhibit" );
|
||||
message << (uint)m_screenSaverCookie;
|
||||
QDBusConnection::sessionBus().send( message );
|
||||
}
|
||||
|
||||
// Remove cookies
|
||||
Solid::PowerManagement::stopSuppressingScreenPowerManagement(m_screenInhibitCookie);
|
||||
Solid::PowerManagement::stopSuppressingSleep(m_sleepInhibitCookie);
|
||||
|
|
|
@ -86,8 +86,8 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver
|
|||
void requestPixmaps();
|
||||
void setScreen( int );
|
||||
void applyNewScreenSize( const QSize & oldSize );
|
||||
void inhibitScreenSaver();
|
||||
void allowScreenSaver();
|
||||
void inhibitPowerManagement();
|
||||
void allowPowerManagement();
|
||||
void showTopBar( bool );
|
||||
// create actions that interact with this widget
|
||||
void setupActions( KActionCollection * collection );
|
||||
|
@ -104,7 +104,6 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver
|
|||
AnnotatorEngine * m_drawingEngine;
|
||||
QRect m_drawingRect;
|
||||
int m_screen;
|
||||
int m_screenSaverCookie;
|
||||
int m_screenInhibitCookie;
|
||||
int m_sleepInhibitCookie;
|
||||
|
||||
|
|
Loading…
Reference in a new issue