menufw/hierarchynavigator/hnengine/src/hninstallnotifier.cpp
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Sis package installation event listener
       
    15 *
       
    16 */
       
    17  
       
    18 
       
    19 #include <sacls.h>
       
    20 #include "hninstallnotifier.h"
       
    21 
       
    22 // ============================ MEMBER FUNCTIONS =============================
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // CHnMulModelInstallNotifier::CHnMulModelInstallNotifier
       
    26 // C++ default constructor
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 CHnInstallNotifier::CHnInstallNotifier( 
       
    30                                     MHnInstallNotifierCallback* aCallback, 
       
    31                                     TUid aCategory, 
       
    32                                     TUint aKey ) : CActive( EPriorityNormal )
       
    33     {    
       
    34     CActiveScheduler::Add( this );
       
    35     
       
    36     iCallback = aCallback;
       
    37     iCategory = aCategory;
       
    38     iKey = aKey;
       
    39     // Prepare automatically
       
    40     TInt err = iProperty.Attach( iCategory, iKey );
       
    41     SetActive();
       
    42     iStatus = KRequestPending;
       
    43     iProperty.Subscribe( iStatus );
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CHnMulModelInstallNotifier::ConstructL
       
    48 // S2nd phase constructor.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 void CHnInstallNotifier::ConstructL()
       
    52     {
       
    53 
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CHnMulModelInstallNotifier::NewL
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 CHnInstallNotifier* CHnInstallNotifier::
       
    61                               NewL( MHnInstallNotifierCallback* aCallback,
       
    62                                     TUid aCategory, 
       
    63                                     TUint aKey  )
       
    64     {
       
    65     CHnInstallNotifier* self = 
       
    66                 new (ELeave) CHnInstallNotifier( aCallback,
       
    67                                                          aCategory,
       
    68                                                          aKey );
       
    69     CleanupStack::PushL( self );
       
    70     self->ConstructL();
       
    71     CleanupStack::Pop( self );
       
    72     
       
    73     return self;
       
    74     }
       
    75 
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // CHnMulModelInstallNotifier::~CHnMulModelInstallNotifier
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 CHnInstallNotifier::~CHnInstallNotifier()
       
    82     {
       
    83     Cancel();
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CHnMulModelInstallNotifier::DoCancel
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CHnInstallNotifier::DoCancel()
       
    91     {
       
    92     iProperty.Cancel();
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // CHnMulModelInstallNotifier::RunError
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 TInt CHnInstallNotifier::RunError( TInt /*aError*/ )
       
   100     {    
       
   101     // No need to do anything      
       
   102     return KErrNone;
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // CHnMulModelInstallNotifier::RunL
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 void CHnInstallNotifier::RunL()
       
   110     {
       
   111     // Re-issue request before notifying
       
   112     SetActive();
       
   113     iStatus = KRequestPending;
       
   114     iProperty.Subscribe( iStatus );
       
   115     
       
   116     TInt status;
       
   117     User::LeaveIfError( iProperty.Get( KUidSystemCategory, 
       
   118                                       KSAUidSoftwareInstallKeyValue,status ));
       
   119 
       
   120     iCallback->InstallChangeL( status );
       
   121     }
       
   122 // End of File