diff -r e9eae96aa117 -r 4697dfb2d7ad messagingappbase/mce/src/mceiaupdateutils.cpp --- a/messagingappbase/mce/src/mceiaupdateutils.cpp Tue Jan 26 11:55:08 2010 +0200 +++ b/messagingappbase/mce/src/mceiaupdateutils.cpp Tue Feb 02 00:08:43 2010 +0200 @@ -24,7 +24,7 @@ #include // user include files go here: - +#include "mceui.h" #include "mceiaupdateutils.h" #include "MceLogText.h" @@ -34,9 +34,10 @@ // C++ default constructor. // --------------------------------------------------------------------------- // -CMceIAUpdateUtils::CMceIAUpdateUtils() -: iUpdate( NULL ), iParameters( NULL ) +CMceIAUpdateUtils::CMceIAUpdateUtils(CMceUi& aMceUi) +: iUpdate( NULL ), iParameters( NULL ),iMceUi( aMceUi ),CActive(EPriorityStandard) { + CActiveScheduler::Add(this); } @@ -61,9 +62,9 @@ // Two-phased constructor. // --------------------------------------------------------------------------- // -CMceIAUpdateUtils* CMceIAUpdateUtils::NewL() +CMceIAUpdateUtils* CMceIAUpdateUtils::NewL(CMceUi& aMceUi) { - CMceIAUpdateUtils* self = new( ELeave ) CMceIAUpdateUtils; + CMceIAUpdateUtils* self = new( ELeave ) CMceIAUpdateUtils(aMceUi); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); @@ -77,13 +78,14 @@ CMceIAUpdateUtils::~CMceIAUpdateUtils() { Delete(); + Cancel(); } // --------------------------------------------------------------------------- // Start IA update process. // --------------------------------------------------------------------------- // -void CMceIAUpdateUtils::StartL( const TUid aAppUid ) +void CMceIAUpdateUtils::DoStartL( const TUid aAppUid ) { if( iUpdate && iParameters ) { @@ -129,9 +131,16 @@ { if ( aAvailableUpdates > 0 ) { - // There were some updates available. - MCELOGGER_WRITE("CheckUpdatesComplete --- updates available"); - iUpdate->UpdateQuery(); + if((iMceUi.IsForeground())&&(iMceUi.MceViewActive(EMceMainViewActive))) + { + // There were some updates available. + MCELOGGER_WRITE("CheckUpdatesComplete --- updates available"); + iUpdate->UpdateQuery(); + } + else + { + MCELOGGER_WRITE("CheckUpdatesComplete --- But MessageView or Delivery Reports View is active"); + } } else { @@ -190,5 +199,49 @@ } } } +// ----------------------------------------------------------------------------- +// From class MIAUpdateObserver. +// This callback function is called when an update query operation has completed. +// ----------------------------------------------------------------------------- +// +void CMceIAUpdateUtils::StartL(const TUid aAppUid) + { + if (IsActive()) + { + return; + } + iAppUid = aAppUid; + CompleteSelf(); + } +// ----------------------------------------------------------------------------- +// +// For Setting the Active Object Active +// ----------------------------------------------------------------------------- +// +void CMceIAUpdateUtils::CompleteSelf() + { + iStatus = KRequestPending; + TRequestStatus* pStatus = &iStatus; + SetActive(); + User::RequestComplete( pStatus, KErrNone ); + } +// ----------------------------------------------------------------------------- +// From class CActive. +// For Starting the update in a seperate Thread +// ----------------------------------------------------------------------------- +// +void CMceIAUpdateUtils::RunL() + { + DoStartL( iAppUid ); + } +// ----------------------------------------------------------------------------- +// From class CActive. +// Nothing to do here +// ----------------------------------------------------------------------------- +// +void CMceIAUpdateUtils::DoCancel() + { + + } // EOF