Version: (using Devel) Installed from: Compiled sources dragonplayer should inhibit and restart screensavers only if they are activated on the system. Can i commit this patch ? Index: dragonplayer/src/app/stateChange.cpp =================================================================== --- dragonplayer/src/app/stateChange.cpp (révision 1059506) +++ dragonplayer/src/app/stateChange.cpp (copie de travail) @@ -118,37 +118,44 @@ } kDebug() << "updated menus"; - /// turn off screensaver - if( state == Phonon::PlayingState ) + KConfigGroup config(KSharedConfig::openConfig("kscreensaverrc"), "ScreenSaver"); + bool haveScreensaver = config.readEntry("Enabled", true); + + + if (haveScreensaver) { - m_stopSleepCookie = Solid::PowerManagement::beginSuppressingSleep("DragonPlayer: watching a film"); + /// turn off screensaver + if( state == Phonon::PlayingState ) + { + m_stopSleepCookie = Solid::PowerManagement::beginSuppressingSleep("DragonPlayer: watching a film"); - QDBusInterface screensaver("org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver"); - QDBusReply<int> screensaverRc = screensaver.call("Inhibit","dragonplayer","Watching a film"); - if (screensaverRc.isValid()) + QDBusInterface screensaver("org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver"); + QDBusReply<int> screensaverRc = screensaver.call("Inhibit","dragonplayer","Watching a film"); + if (screensaverRc.isValid()) + { + m_screensaverDisableCookie = screensaverRc.value(); + } + if (!m_stopScreenSaver) + m_stopScreenSaver = new KNotificationRestrictions(KNotificationRestrictions::ScreenSaver); + } + else if( Phonon::StoppedState || !TheStream::hasMedia() ) { - m_screensaverDisableCookie = screensaverRc.value(); - } - if (!m_stopScreenSaver) - m_stopScreenSaver = new KNotificationRestrictions(KNotificationRestrictions::ScreenSaver); - } - else if( Phonon::StoppedState || !TheStream::hasMedia() ) - { - //stop supressing sleep - Solid::PowerManagement::stopSuppressingSleep(m_stopSleepCookie); + //stop supressing sleep + Solid::PowerManagement::stopSuppressingSleep(m_stopSleepCookie); - //stop disabling screensaver - if (m_screensaverDisableCookie != 0) - { - QDBusInterface screensaver("org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver"); - screensaver.call("Uninhibit",m_screensaverDisableCookie); - m_screensaverDisableCookie = 0; + //stop disabling screensaver + if (m_screensaverDisableCookie != 0) + { + + QDBusInterface screensaver("org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver"); + screensaver.call("Uninhibit",m_screensaverDisableCookie); + m_screensaverDisableCookie = 0; + } + + delete m_stopScreenSaver; + m_stopScreenSaver = 0; } - - delete m_stopScreenSaver; - m_stopScreenSaver = 0; } - updateTitleBarText(); // enable/disable DVD specific buttons
Could this solve bug #186908 ?
yes i didn't saw there was an open bugreport, and this is what this patch fix
@Nicolas: that's good. If the patch will be accepted please remember to close that bug either. @Dario: do you know how could review and eventually accept the patch?
*** This bug has been marked as a duplicate of bug 186908 ***
sorry i missread and the bug 186908 isn't the same at all. Here this is not that the screensaver is started when the video plays but this is that the screensaver is enabled back when we stop playing. this bug still need review
SVN commit 1059596 by nlecureuil: Inhibit and UnInhibit screensaver only if it is enabled BUG:217642 M +17 -0 knotificationrestrictions.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1059596