--- a/group/screensaver.mmp Tue May 11 16:14:23 2010 +0300
+++ b/group/screensaver.mmp Tue May 25 12:43:23 2010 +0300
@@ -121,5 +121,7 @@
LIBRARY akncapserverclient.lib
#endif
+EPOCHEAPSIZE 0x5000 0x2000000
+
// End of file.
--- a/inc/screensaverctrlmovingtext.h Tue May 11 16:14:23 2010 +0300
+++ b/inc/screensaverctrlmovingtext.h Tue May 25 12:43:23 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-
+#ifdef USE_DATE_AND_TEXT
#ifndef C_SCREENSAVERCTRLMOVINGTEXT_H
#define C_SCREENSAVERCTRLMOVINGTEXT_H
@@ -257,4 +257,5 @@
#endif // C_SCREENSAVERCTRLMOVINGTEXT_H
+#endif // USE_DATE_AND_TEXT
// End of file.
--- a/inc/screensaverctrlnone.h Tue May 11 16:14:23 2010 +0300
+++ b/inc/screensaverctrlnone.h Tue May 25 12:43:23 2010 +0300
@@ -78,6 +78,12 @@
*/
void SizeChanged();
+ /**
+ * Draw
+ * @see CCoeControl::Draw(const TRect& aRect)
+ */
+ void Draw( const TRect& aRect ) const;
+
private:
/**
--- a/inc/screensaverengine.h Tue May 11 16:14:23 2010 +0300
+++ b/inc/screensaverengine.h Tue May 25 12:43:23 2010 +0300
@@ -138,19 +138,6 @@
* microseconds. 0 or negative value will disable the timer.
*/
void SetExpiryTimerTimeout( TInt aTimeout );
-
-
- /**
- * Informs the engine about changes in keyguard state
- * @param aEnabled whether the keyguard is now on or off
- */
- void HandleKeyguardStateChanged( TBool aEnabled );
-
- /**
- * Informs the engine that a start/stop request was emitted through P&S
- * @param aStart True if screensaver should be started, false if stopped
- */
- void HandleActivateSSChanged( TBool aStart );
private:
@@ -199,6 +186,11 @@
void StartPreviewTimer();
/**
+ * Starts pause timer
+ */
+ void StartPauseTimer();
+
+ /**
* Kill the timer
*
* @param aTimer the timer you want stop
@@ -220,21 +212,16 @@
* Called when the time that the user did no activity is out.
*/
static TInt HandleInactiveEventL(TAny* aPtr);
-
- /**
- * Called when the time that the user did activity is out.
- */
- static TInt HandleActiveEventShortL(TAny* aPtr);
-
- /**
- * Called when the time that the user did no activity is out.
- */
- static TInt HandleInactiveEventShortL(TAny* aPtr);
/**
* Callback fuction. Called when the suspension tiemr time out
*/
static TInt HandleSuspendTimerExpiry( TAny* aPtr );
+
+ /**
+ * Callback function. Called when the pause timer expires
+ */
+ static TInt HandlePauseTimerExpiry( TAny* aPtr );
/**
* Returns the CScreensaverView
@@ -299,11 +286,6 @@
CScreensaverIndicatorArray* iIndicatorArray;
/**
- * The trigger for screensaver activation, short timeout
- */
- CUserActivityManager* iActivityManagerScreensaverShort;
-
- /**
* moved from view class
*/
TScreensaverColorModel iColorModel;
@@ -332,6 +314,12 @@
*/
CPeriodic* iExpiryTimer;
+ /**
+ * Pause timer. Used to reactivate screensaver after 5s when being
+ * interrupted and keys are locked
+ */
+ CPeriodic* iPauseTimer;
+
};
--- a/inc/screensavershareddatamonitor.h Tue May 11 16:14:23 2010 +0300
+++ b/inc/screensavershareddatamonitor.h Tue May 25 12:43:23 2010 +0300
@@ -109,7 +109,15 @@
*/
static TInt HandleShuttingDownStateChanged(TAny* aPtr);
+ /**
+ * Callback function. Called when a start/stop request is received
+ */
static TInt HandleActivateSSChanged( TAny* aPtr );
+
+ /**
+ * Callback function. Called when charger state changes
+ */
+ static TInt HandleChargerStateChanged( TAny* aPtr );
private:
@@ -156,6 +164,12 @@
RProperty iActivateSSProperty;
CSubscriber* iActivateSSSubscriber;
+
+ /*
+ * Charger state property and subscriber
+ */
+ RProperty iChargerStateProperty;
+ CSubscriber* iChargerStateSubscriber;
};
--- a/inc/screensaverview.h Tue May 11 16:14:23 2010 +0300
+++ b/inc/screensaverview.h Tue May 25 12:43:23 2010 +0300
@@ -60,7 +60,7 @@
/**
* Creates the display object by the parameter
*
- * @param the object factory object, default type is EDisplayTime
+ * @param the object factory object, default type is EDisplayNone
*/
void CreateDisplayObjectL( TDisplayObjectType aType );
--- a/scrsaver/scrsaverplugins/SlideshowPlugin/group/SlideshowPlugin.mmp Tue May 11 16:14:23 2010 +0300
+++ b/scrsaver/scrsaverplugins/SlideshowPlugin/group/SlideshowPlugin.mmp Tue May 25 12:43:23 2010 +0300
@@ -77,6 +77,7 @@
LIBRARY eikdlg.lib
LIBRARY eikcore.lib
LIBRARY eikcoctl.lib
+LIBRARY mdeclient.lib
// LIBRARY AknLayout2.lib // Scalable UI
// LIBRARY AknLayout2Scalable.lib // Scalable UI
--- a/scrsaver/scrsaverplugins/SlideshowPlugin/inc/SlideshowPlugin.h Tue May 11 16:14:23 2010 +0300
+++ b/scrsaver/scrsaverplugins/SlideshowPlugin/inc/SlideshowPlugin.h Tue May 25 12:43:23 2010 +0300
@@ -33,6 +33,8 @@
#include <MCLFOperationObserver.h>
#include <MCLFContentListingEngine.h>
#include <MCLFItemListModel.h>
+#include <mdesession.h>
+#include <mdequery.h>
#include "SlideshowModel.h"
#include "SlideshowSlide.h"
@@ -43,7 +45,6 @@
class CRepositoryWatcher;
class CRepository;
-
/**
* Encapsulates the Settings that are written into the central repository
* @lib ScreenSaverAnimPlugin.lib
@@ -77,7 +78,8 @@
* @since 3.1
*/
class CSlideshowPlugin: public CScreensaverPluginInterfaceDefinition,
- public MCLFOperationObserver
+ public MMdESessionObserver,
+ public MMdEQueryObserver
{
enum TPluginState
{
@@ -163,21 +165,58 @@
TScreensaverEvent aEvent,
TAny* aData );
-
-public: // From MCLFOperationObserver
+public: // from MMdESessionObserver
+ /**
+ * Called to notify the observer that opening the session has been
+ * completed and, if the opening succeeded, the session is ready for use.
+ *
+ * @param aSession session
+ * @param aError <code>KErrNone</code>, if opening the session succeeded;
+ * or one of the system-wide error codes, if opening the
+ * session failed
+ */
+ void HandleSessionOpened(CMdESession& aSession, TInt aError);
/**
- * From MCLFOperationObserver. Called by CLF when e.g. a content listing
- * operation is finished.
- * @since S60 3.1
- * @param aOperationEvent Operation event code of the event
- * @param aError System wide error code if the operation did not
- * succeed.
+ * Called to notify the observer about errors, which are not a direct
+ * consequence of the operations initiated by the client but caused by
+ * some external source (e.g., other clients). The error cannot be
+ * recovered and all on-going operations initiated by the client have been
+ * aborted. Any attempts to continue using the session will cause a panic.
+ * The client should close the session immediately and try to open a new
+ * session, if it needs to continue using the metadata engine.
+ *
+ * @param aSession session
+ * @param aError one of the system-wide error codes
*/
- virtual void HandleOperationEventL(TCLFOperationEvent aOperationEvent,
- TInt aError);
+ void HandleSessionError(CMdESession& aSession, TInt aError);
+
+public: // from MMdEQueryObserver
+ /**
+ * Called to notify the observer that new results have been received
+ * in the query.
+ *
+ * @param aQuery Query instance that received new results.
+ * @param aFirstNewItemIndex Index of the first new item that was added
+ * to the result item array.
+ * @param aNewItemCount Number of items added to the result item
+ * array.
+ */
+ void HandleQueryNewResults(CMdEQuery& aQuery,
+ TInt aFirstNewItemIndex,
+ TInt aNewItemCount);
-
+ /**
+ * Called to notify the observer that the query has been completed,
+ * or that an error has occured.
+ *
+ * @param aQuery Query instance.
+ * @param aError <code>KErrNone</code>, if the query was completed
+ * successfully. Otherwise one of the system-wide error
+ * codes.
+ */
+ void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);
+
public: // New Functions
/**
@@ -259,9 +298,14 @@
TInt SettingsChanged();
- void ConnectToCLFL();
- void WaitForCLF();
- void EndWaitForCLF();
+ void ConnectToMDSSessionL();
+ void WaitForMDS();
+ void EndWaitForMDS();
+ void LoadImagesToModel(const CMdEQuery& aQuery,
+ TInt aFirstNewItemIndex = 0,
+ TInt aNewItemCount = 0);
+ void AppendSlideToModelL(TDesC& aFileName, TBool aIsOnMC);
+ void OpenQueryL();
private:
// Pointer to the screensaver host
@@ -297,29 +341,19 @@
// Localised name
HBufC* iScreensaverName;
- // Gallery content listing engine
- MCLFContentListingEngine* iCLFEngine;
-
- // Gallery content listing model
- MCLFItemListModel* iCLFModel;
-
- // CLF status
- TInt iCLFError;
-
- // CLF model state
- TBool iCLFModelUpToDate;
-
-
// Waiter
CActiveSchedulerWait iWaiter;
TBool iWaitActive;
-
+
// Draw count
TInt iDrawCount;
TBool iTimerUpdated;
-
+
//loading state
TBool iIsLoadFinished;
+
+ // MDS session
+ CMdESession* iMdESession;
};
--- a/scrsaver/scrsaverplugins/SlideshowPlugin/src/SlideshowPlugin.cpp Tue May 11 16:14:23 2010 +0300
+++ b/scrsaver/scrsaverplugins/SlideshowPlugin/src/SlideshowPlugin.cpp Tue May 25 12:43:23 2010 +0300
@@ -37,7 +37,11 @@
#include <ecom/ecom.h>
#include <ContentListingFactory.h>
-#include <MCLFItem.h>
+#include <mdeobjectdef.h>
+#include <mdelogiccondition.h>
+#include <mdenamespacedef.h>
+#include <mdeconstants.h>
+#include <mdeobjectquery.h>
#include <slideshowplugin.rsg>
@@ -47,6 +51,7 @@
// Constants
const TInt KSecsToMicros = 1000000;
+const TUint KDefaultRandomLoadingNumber = 100;
// Slideshow duration times (secs)
const TInt KMinSlideshowTime = 1;
@@ -130,8 +135,7 @@
delete iModel;
// First model, then engine, otherwise bad things happen
- delete iCLFModel;
- delete iCLFEngine;
+ delete iMdESession;
// Logging done
SSPLOGGER_DELETE;
@@ -174,9 +178,6 @@
// Read settings
ReadSettings();
-
- // Make sure random slides are loaded
- iCLFModelUpToDate = EFalse;
iTimerUpdated = EFalse;
}
@@ -232,9 +233,6 @@
// Load slides on start rather than here
// LoadSlidesL();
- // Make sure random slides are loaded
- iCLFModelUpToDate = EFalse;
-
SSPLOGGER_LEAVEFN("InitializeL()");
return KErrNone;
@@ -424,33 +422,12 @@
return KErrNone;
}
-
-// -----------------------------------------------------------------------------
-// From MCLFOperationObserver. Called by CLF when e.g. a content listing
-// operation is finished.
-// -----------------------------------------------------------------------------
-void CSlideshowPlugin::HandleOperationEventL(TCLFOperationEvent aOperationEvent,
- TInt aError)
- {
- if (aOperationEvent == ECLFRefreshComplete)
- {
- iCLFError = aError;
- EndWaitForCLF();
- }
-
- if (aOperationEvent == ECLFModelOutdated)
- {
- // Need to update random list on next start
- iCLFModelUpToDate = EFalse;
- }
- }
-
-
// -----------------------------------------------------------------------------
// CSlideshowPlugin::ReadSettings
// -----------------------------------------------------------------------------
TInt CSlideshowPlugin::ReadSettings()
{
+
TInt err = KErrNone;
err = iSlideshowRepository->Get(
@@ -811,88 +788,16 @@
void CSlideshowPlugin::LoadRandomSlidesL()
{
SSPLOGGER_ENTERFN("LoadRandomSlidesL()");
-
- // No need to do anything, if model hasn't become
- // outdated since last loading
- if (iCLFModelUpToDate)
- {
- return;
- }
-
+
// Start by getting rid of possibly loaded slides
iModel->DeleteAll();
- // Make sure CLF is ready
- ConnectToCLFL();
-
- // Refresh CLF model
- iCLFError = KErrNone;
- iCLFModel->RefreshL();
-
- // Wait for refresh to complete before continuing
- WaitForCLF();
-
- // On error bail out
- if (iCLFError != KErrNone)
- {
- SSPLOGGER_WRITEF(_L("SSP: CLF refresh error %d"), iCLFError);
- return;
- }
-
- // Model is up to date
- iCLFModelUpToDate = ETrue;
-
- // CLF model should now contain the image files in Gallery, proceed to
- // load into our model
- TInt nItems = iCLFModel->ItemCount();
-
- // Loop through, add filenames
- TInt count = 0;
- for (TInt i = 0; i < nItems; i++)
- {
- // TFileName fileName;
- TPtrC fileName;
- TInt error = KErrNone;
-
- const MCLFItem& item = iCLFModel->Item(i);
-
- error = item.GetField(ECLFFieldIdFileNameAndPath, fileName);
+ // connect to MDS
+ ConnectToMDSSessionL();
- // If OK, add to model
- if (error == KErrNone)
- {
- // Check that the file exists. If not, it is still OK, if it is
- // on the memory card - it may show up later. Omit files from other
- // drives that do not exist at the time of loading
- // TODO: Can be removed, as slides are loaded on every start
- TBool exists = BaflUtils::FileExists(iEikEnv->FsSession(), fileName);
- TBool isOnMC = SlideshowUtil::IsOnMC(fileName);
+ // Wait for query of MDS to complete before continuing
+ WaitForMDS();
- if (!exists) // && (!isOnMC))
- {
- // Do not add nonexisting files from other than memory card
- continue;
- }
-#if 0
- // Check that the file's DRM rights allow it to be displayed (if not
- // missing because not on MMC
- if (!SlideshowUtil::DRMCheck(fileName))
- {
- // No point in adding files that cannot be displayed anyway
- continue;
- }
-#endif
- // Create a slide with the filename and store it in the model
- CSlideshowSlide* pSlide = CSlideshowSlide::NewL(fileName, isOnMC);
- CleanupStack::PushL(pSlide);
- iModel->AppendSlideL(pSlide);
- CleanupStack::Pop(pSlide);
-
- SSPLOGGER_WRITEF(_L("SSP: Slide %d added, file: %S"), count, &fileName);
- count++;
- }
- }
-
SSPLOGGER_LEAVEFN("LoadRandomSlidesL()");
}
@@ -1025,35 +930,23 @@
// -----------------------------------------------------------------------------
-// CSlideshowPlugin::ConnectToCLFL
-// Connects to Content Listing Framework. Can be called many times,
+// CSlideshowPlugin::ConnectToMDSSessionL
+// Connects to MDS Listing Framework. Can be called many times,
// connects only once
// -----------------------------------------------------------------------------
-void CSlideshowPlugin::ConnectToCLFL()
+void CSlideshowPlugin::ConnectToMDSSessionL()
{
- if (!iCLFEngine)
- {
- iCLFEngine = ContentListingFactory::NewContentListingEngineLC();
- CleanupStack::Pop(); // LC
- }
-
- if (!iCLFModel)
+ if (!iMdESession)
{
- iCLFModel = iCLFEngine->CreateListModelLC(*this);
- CleanupStack::Pop(); // LC
+ iMdESession = CMdESession::NewL( *this );
}
-
- // Set image types to model
- RArray<TInt> typeArray;
- CleanupClosePushL(typeArray);
- typeArray.AppendL(ECLFMediaTypeImage);
- iCLFModel->SetWantedMediaTypesL(typeArray.Array());
- CleanupStack::PopAndDestroy(&typeArray);
}
-
-// Begins wait for CLF
-void CSlideshowPlugin::WaitForCLF()
+// -----------------------------------------------------------------------------
+// CSlideshowPlugin::WaitForMDS
+// Begins wait for MDS session connected
+// -----------------------------------------------------------------------------
+void CSlideshowPlugin::WaitForMDS()
{
if (iWaitActive)
{
@@ -1066,9 +959,11 @@
}
}
-
-// Ends wait for CLF
-void CSlideshowPlugin::EndWaitForCLF()
+// -----------------------------------------------------------------------------
+// CSlideshowPlugin::WaitForMDS
+// Ends wait for MDS
+// -----------------------------------------------------------------------------
+void CSlideshowPlugin::EndWaitForMDS()
{
if (!iWaitActive)
{
@@ -1080,5 +975,152 @@
iWaitActive = EFalse;
}
}
-
+
+// -----------------------------------------------------------------------------
+// CSlideshowPlugin::HandleSessionOpened
+// Session is open successfully, then start a query for images
+// -----------------------------------------------------------------------------
+void CSlideshowPlugin::HandleSessionOpened(CMdESession& /*aSession*/, TInt aError)
+ {
+ if ( KErrNone != aError )
+ {
+ // Error occurred when opening session. iMdeSession must be deleted and new
+ // session opened if we wish to use MdE.
+ delete iMdESession;
+ iMdESession = NULL;
+ return;
+ }
+ // The session was opened successfully.
+ TRAP(aError, OpenQueryL() );
+ }
+
+// -----------------------------------------------------------------------------
+// CSlideshowPlugin::OpenQueryL
+// -----------------------------------------------------------------------------
+void CSlideshowPlugin::OpenQueryL()
+ {
+ CMdENamespaceDef& defaultNamespaceDef = iMdESession->GetDefaultNamespaceDefL();
+ CMdEObjectDef& imageObjDef = defaultNamespaceDef.GetObjectDefL( MdeConstants::Image::KImageObject );
+
+ // query objects with object definition "Image"
+ CMdEObjectQuery* query = iMdESession->NewObjectQueryL( defaultNamespaceDef, imageObjDef, this );
+
+ query->FindL( KDefaultRandomLoadingNumber );
+ }
+
+// -----------------------------------------------------------------------------
+// CSlideshowPlugin::HandleSessionError
+// error happened when open the session, close session and end the waiting
+// -----------------------------------------------------------------------------
+void CSlideshowPlugin::HandleSessionError(CMdESession& /*aSession*/, TInt /*aError*/)
+ {
+ if ( iMdESession )
+ {
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+ // error happened when open the session, so end the waiting for MDS session.
+ EndWaitForMDS();
+ }
+
+// -----------------------------------------------------------------------------
+// CSlideshowPlugin::HandleQueryCompleted
+// query completed, load the images
+// -----------------------------------------------------------------------------
+void CSlideshowPlugin::HandleQueryCompleted(CMdEQuery& aQuery, TInt aError)
+ {
+ if ( aError == KErrNone )
+ {
+ LoadImagesToModel( aQuery );
+ }
+ EndWaitForMDS();
+ }
+
+// -----------------------------------------------------------------------------
+// CSlideshowPlugin::HandleQueryCompleted
+// part of query completed, load the completed images
+// -----------------------------------------------------------------------------
+void CSlideshowPlugin::HandleQueryNewResults( CMdEQuery& aQuery,
+ TInt aFirstNewItemIndex,
+ TInt aNewItemCount)
+ {
+ LoadImagesToModel( aQuery, aFirstNewItemIndex, aNewItemCount );
+ EndWaitForMDS();
+ }
+
+// -----------------------------------------------------------------------------
+// CSlideshowPlugin::LoadImagesToModel
+// load the images when query is successfully
+// -----------------------------------------------------------------------------
+void CSlideshowPlugin::LoadImagesToModel(const CMdEQuery& aQuery,
+ TInt aFirstNewItemIndex,
+ TInt aNewItemCount)
+ {
+ CMdEObjectQuery& query= ( CMdEObjectQuery& ) aQuery;
+ // query is completed
+ if( aQuery.Count() > 0 )
+ {
+ // some items were found!
+ // Loop through, add filenames
+ TInt startIndex = aFirstNewItemIndex;
+ TInt nItem = aNewItemCount;
+ if ( aFirstNewItemIndex == 0 && aFirstNewItemIndex == aNewItemCount )
+ {
+ startIndex = 0;
+ nItem = aQuery.Count();
+ }
+ TInt count = 0;
+ for ( ; startIndex < nItem; startIndex++)
+ {
+ // TFileName fileName;
+ TBufC<256> fileName;
+
+ const CMdEObject& obj = query.Result(startIndex);
+ fileName = obj.Uri();
+
+ // Check that the file exists. If not, it is still OK, if it is
+ // on the memory card - it may show up later. Omit files from other
+ // drives that do not exist at the time of loading
+ // TODO: Can be removed, as slides are loaded on every start
+ TBool exists = BaflUtils::FileExists(iEikEnv->FsSession(), fileName);
+ TBool isOnMC = SlideshowUtil::IsOnMC(fileName);
+
+ if (!exists) // && (!isOnMC))
+ {
+ // Do not add nonexisting files from other than memory card
+ continue;
+ }
+#if 0
+ // Check that the file's DRM rights allow it to be displayed (if not
+ // missing because not on MMC
+ if (!SlideshowUtil::DRMCheck(fileName))
+ {
+ // No point in adding files that cannot be displayed anyway
+ continue;
+ }
+#endif
+ // Create a slide with the filename and store it in the model
+ TRAPD(err, AppendSlideToModelL( fileName, isOnMC ) );
+ if ( KErrNone != err )
+ {
+ // appending error, go on to append next slide
+ continue;
+ }
+ SSPLOGGER_WRITEF(_L("SSP: Slide %d added, file: %S"), count, &fileName);
+ count++;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSlideshowPlugin::AppendSlideToModelL
+// Add slide to model
+// -----------------------------------------------------------------------------
+void CSlideshowPlugin::AppendSlideToModelL(TDesC& aFileName, TBool aIsOnMC)
+ {
+ CSlideshowSlide* pSlide = CSlideshowSlide::NewL(aFileName, aIsOnMC);
+ CleanupStack::PushL(pSlide);
+ iModel->AppendSlideL(pSlide);
+ CleanupStack::Pop(pSlide);
+ }
// End Of file.
--- a/src/screensaverctrlmovingtext.cpp Tue May 11 16:14:23 2010 +0300
+++ b/src/screensaverctrlmovingtext.cpp Tue May 25 12:43:23 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-
+#ifdef USE_DATE_AND_TEXT
#include <e32def.h>
#include <eikdef.h>
@@ -587,4 +587,5 @@
initialRefreshRate, KRefreshRate );
}
+#endif //USE_DATE_AND_TEXT
// End of file.
--- a/src/screensaverctrlnone.cpp Tue May 11 16:14:23 2010 +0300
+++ b/src/screensaverctrlnone.cpp Tue May 25 12:43:23 2010 +0300
@@ -94,17 +94,21 @@
{
SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlNone::DrawObject start") );
SwitchDisplayState( KDisplayOff );
-
SwitchLights( ESSForceLightsOff );
+ DrawNow();
}
// -----------------------------------------------------------------------------
// CScreensaverCtrlNone::HandleResourceChange
// -----------------------------------------------------------------------------
//
-void CScreensaverCtrlNone::HandleResourceChange(TInt /*aType*/)
+void CScreensaverCtrlNone::HandleResourceChange(TInt aType)
{
- // Nothing to be implemented
+ if ( aType == KEikDynamicLayoutVariantSwitch )//&& iType != EDisplayNone)
+ {
+ // Screen layout has changed - resize
+ SetRect( iCoeEnv->ScreenDevice()->SizeInPixels() );
+ }
}
// -----------------------------------------------------------------------------
@@ -116,6 +120,23 @@
// Nothing to be implemented
}
+// ---------------------------------------------------------------------------
+// CScreensaverCtrlNone::Draw
+// ---------------------------------------------------------------------------
+//
+void CScreensaverCtrlNone::Draw( const TRect& aRect ) const
+ {
+ if ( !Model().ScreenSaverIsOn() && !Model().ScreenSaverIsPreviewing() )
+ {
+ return;
+ }
+
+ SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlNone::Draw, screensaver is on or previewing") );
+ CWindowGc& gc = SystemGc();
+ gc.SetBrushColor( KRgbBlack );
+ gc.Clear( aRect );
+ }
+
// -----------------------------------------------------------------------------
// CScreensaverCtrlNone::CScreensaverCtrlNone
// -----------------------------------------------------------------------------
@@ -130,6 +151,9 @@
//
void CScreensaverCtrlNone::ConstructL()
{
+ CreateWindowL();
+ SetRect( iCoeEnv->ScreenDevice()->SizeInPixels() );
+ ActivateL();
}
// -----------------------------------------------------------------------------
--- a/src/screensaverengine.cpp Tue May 11 16:14:23 2010 +0300
+++ b/src/screensaverengine.cpp Tue May 25 12:43:23 2010 +0300
@@ -37,7 +37,7 @@
const TInt KMinPluginSuspensionTime = 500000; // 0.5 sec
// Inactivity timeout in seconds when keys locked
-const TInt KTimeoutShort = 5;
+const TInt KTimeoutShort = 5000000;
const TInt KNoPreview = 0;
@@ -70,7 +70,6 @@
CScreensaverEngine::~CScreensaverEngine( )
{
StopActivityMonitoring( iActivityManagerScreensaver );
- StopActivityMonitoring( iActivityManagerScreensaverShort );
DisableSharedDataAndMonitor();
delete iIndicatorArray;
KillTimer( iPreviewTimer );
@@ -187,6 +186,11 @@
{
SCRLOGGER_WRITE("Stopping Screensaver");
+ if ( !iScreenSaverIsPreviewing && iSharedDataI->IsKeyguardOn() )
+ {
+ StartPauseTimer();
+ }
+
if( iScreenSaverIsOn )
{
// disconnect in StopScreenSaver, It makes sure other applications could
@@ -563,14 +567,6 @@
iActivityManagerScreensaver->Start( Timeout(),
TCallBack( HandleInactiveEventL,this ),
TCallBack( HandleActiveEventL, this ) );
-
- // Start monitoring activity for screensaver, short timeout
- iActivityManagerScreensaverShort
- = CUserActivityManager::NewL( CActive::EPriorityUserInput );
-
- iActivityManagerScreensaverShort->Start( KTimeoutShort,
- TCallBack( HandleInactiveEventShortL, this ),
- TCallBack( HandleActiveEventShortL, this ) );
}
// -----------------------------------------------------------------------------
@@ -663,6 +659,26 @@
KPreviewTimeout,KPreviewTimeout);
}
+// ----------------------------------------------------------------------------
+// CScreensaverEngine::StartPauseTimer
+// -----------------------------------------------------------------------------
+//
+void CScreensaverEngine::StartPauseTimer()
+ {
+ KillTimer( iPauseTimer );
+
+ TRAP_IGNORE( iPauseTimer = CPeriodic::NewL( CActive::EPriorityHigh ) );
+
+ if ( !iPauseTimer )
+ {
+ HandlePauseTimerExpiry( this );
+ return;
+ }
+
+ iPauseTimer->Start( KTimeoutShort, KTimeoutShort, TCallBack(
+ HandlePauseTimerExpiry, this ) );
+ }
+
// -----------------------------------------------------------------------------
// CScreensaverEngine::KillTimer
// Stops and deletes a timer
@@ -693,6 +709,24 @@
return KErrNone;
}
+// ---------------------------------------------------------------------------
+// CScreensaverEngine::HandlePauseTimerExpiry
+// ---------------------------------------------------------------------------
+//
+TInt CScreensaverEngine::HandlePauseTimerExpiry( TAny* aPtr )
+ {
+ CScreensaverEngine* _this= STATIC_CAST(CScreensaverEngine*, aPtr);
+ _this->KillTimer( _this->iPauseTimer );
+
+ if ( _this->iSharedDataI->IsKeyguardOn() )
+ {
+ SCRLOGGER_WRITE("HandleInactiveEventShortL() starting saver");
+ _this->StartScreenSaver( );
+ }
+
+ return KErrNone;
+ }
+
// -----------------------------------------------------------------------------
// CScreensaverEngine::HandleActiveEventL
// -----------------------------------------------------------------------------
@@ -724,34 +758,6 @@
}
// -----------------------------------------------------------------------------
-// CScreensaverEngine::HandleActiveEventShortL
-// -----------------------------------------------------------------------------
-//
-TInt CScreensaverEngine::HandleActiveEventShortL( TAny* aPtr )
- {
- SCRLOGGER_WRITE("HandleActiveEventShortL()");
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CScreensaverEngine::HandleInactiveEventShortL
-// -----------------------------------------------------------------------------
-//
-TInt CScreensaverEngine::HandleInactiveEventShortL( TAny* aPtr )
- {
- SCRLOGGER_WRITE("HandleInactiveEventShortL()");
- // Start, if keys are locked and short timeout in use
- CScreensaverEngine* _this= STATIC_CAST(CScreensaverEngine*, aPtr);
- if ( _this->iSharedDataI->IsKeyguardOn() )
- {
- SCRLOGGER_WRITE("HandleInactiveEventShortL() starting saver");
- _this->StartScreenSaver( );
- }
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
// CScreensaverEngine::HandleSuspendTimerExpiry
// -----------------------------------------------------------------------------
//
@@ -768,38 +774,6 @@
return KErrNone;
}
-// ---------------------------------------------------------------------------
-// CScreensaverEngine::HandleKeyguardStateChanged
-// ---------------------------------------------------------------------------
-//
-void CScreensaverEngine::HandleKeyguardStateChanged( TBool aEnabled )
- {
- if ( aEnabled )
- {
- StartScreenSaver();
- }
- else
- {
- StopScreenSaver();
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CScreensaverEngine::HandleActivateSSChanged( TBool aStart )
- {
- if ( aStart )
- {
- StartScreenSaver();
- }
- else
- {
- StopScreenSaver();
- }
- }
-
// -----------------------------------------------------------------------------
// CScreensaverEngine::View
// -----------------------------------------------------------------------------
--- a/src/screensavershareddatai.cpp Tue May 11 16:14:23 2010 +0300
+++ b/src/screensavershareddatai.cpp Tue May 25 12:43:23 2010 +0300
@@ -834,6 +834,9 @@
//
void CScreensaverSharedDataI::GetDefaultType()
{
+/*
+default type is hardcoded, so commented out below code.
+Remove the comment when default type is read from CenRep.
//Store the default screensaver for this device
TBuf<16> screensaverName;
@@ -854,8 +857,16 @@
iDefaultType = EDisplayTime;
}
}
+*/
+
+#ifdef USE_DATE_AND_TEXT
+ iDefaultType = EDisplayTime;
+#else
+ iDefaultType = EDisplayNone;
+#endif
- iDefaultType = EDisplayTime;
+
+
}
// -----------------------------------------------------------------------------
--- a/src/screensavershareddatamonitor.cpp Tue May 11 16:14:23 2010 +0300
+++ b/src/screensavershareddatamonitor.cpp Tue May 25 12:43:23 2010 +0300
@@ -25,6 +25,7 @@
#include <startupdomainpskeys.h> // kpsglobalsystemstate
#include <ScreensaverInternalPSKeys.h>
#include <UikonInternalPSKeys.h> // kuikmmcinserted
+#include <hwrmpowerstatesdkpskeys.h>
#ifdef RD_UI_TRANSITION_EFFECTS_PHASE2
#include <akntransitionutils.h>
@@ -68,6 +69,9 @@
DeleteSubscriber( iActivateSSSubscriber );
iActivateSSProperty.Close();
+
+ DeleteSubscriber( iChargerStateSubscriber );
+ iChargerStateProperty.Close();
}
// -----------------------------------------------------------------------------
@@ -138,8 +142,14 @@
iShuttingDownSubscriber->SubscribeL();
User::LeaveIfError( iActivateSSProperty.Attach( KPSUidScreenSaver, KScreenSaverActivate ) );
- iActivateSSSubscriber = new( ELeave ) CSubscriber( TCallBack( HandleActivateSSChanged, this ), iActivateSSProperty );
+ iActivateSSSubscriber = new( ELeave ) CSubscriber(
+ TCallBack( HandleActivateSSChanged, this ), iActivateSSProperty );
iActivateSSSubscriber->SubscribeL();
+
+ User::LeaveIfError( iChargerStateProperty.Attach( KPSUidHWRMPowerState, KHWRMChargingStatus ) );
+ iChargerStateSubscriber = new (ELeave) CSubscriber(
+ TCallBack( HandleChargerStateChanged, this ), iChargerStateProperty );
+ iChargerStateSubscriber->SubscribeL();
}
// -----------------------------------------------------------------------------
@@ -240,7 +250,21 @@
CScreensaverSharedDataMonitor* _this =
STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr);
- _this->Model().HandleKeyguardStateChanged( _this->iData->IsKeyguardOn() );
+ if ( _this->iData->IsKeyguardOn() )
+ {
+ // Keys locked - if screensaver is running, this was caused by
+ // automatic keyguard and screensaver should refresh the view
+ // to show the keylock indicator
+ if ( _this->Model().ScreenSaverIsOn() )
+ {
+ _this->View()->UpdateAndRefresh();
+ }
+ _this->Model().StartScreenSaver();
+ }
+ else
+ {
+ _this->Model().StopScreenSaver();
+ }
return KErrNone;
}
@@ -280,7 +304,10 @@
return KErrNone;
}
-
+// ---------------------------------------------------------------------------
+// CScreensaverSharedDataMonitor::HandleActivateSSChanged
+// ---------------------------------------------------------------------------
+//
TInt CScreensaverSharedDataMonitor::HandleActivateSSChanged( TAny* aPtr )
{
TInt activateState = -1;
@@ -291,13 +318,13 @@
{
// Enable SS
SCRLOGGER_WRITE("SharedDataMonitor: Activate SS");
- STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().HandleActivateSSChanged( ETrue );
+ STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StartScreenSaver();
}
else if ( !activateState )
{
// Disable SS
SCRLOGGER_WRITE("SharedDataMonitor: Stop SS");
- STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().HandleActivateSSChanged( EFalse );
+ STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StopScreenSaver();
}
else
{
@@ -306,5 +333,34 @@
return KErrNone;
}
+// ---------------------------------------------------------------------------
+// CScreensaverSharedDataMonitor::HandleChargerStateChanged
+// ---------------------------------------------------------------------------
+//
+TInt CScreensaverSharedDataMonitor::HandleChargerStateChanged( TAny* aPtr )
+ {
+ TInt state = -1;
+
+ RProperty::Get( KPSUidHWRMPowerState, KHWRMChargingStatus, state );
+
+ switch ( state )
+ {
+ case EChargingStatusError: // Some error has occurred when charger is connected or charging.
+ case EChargingStatusNotConnected: // Charger not connected/uninitialized
+ case EChargingStatusCharging: // Device is charging
+ {
+ User::ResetInactivityTime();
+ STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StopScreenSaver();
+ }
+ break;
+ case EChargingStatusChargingComplete: // Charging completed
+ case EChargingStatusNotCharging: // Charger is connected, device not charging
+ case EChargingStatusAlmostComplete: // Charging almost completed
+ case EChargingStatusChargingContinued: // Charging continued after brief interruption
+ default:
+ break;
+ }
+ return KErrNone;
+ }
// End of file
--- a/src/screensaverview.cpp Tue May 11 16:14:23 2010 +0300
+++ b/src/screensaverview.cpp Tue May 25 12:43:23 2010 +0300
@@ -103,14 +103,14 @@
}
break;
}
-
case EDisplayTime:
case EDisplayText:
+#ifdef USE_DATE_AND_TEXT
{
iControl = CScreensaverCtrlMovingText::NewL( aType );
break;
}
-
+#endif
case EDisplayNone:
{
iControl = CScreensaverCtrlNone::NewL();