Bug 217642

Summary: [patch] dragon player break screensaver preferences
Product: [Applications] dragonplayer Reporter: Nicolas L. <kde>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: andresbajotierra, finex, martin.sandsmark
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Unspecified   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nicolas L. 2009-12-06 21:56:55 UTC
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
Comment 1 FiNeX 2009-12-06 23:02:54 UTC
Could this solve bug #186908 ?
Comment 2 Nicolas L. 2009-12-06 23:14:39 UTC
yes i didn't saw there was an open bugreport, and this is what this patch fix
Comment 3 FiNeX 2009-12-07 00:16:16 UTC
@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?
Comment 4 Martin Sandsmark 2009-12-07 00:31:43 UTC

*** This bug has been marked as a duplicate of bug 186908 ***
Comment 5 Nicolas L. 2009-12-07 00:40:43 UTC
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
Comment 6 Nicolas L. 2009-12-07 02:06:03 UTC
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