src/screensaversubscriber.cpp
branchRCL_3
changeset 26 e8d784ac1a4b
equal deleted inserted replaced
25:aaeeca1f15af 26:e8d784ac1a4b
       
     1 /*
       
     2 * Copyright (c) 2003 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:   Implementation of screensaver shared data Subscriber.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "screensaversubscriber.h"
       
    21 
       
    22 
       
    23 // -----------------------------------------------------------------------------
       
    24 // CSubscriber::CSubscriber
       
    25 // -----------------------------------------------------------------------------
       
    26 //
       
    27 CSubscriber::CSubscriber(TCallBack aCallBack, RProperty& aProperty)
       
    28     : CActive(EPriorityNormal), iCallBack(aCallBack), iProperty(aProperty)
       
    29     {
       
    30     CActiveScheduler::Add(this);
       
    31     }
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CSubscriber::~CSubscriber
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CSubscriber::~CSubscriber()
       
    38     {
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CSubscriber::SubscribeL
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 void CSubscriber::SubscribeL()
       
    46     {
       
    47     if (!IsActive())
       
    48         {
       
    49         iProperty.Subscribe(iStatus);
       
    50         SetActive();
       
    51         }
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CSubscriber::StopSubscribe
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 void CSubscriber::StopSubscribe()
       
    59     {
       
    60     Cancel();
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CSubscriber::RunL
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 void CSubscriber::RunL()
       
    68     {
       
    69     if (iStatus.Int() == KErrNone)
       
    70         {
       
    71         SubscribeL();
       
    72         iCallBack.CallBack();
       
    73         }
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CSubscriber::DoCancel
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 void CSubscriber::DoCancel()
       
    81     {
       
    82     iProperty.Cancel();
       
    83     }
       
    84 
       
    85 
       
    86 // End of file.