idlehomescreen/xmluirendering/renderingplugins/xnanimationfactory/src/xnanimationadapter.cpp
--- a/idlehomescreen/xmluirendering/renderingplugins/xnanimationfactory/src/xnanimationadapter.cpp Tue Jan 26 11:48:23 2010 +0200
+++ b/idlehomescreen/xmluirendering/renderingplugins/xnanimationfactory/src/xnanimationadapter.cpp Tue Feb 02 00:04:13 2010 +0200
@@ -25,7 +25,6 @@
#include "xnanimationadapter.h"
-const TInt KPeriodicTimerInterval5Sec(100000); // 0.1 sec
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
@@ -53,7 +52,6 @@
{
CXnControlAdapter::ConstructL( aNode );
iSkinId = KAknsIIDNone;
- iAnimationSarted = EFalse;
}
// -----------------------------------------------------------------------------
@@ -72,12 +70,7 @@
//
CXnAnimationAdapter::~CXnAnimationAdapter()
{
- if (iPeriodicTimer)
- {
- iPeriodicTimer->Cancel();
- delete iPeriodicTimer;
- iPeriodicTimer = NULL;
- }
+ StopAnimation();
}
@@ -108,12 +101,10 @@
if( display == XnPropertyNames::style::common::display::KBlock )
{
- iDisplay = ETrue;
StartAnimation();
}
else
{
- iDisplay = EFalse;
StopAnimation();
}
}
@@ -126,7 +117,12 @@
//
void CXnAnimationAdapter::MakeVisible( TBool aVisible )
{
- if( aVisible )
+ TBool visible( IsVisible() ? ETrue : EFalse );
+ if ( visible == aVisible ) { return; }
+
+ CCoeControl::MakeVisible( aVisible );
+
+ if ( aVisible )
{
StartAnimation();
}
@@ -134,7 +130,6 @@
{
StopAnimation();
}
- CCoeControl::MakeVisible( aVisible );
}
// -----------------------------------------------------------------------------
@@ -143,9 +138,9 @@
//
void CXnAnimationAdapter::Update()
{
- if (iAnimationSarted )
+ if ( iPeriodicTimer && iPeriodicTimer->IsActive() )
{
- switch(iSkinId.iMinor )
+ switch( iSkinId.iMinor )
{
case EAknsMinorGenericQgnHomeRefreshing1:
{
@@ -183,7 +178,7 @@
{
CXnAnimationAdapter* self = static_cast<CXnAnimationAdapter*> (aAny);
- // Update widget every 5 seconds
+ // Update widget
self->Update();
return KErrNone; // Return value ignored by CPeriodic
@@ -195,15 +190,15 @@
//
void CXnAnimationAdapter::StartAnimation()
{
- if ( !iAnimationSarted && iDisplay )
+ if ( !iPeriodicTimer && IsVisible() )
{
TRAPD(err, iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityIdle) );
if ( err == KErrNone )
{
- iPeriodicTimer->Start( KPeriodicTimerInterval5Sec,
- KPeriodicTimerInterval5Sec, TCallBack( TimerCallBack, this ) );
+ const TInt KPeriodicTimerInterval = 100000; // 0.1 sec
+ iPeriodicTimer->Start( KPeriodicTimerInterval,
+ KPeriodicTimerInterval, TCallBack( TimerCallBack, this ) );
iSkinId = KAknsIIDQgnHomeRefreshing1;
- iAnimationSarted = ETrue;
}
}
}
@@ -214,14 +209,13 @@
//
void CXnAnimationAdapter::StopAnimation()
{
- if ( iAnimationSarted )
+ if ( iPeriodicTimer && iPeriodicTimer->IsActive() )
{
iPeriodicTimer->Cancel();
- delete iPeriodicTimer;
- iPeriodicTimer = NULL;
- iSkinId = KAknsIIDNone;
- iAnimationSarted = EFalse;
}
+ delete iPeriodicTimer;
+ iPeriodicTimer = NULL;
+ iSkinId = KAknsIIDNone;
}
// End of File