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