--- a/inc/screensaverctrlnone.h Wed Sep 01 12:30:40 2010 +0100
+++ b/inc/screensaverctrlnone.h Tue Sep 14 21:20:26 2010 +0300
@@ -108,6 +108,21 @@
*/
void SwitchDisplayState( TInt aState );
+ /**
+ * Callback for closing the light and display resources
+ *
+ * @param aPtr pointer to CScreensaverCtrlNone
+ */
+ static TInt CloseDisplayResource( TAny* aPtr );
+
+ /**
+ * Timer for check and close display&light resource after refresh.
+ * There is possibility that light is turned on responding to some
+ * notifications(e.g new SMS). This timer makes sure that display
+ * resources are closed again after such events.
+ */
+ CPeriodic* iTimer;
+
};
#endif // C_SCREENSAVERCTRLNONE_H
--- a/scrsaver/scrsaverplugins/SlideshowPlugin/inc/SlideshowPlugin.h Wed Sep 01 12:30:40 2010 +0100
+++ b/scrsaver/scrsaverplugins/SlideshowPlugin/inc/SlideshowPlugin.h Tue Sep 14 21:20:26 2010 +0300
@@ -354,6 +354,9 @@
// MDS session
CMdESession* iMdESession;
+
+ // MDS query owned
+ CMdEObjectQuery* iQuery;
};
--- a/scrsaver/scrsaverplugins/SlideshowPlugin/src/SlideshowPlugin.cpp Wed Sep 01 12:30:40 2010 +0100
+++ b/scrsaver/scrsaverplugins/SlideshowPlugin/src/SlideshowPlugin.cpp Tue Sep 14 21:20:26 2010 +0300
@@ -134,8 +134,19 @@
delete iDrmHelper;
delete iModel;
- // First model, then engine, otherwise bad things happen
- delete iMdESession;
+ // Close and delete mds query
+ if ( iQuery )
+ {
+ iQuery->Cancel();
+ delete iQuery;
+ iQuery = NULL;
+ }
+
+ if ( iMdESession )
+ {
+ delete iMdESession;
+ iMdESession = NULL;
+ }
// Logging done
SSPLOGGER_DELETE;
@@ -1001,9 +1012,9 @@
CMdEObjectDef& imageObjDef = defaultNamespaceDef.GetObjectDefL( MdeConstants::Image::KImageObject );
// query objects with object definition "Image"
- CMdEObjectQuery* query = iMdESession->NewObjectQueryL( defaultNamespaceDef, imageObjDef, this );
+ iQuery = iMdESession->NewObjectQueryL( defaultNamespaceDef, imageObjDef, this );
- query->FindL( KDefaultRandomLoadingNumber );
+ iQuery->FindL( KDefaultRandomLoadingNumber );
}
// -----------------------------------------------------------------------------
--- a/src/screensaverctrlnone.cpp Wed Sep 01 12:30:40 2010 +0100
+++ b/src/screensaverctrlnone.cpp Tue Sep 14 21:20:26 2010 +0300
@@ -29,6 +29,10 @@
const TInt KDisplayOff = 0;
const TInt KDisplayOn = 1;
+
+const TInt KTimerDelay = 60*1000*1000; // 60 seconds
+const TInt KTimerInterval = KTimerDelay;
+
// -----------------------------------------------------------------------------
// CScreensaverCtrlNone::NewL
// -----------------------------------------------------------------------------
@@ -48,6 +52,12 @@
//
CScreensaverCtrlNone::~CScreensaverCtrlNone()
{
+ if( iTimer )
+ {
+ iTimer->Cancel();
+ delete iTimer;
+ }
+
}
// -----------------------------------------------------------------------------
@@ -74,7 +84,6 @@
{
SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlNone::ClearScreen start") );
SwitchDisplayState( KDisplayOn );
-
SwitchLights( ESSForceLightsOn );
}
@@ -151,7 +160,10 @@
//
void CScreensaverCtrlNone::ConstructL()
{
- CreateWindowL();
+ iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+ iTimer->Start( KTimerDelay, KTimerInterval,
+ TCallBack( CloseDisplayResource,this ) );
+ CreateWindowL();
SetRect( iCoeEnv->ScreenDevice()->SizeInPixels() );
ActivateL();
}
@@ -191,5 +203,25 @@
}
}
+// -----------------------------------------------------------------------------
+// CScreensaverCtrlNone::CloseDisplayResource
+// -----------------------------------------------------------------------------
+//
+TInt CScreensaverCtrlNone::CloseDisplayResource( TAny* aPtr )
+ {
+ SCRLOGGER_WRITEF( _L("CScreensaverCtrlNone::CloseResource()") );
+ CScreensaverCtrlNone* ctrl = static_cast<CScreensaverCtrlNone*>( aPtr );
+
+ if( ctrl && ctrl->Model().ScreenSaverIsOn() && !ctrl->Model().ScreenSaverIsPreviewing() )
+ {
+ ctrl->SwitchDisplayState( KDisplayOff );
+ ctrl->SwitchLights( ESSForceLightsOff );
+ return KErrNone;
+ }
+ else
+ {
+ return KErrGeneral;
+ }
+ }
//End of file