messagingappbase/mce/src/mceiaupdateutils.cpp
changeset 5 4697dfb2d7ad
parent 0 72b543305e3a
child 12 caea42e26caa
equal deleted inserted replaced
4:e9eae96aa117 5:4697dfb2d7ad
    22 #include <iaupdateparameters.h>
    22 #include <iaupdateparameters.h>
    23 #include <iaupdateresult.h>
    23 #include <iaupdateresult.h>
    24 #include <featmgr.h>
    24 #include <featmgr.h>
    25 
    25 
    26 // user include files go here:
    26 // user include files go here:
    27 
    27 #include "mceui.h"
    28 #include "mceiaupdateutils.h"
    28 #include "mceiaupdateutils.h"
    29 #include "MceLogText.h"
    29 #include "MceLogText.h"
    30 
    30 
    31 // ======== MEMBER FUNCTIONS ========
    31 // ======== MEMBER FUNCTIONS ========
    32 
    32 
    33 // ---------------------------------------------------------------------------
    33 // ---------------------------------------------------------------------------
    34 // C++ default constructor.
    34 // C++ default constructor.
    35 // ---------------------------------------------------------------------------
    35 // ---------------------------------------------------------------------------
    36 //
    36 //
    37 CMceIAUpdateUtils::CMceIAUpdateUtils()
    37 CMceIAUpdateUtils::CMceIAUpdateUtils(CMceUi& aMceUi)
    38 : iUpdate( NULL ), iParameters( NULL )
    38 : iUpdate( NULL ), iParameters( NULL ),iMceUi( aMceUi ),CActive(EPriorityStandard)
    39     {
    39     {
       
    40     CActiveScheduler::Add(this);
    40     }
    41     }
    41 
    42 
    42 
    43 
    43 // ---------------------------------------------------------------------------
    44 // ---------------------------------------------------------------------------
    44 // Symbian 2nd phase constructor.
    45 // Symbian 2nd phase constructor.
    59 
    60 
    60 // ---------------------------------------------------------------------------
    61 // ---------------------------------------------------------------------------
    61 // Two-phased constructor.
    62 // Two-phased constructor.
    62 // ---------------------------------------------------------------------------
    63 // ---------------------------------------------------------------------------
    63 //
    64 //
    64 CMceIAUpdateUtils* CMceIAUpdateUtils::NewL()
    65 CMceIAUpdateUtils* CMceIAUpdateUtils::NewL(CMceUi& aMceUi)
    65     {
    66     {
    66     CMceIAUpdateUtils* self = new( ELeave ) CMceIAUpdateUtils;
    67     CMceIAUpdateUtils* self = new( ELeave ) CMceIAUpdateUtils(aMceUi);
    67     CleanupStack::PushL( self );
    68     CleanupStack::PushL( self );
    68     self->ConstructL();
    69     self->ConstructL();
    69     CleanupStack::Pop( self );
    70     CleanupStack::Pop( self );
    70     return self;
    71     return self;
    71     }
    72     }
    75 // ---------------------------------------------------------------------------
    76 // ---------------------------------------------------------------------------
    76 //
    77 //
    77 CMceIAUpdateUtils::~CMceIAUpdateUtils()
    78 CMceIAUpdateUtils::~CMceIAUpdateUtils()
    78     {
    79     {
    79     Delete();
    80     Delete();
       
    81     Cancel();
    80     }
    82     }
    81 
    83 
    82 // ---------------------------------------------------------------------------
    84 // ---------------------------------------------------------------------------
    83 // Start IA update process.
    85 // Start IA update process.
    84 // ---------------------------------------------------------------------------
    86 // ---------------------------------------------------------------------------
    85 //
    87 //
    86 void CMceIAUpdateUtils::StartL( const TUid aAppUid )
    88 void CMceIAUpdateUtils::DoStartL( const TUid aAppUid )
    87     {
    89     {
    88     if( iUpdate && iParameters )
    90     if( iUpdate && iParameters )
    89         {
    91         {
    90         iParameters->SetUid( aAppUid );
    92         iParameters->SetUid( aAppUid );
    91 
    93 
   127     {
   129     {
   128     if ( aErrorCode == KErrNone )
   130     if ( aErrorCode == KErrNone )
   129         {
   131         {
   130         if ( aAvailableUpdates > 0 )
   132         if ( aAvailableUpdates > 0 )
   131             {
   133             {
   132             // There were some updates available.
   134                 if((iMceUi.IsForeground())&&(iMceUi.MceViewActive(EMceMainViewActive)))
   133             MCELOGGER_WRITE("CheckUpdatesComplete --- updates available");
   135                     {
   134             iUpdate->UpdateQuery();
   136                     // There were some updates available.
       
   137                     MCELOGGER_WRITE("CheckUpdatesComplete --- updates available");
       
   138                     iUpdate->UpdateQuery();
       
   139                     }
       
   140                 else
       
   141                     {
       
   142                     MCELOGGER_WRITE("CheckUpdatesComplete --- But MessageView or Delivery Reports View is active");
       
   143                     }
   135             }
   144             }
   136         else
   145         else
   137             {
   146             {
   138             // No updates available.
   147             // No updates available.
   139             MCELOGGER_WRITE("CheckUpdatesComplete --- no updates available");
   148             MCELOGGER_WRITE("CheckUpdatesComplete --- no updates available");
   188             // The answer was 'Later'.
   197             // The answer was 'Later'.
   189             MCELOGGER_WRITE("UpdateQueryComplete --- later");
   198             MCELOGGER_WRITE("UpdateQueryComplete --- later");
   190             }
   199             }
   191         }
   200         }
   192     }
   201     }
       
   202 // -----------------------------------------------------------------------------
       
   203 // From class MIAUpdateObserver.
       
   204 // This callback function is called when an update query operation has completed.
       
   205 // -----------------------------------------------------------------------------
       
   206 //
       
   207 void CMceIAUpdateUtils::StartL(const TUid aAppUid)
       
   208     {
       
   209     if (IsActive())
       
   210         {
       
   211             return;
       
   212          }
       
   213     iAppUid = aAppUid;
       
   214     CompleteSelf();
       
   215     }
       
   216 // -----------------------------------------------------------------------------
       
   217 // 
       
   218 // For Setting the Active Object Active
       
   219 // -----------------------------------------------------------------------------
       
   220 //
       
   221 void CMceIAUpdateUtils::CompleteSelf()
       
   222     {
       
   223     iStatus = KRequestPending;
       
   224     TRequestStatus* pStatus = &iStatus;
       
   225     SetActive();
       
   226     User::RequestComplete( pStatus, KErrNone );
       
   227     }
       
   228 // -----------------------------------------------------------------------------
       
   229 // From class CActive.
       
   230 // For Starting the update in a seperate Thread
       
   231 // -----------------------------------------------------------------------------
       
   232 //
       
   233 void CMceIAUpdateUtils::RunL()
       
   234     {
       
   235     DoStartL( iAppUid );
       
   236     }
       
   237 // -----------------------------------------------------------------------------
       
   238 // From class CActive.
       
   239 // Nothing to do here
       
   240 // -----------------------------------------------------------------------------
       
   241 //
       
   242 void CMceIAUpdateUtils::DoCancel()
       
   243     {
       
   244     
       
   245     }
   193 
   246 
   194 // EOF
   247 // EOF