idlehomescreen/hscontentcontrol/src/hscontentcontroluninstallmonitor.cpp
branchRCL_3
changeset 20 899e4666ea9a
parent 16 1526727a5b85
parent 19 79311d856354
child 21 45cc9ca502a9
equal deleted inserted replaced
16:1526727a5b85 20:899e4666ea9a
     1 /*
       
     2 * Copyright (c) 2009 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:   Class to listen SWI uninstall operation.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "hscontentcontroluninstallmonitor.h"
       
    19 #include <SWInstallerInternalPSKeys.h>
       
    20 
       
    21 // ======== MEMBER FUNCTIONS ========
       
    22 
       
    23 // ---------------------------------------------------------------------------
       
    24 // CHsContentControlUninstallMonitor::NewL()
       
    25 // ---------------------------------------------------------------------------
       
    26 //
       
    27 CHsContentControlUninstallMonitor* CHsContentControlUninstallMonitor::NewL( 
       
    28         MHsContentControlUninstallObserver& aObs )
       
    29     {
       
    30     CHsContentControlUninstallMonitor* self = 
       
    31         new ( ELeave ) CHsContentControlUninstallMonitor( aObs );
       
    32     CleanupStack::PushL( self );
       
    33     self->ConstructL();
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // CHsContentControlUninstallMonitor::~CHsContentControlUninstallMonitor()
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 CHsContentControlUninstallMonitor::~CHsContentControlUninstallMonitor()
       
    43     {
       
    44     Cancel();
       
    45     iSwUninstallKey.Close();
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CHsContentControlUninstallMonitor::DoCancel()
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 void CHsContentControlUninstallMonitor::DoCancel()
       
    53     {
       
    54     if ( IsActive() )
       
    55         {
       
    56         iSwUninstallKey.Cancel();
       
    57         }
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // CHsContentControlUninstallMonitor::RunL()
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 void CHsContentControlUninstallMonitor::RunL()
       
    65     {
       
    66     iSwUninstallKey.Subscribe( iStatus );
       
    67     SetActive();
       
    68     
       
    69     TInt value = 0;
       
    70     if( iSwUninstallKey.Get( value ) == KErrNone )
       
    71         {
       
    72         TUid uid( KNullUid );
       
    73         uid.iUid = value;
       
    74         iObs.HandleUninstallEvent( uid );
       
    75         }
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CHsContentControlUninstallMonitor::CHsContentControlUninstallMonitor()
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 CHsContentControlUninstallMonitor::CHsContentControlUninstallMonitor( 
       
    83     MHsContentControlUninstallObserver& aObs )
       
    84     : CActive( CActive::EPriorityStandard ),
       
    85     iObs( aObs )
       
    86     {
       
    87     CActiveScheduler::Add( this );
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // CHsContentControlUninstallMonitor::ConstructL()
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 void CHsContentControlUninstallMonitor::ConstructL()
       
    95     {
       
    96     if ( KErrNone == iSwUninstallKey.Attach( 
       
    97         KPSUidSWInstallerUiNotification, KSWInstallerUninstallation ) )
       
    98         {
       
    99         iSwUninstallKey.Subscribe( iStatus );
       
   100         SetActive();
       
   101         }
       
   102     }
       
   103 
       
   104 // End of file