startupservices/Startup/src/StartupSubscriber.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2004 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:  CStartupSubscriber implementation.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include "StartupAppUi.h"
       
    21 #include "StartupSubscriber.h"
       
    22 #include "startup.hrh"
       
    23 #include <e32svr.h>
       
    24 
       
    25 // CONSTANTS
       
    26 
       
    27 // ============================= MEMBER FUNCTIONS =============================
       
    28 
       
    29 // ----------------------------------------------------------------------------
       
    30 // CStartupSubscriber::NewL()
       
    31 // ----------------------------------------------------------------------------
       
    32 CStartupSubscriber* CStartupSubscriber::NewL( 
       
    33                             MStartupPropertyResponder& aStartupPropertyResponder,
       
    34                             const TUid& aCategory, 
       
    35                             TUint aKey )
       
    36     {
       
    37     CStartupSubscriber* self = new (ELeave) CStartupSubscriber( aStartupPropertyResponder,
       
    38                                                                 aCategory, 
       
    39                                                                 aKey );
       
    40     CleanupStack::PushL( self );
       
    41     self->ConstructL();
       
    42     CleanupStack::Pop(); //self
       
    43     return self;
       
    44     }
       
    45 
       
    46 // ----------------------------------------------------------------------------
       
    47 // CStartupSubscriber::ConstructL()
       
    48 // ----------------------------------------------------------------------------
       
    49 void CStartupSubscriber::ConstructL()
       
    50     {
       
    51     CActiveScheduler::Add( this );
       
    52     iProperty.Attach( iCategory, iKey );
       
    53     }
       
    54 
       
    55 // ----------------------------------------------------------------------------
       
    56 // CStartupSubscriber::Subscribe()
       
    57 // ----------------------------------------------------------------------------
       
    58 void CStartupSubscriber::Subscribe()
       
    59     {
       
    60     iProperty.Subscribe( iStatus );
       
    61     SetActive();
       
    62     }
       
    63 
       
    64 // ----------------------------------------------------------------------------
       
    65 // CStartupSubscriber::CStartupSubscriber()
       
    66 // ----------------------------------------------------------------------------
       
    67 CStartupSubscriber::CStartupSubscriber( MStartupPropertyResponder& aStartupPropertyResponder, 
       
    68                                         const TUid& aCategory, 
       
    69                                         TUint aKey ) :
       
    70     CActive( EPriorityStandard ),
       
    71     iStartupPropertyResponder( aStartupPropertyResponder ),
       
    72     iCategory( aCategory),
       
    73     iKey( aKey )
       
    74     {
       
    75     }
       
    76 
       
    77 // ----------------------------------------------------------------------------
       
    78 // CStartupSubscriber::RunL()
       
    79 // ----------------------------------------------------------------------------
       
    80 void CStartupSubscriber::RunL()
       
    81     {
       
    82     Subscribe();
       
    83     iStartupPropertyResponder.HandlePropertyChangedL( iCategory, iKey );
       
    84     }
       
    85 
       
    86 // ----------------------------------------------------------------------------
       
    87 // CStartupSubscriber::DoCancel()
       
    88 // ----------------------------------------------------------------------------
       
    89 void CStartupSubscriber::DoCancel()
       
    90     {
       
    91     iProperty.Cancel();
       
    92     }
       
    93 
       
    94 // ----------------------------------------------------------------------------
       
    95 // CStartupSubscriber::RunError()
       
    96 // ----------------------------------------------------------------------------
       
    97 TInt CStartupSubscriber::RunError( TInt aError )
       
    98     {    
       
    99     return aError;
       
   100     }
       
   101 
       
   102 // ----------------------------------------------------------------------------
       
   103 // CStartupSubscriber::~CStartupSubscriber()
       
   104 // ----------------------------------------------------------------------------
       
   105 CStartupSubscriber::~CStartupSubscriber()
       
   106     {
       
   107     Cancel();
       
   108     iProperty.Close();
       
   109     }
       
   110 
       
   111 // End of File
       
   112 
       
   113 
       
   114