menucontentsrv/src/menunotifier.cpp
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     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:
       
    15 *
       
    16 */
       
    17 #include "mcsmenunotifier.h"
       
    18 #include "mcsmenu.h"
       
    19 #include "menumsg.h"
       
    20 
       
    21 NONSHARABLE_CLASS( RMenuNotifier::TData )
       
    22     {
       
    23     };
       
    24 
       
    25 // ================= MEMBER FUNCTIONS =======================
       
    26 
       
    27 // ---------------------------------------------------------
       
    28 // RMenuNotifier::Close
       
    29 // ---------------------------------------------------------
       
    30 //
       
    31 EXPORT_C void RMenuNotifier::Close()
       
    32     {
       
    33     if ( iData )
       
    34         {
       
    35         CloseSubSession( EMenuNotifierClose );
       
    36         delete iData; iData = NULL;
       
    37         }
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------
       
    41 // RMenuNotifier::Open
       
    42 // ---------------------------------------------------------
       
    43 //
       
    44 EXPORT_C TInt RMenuNotifier::Open( RMenu& aMenu )
       
    45     {
       
    46     __ASSERT_DEBUG( !iData, User::Invariant() );
       
    47     // Creation of local data and server object is atomic.
       
    48     TInt err = KErrNone;
       
    49     iData = new RMenuNotifier::TData();
       
    50     if ( iData )
       
    51         {
       
    52         err = CreateSubSession( aMenu, EMenuNotifierOpen );
       
    53         if ( err )
       
    54             {
       
    55             delete iData; iData = NULL;
       
    56             }
       
    57         }
       
    58     else
       
    59         {
       
    60         err = KErrNoMemory;
       
    61         }
       
    62     return err;
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------
       
    66 // RMenuNotifier::Notify
       
    67 // ---------------------------------------------------------
       
    68 //
       
    69 EXPORT_C void RMenuNotifier::Notify
       
    70 ( TInt aFolder, TInt aEvents, TRequestStatus& aStatus )
       
    71     {
       
    72     __ASSERT_DEBUG( iData, User::Invariant() );
       
    73     TIpcArgs args( aFolder, aEvents );
       
    74     SendReceive( EMenuNotifierNotify, args, aStatus );
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // RMenuNotifier::Cancel
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 EXPORT_C void RMenuNotifier::Cancel()
       
    82     {
       
    83     __ASSERT_DEBUG( iData, User::Invariant() );
       
    84     SendReceive( EMenuNotifierNotifyCancel );
       
    85     }