homescreensrv_plat/menu_content_service_api/tsrc/src/mcsrequestnotification.cpp
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "mcsdef.h"
       
    20 #include "mcsmenu.h"
       
    21 
       
    22 #include "mcsrequestnotification.h"
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // two-phased constructor
       
    26 // ---------------------------------------------------------------------------
       
    27 CMCSReqNotification* CMCSReqNotification::NewL( RMenu& aMCS )
       
    28     {
       
    29     CMCSReqNotification* self = new (ELeave) CMCSReqNotification();
       
    30     CleanupStack::PushL( self );
       
    31     self->ConstructL(aMCS);
       
    32     CleanupStack::Pop( self );
       
    33     return self;
       
    34     }
       
    35     
       
    36 // ---------------------------------------------------------------------------
       
    37 // destructor
       
    38 // ---------------------------------------------------------------------------
       
    39 CMCSReqNotification::~CMCSReqNotification()
       
    40     {
       
    41     Cancel();
       
    42     iNotifier.Close();
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // default constructor
       
    47 // ---------------------------------------------------------------------------
       
    48 CMCSReqNotification::CMCSReqNotification() : CActive( EPriorityStandard )
       
    49     {
       
    50     CActiveScheduler::Add ( this );
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // second phase constructor
       
    55 // ---------------------------------------------------------------------------
       
    56 void CMCSReqNotification::ConstructL( RMenu& aMCS)
       
    57     {
       
    58     iStat = -2;
       
    59     TInt err = KErrNone;
       
    60     err = iNotifier.Open(aMCS);
       
    61     iMCS = aMCS;
       
    62     if(err != KErrNone)
       
    63         {
       
    64         User::Leave( err );
       
    65         }
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // Inherited from CActive class 
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 void CMCSReqNotification::DoCancel()
       
    73     {
       
    74     iNotifier.Cancel();
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // Inherited from CActive class 
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 void CMCSReqNotification::RunL()
       
    82     {
       
    83     iStat = iStatus.Int();
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // Start event's notifications 
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CMCSReqNotification::StartNotificationL(TInt aFolderId, 
       
    91         TInt aEvent )
       
    92     {
       
    93     if(IsActive() )
       
    94       {
       
    95       User::Leave( KErrInUse );
       
    96       }
       
    97     iNotifier.Notify(aFolderId, aEvent, iStatus );
       
    98     SetActive();
       
    99     iStat = KErrNone;
       
   100     }
       
   101 
       
   102 // ---------------------------------------------------------------------------
       
   103 // Stop event's notifications 
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 TInt CMCSReqNotification::GetStatus()
       
   107 	{
       
   108 	return iStat;
       
   109 	}