appinstaller/AppMngr2/src/appmngr2appinfomaker.cpp
changeset 80 9dcba1ee99f7
parent 77 d1838696558c
equal deleted inserted replaced
77:d1838696558c 80:9dcba1ee99f7
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Creates AppInfo objects asynchronously
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "appmngr2appinfomaker.h"       // CAppMngr2AppInfoMaker
       
    20 #include "appmngr2infomakerobserver.h"  // MAppMngr2InfoMakerObserver
       
    21 #include <appmngr2runtime.h>            // CAppMngr2Runtime
       
    22 #include <appmngr2appinfo.h>            // CAppMngr2AppInfo
       
    23 #include <appmngr2debugutils.h>         // FLOG macros
       
    24 
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CAppMngr2AppInfoMaker::NewL()
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CAppMngr2AppInfoMaker* CAppMngr2AppInfoMaker::NewL( CAppMngr2Runtime& aPlugin,
       
    33         MAppMngr2InfoMakerObserver& aObserver, RFs& aFs )
       
    34     {
       
    35     CAppMngr2AppInfoMaker* self = CAppMngr2AppInfoMaker::NewLC( aPlugin,
       
    36             aObserver, aFs );
       
    37     CleanupStack::Pop( self );
       
    38     return self;
       
    39     }
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // CAppMngr2AppInfoMaker::NewLC()
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 CAppMngr2AppInfoMaker* CAppMngr2AppInfoMaker::NewLC( CAppMngr2Runtime& aPlugin,
       
    46         MAppMngr2InfoMakerObserver& aObserver, RFs& aFs )
       
    47     {
       
    48     CAppMngr2AppInfoMaker* self = new (ELeave) CAppMngr2AppInfoMaker( aPlugin,
       
    49             aObserver, aFs );
       
    50     CleanupStack::PushL( self );
       
    51     self->ConstructL();
       
    52     return self;
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // CAppMngr2AppInfoMaker::~CAppMngr2AppInfoMaker()
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CAppMngr2AppInfoMaker::~CAppMngr2AppInfoMaker()
       
    60     {
       
    61     Cancel();
       
    62     iAppInfos.ResetAndDestroy();
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CAppMngr2AppInfoMaker::DoCancel()
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 void CAppMngr2AppInfoMaker::DoCancel()
       
    70     {
       
    71     iPlugin.CancelGetInstalledApps();
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CAppMngr2AppInfoMaker::RunL()
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 void CAppMngr2AppInfoMaker::RunL()
       
    79     {
       
    80     if( iStatus.Int() == KErrNone )
       
    81         {
       
    82         iObserver.NewAppsCreatedL( *this, iAppInfos );
       
    83         }
       
    84     else
       
    85         {
       
    86         iObserver.ErrorInCreatingAppsL( *this, iStatus.Int() );
       
    87         }
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // CAppMngr2AppInfoMaker::StartGettingInstalledAppsL()
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 void CAppMngr2AppInfoMaker::StartGettingInstalledAppsL()
       
    95     {
       
    96     if( !IsActive() )
       
    97         {
       
    98         TRAPD( err, iPlugin.GetInstalledAppsL( iAppInfos, iFs, iStatus ) );
       
    99         SetActive();
       
   100         
       
   101         // Complete immediately if there was some error
       
   102         if( err != KErrNone )
       
   103             {
       
   104             TRequestStatus* status = &iStatus;
       
   105             User::RequestComplete( status, err );
       
   106             }
       
   107         }
       
   108     }
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // CAppMngr2AppInfoMaker::CAppMngr2AppInfoMaker()
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 CAppMngr2AppInfoMaker::CAppMngr2AppInfoMaker( CAppMngr2Runtime& aPlugin,
       
   115         MAppMngr2InfoMakerObserver& aObserver, RFs& aFs ) :
       
   116         CAppMngr2InfoMaker( aPlugin , aObserver, aFs )
       
   117     {
       
   118     }
       
   119 
       
   120 // ---------------------------------------------------------------------------
       
   121 // CAppMngr2AppInfoMaker::ConstructL()
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 void CAppMngr2AppInfoMaker::ConstructL()
       
   125     {
       
   126     }
       
   127