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