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