satengine/SatServer/SatInternalClient/src/CSatCActiveCommandHandler.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-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:  This is the handler for the SIM Application Toolkit
       
    15 *                active commands.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include    <e32base.h>
       
    23 #include    <e32svr.h>
       
    24 #include    "RSatUiSession.h"
       
    25 #include    "MSatUiAdapter.h"
       
    26 #include    "CSatCActiveCommandHandler.h"
       
    27 #include    "CSatCCommandProcessor.h"
       
    28 #include    "SatSOpcodes.h"
       
    29 #include    "SatLog.h"
       
    30 
       
    31 // ============================ MEMBER FUNCTIONS ===============================
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CSatCActiveCommandHandler::CSatCActiveCommandHandler
       
    35 // C++ default constructor can NOT contain any code, that
       
    36 // might leave.
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 CSatCActiveCommandHandler::CSatCActiveCommandHandler(
       
    40     RSatUiSession* aSession ) :
       
    41     iSession( aSession ),
       
    42     iMenuSelectionData(),
       
    43     iMenuSelectionPckg( iMenuSelectionData )
       
    44     {
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CSatCActiveCommandHandler::NewL
       
    49 // Two-phased constructor.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CSatCActiveCommandHandler* CSatCActiveCommandHandler::NewL(
       
    53     RSatUiSession* aSat )
       
    54     {
       
    55     LOG( SIMPLE, "SATINTERNALCLIENT: CSatCActiveCommandHandler::NewL calling" )
       
    56 
       
    57     // Perform construction
       
    58     CSatCActiveCommandHandler* self =
       
    59         new ( ELeave ) CSatCActiveCommandHandler( aSat );
       
    60 
       
    61     LOG( SIMPLE, "SATINTERNALCLIENT: CSatCActiveCommandHandler::NewL exiting" )
       
    62     return self;
       
    63     }
       
    64 
       
    65 // Destructor
       
    66 CSatCActiveCommandHandler::~CSatCActiveCommandHandler()
       
    67     {
       
    68     LOG( SIMPLE, 
       
    69     "SATINTERNALCLIENT: CSatCActiveCommandHandler::~CSatCActiveCommandHandler calling" )
       
    70     iSession = NULL;
       
    71     LOG( SIMPLE, 
       
    72     "SATINTERNALCLIENT: CSatCActiveCommandHandler::~CSatCActiveCommandHandler exiting" )
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CSatCActiveCommandHandler::MenuSelection
       
    77 // Sends the Menu Selection Active command
       
    78 // (other items were commented in a header).
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void CSatCActiveCommandHandler::MenuSelection(
       
    82     TInt aMenuItem,
       
    83     TBool aHelpRequested )
       
    84     {
       
    85     LOG( SIMPLE,
       
    86         "SATINTERNALCLIENT: CSatCActiveCommandHandler::MenuSelection calling" )
       
    87 
       
    88     // Empty the IPC data
       
    89     RSat::TMenuSelectionV1 menuSelection;
       
    90     iMenuSelectionData = menuSelection;
       
    91 
       
    92     // Map the index into correct item ID.
       
    93     RSat::TItem item;
       
    94     iSession->CommandProcessor()->SetUpMenuHandler()->
       
    95         OldSetUpMenuData().GetItem( static_cast<TUint>( aMenuItem + 1 ), item );
       
    96 
       
    97     // Set the item ID of the selected item.
       
    98     iMenuSelectionData.iItemId = item.iItemId;
       
    99 
       
   100     // Set the help request identifier.
       
   101     iMenuSelectionData.iHelp = RSat::EHelpNotRequested;
       
   102     if ( aHelpRequested )
       
   103         {
       
   104         LOG( SIMPLE,
       
   105         "SATINTERNALCLIENT: CSatCActiveCommandHandler::MenuSelection aHelpRequested" )
       
   106         iMenuSelectionData.iHelp = RSat::EHelpRequested;
       
   107         }
       
   108 
       
   109     // Perform a synchronous service request.
       
   110     TIpcArgs arguments( &iMenuSelectionPckg );
       
   111     iSession->CreateRequest( ESatSActiveMenuSelection, arguments );
       
   112 
       
   113     LOG( SIMPLE,
       
   114         "SATINTERNALCLIENT: CSatCActiveCommandHandler::MenuSelection exiting" )
       
   115     }
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // CSatCActiveCommandHandler::SessionTerminated
       
   119 // Sends the Session Terminated Active command
       
   120 // (other items were commented in a header).
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 void CSatCActiveCommandHandler::SessionTerminated( TInt8 aType )
       
   124     {
       
   125     LOG( SIMPLE,
       
   126         "SATINTERNALCLIENT: CSatCActiveCommandHandler::SessionTerminated calling" )
       
   127     TSatTermination termination;
       
   128     //lint -e{603} termination used through terminationPckg.
       
   129     TSatTerminationPckg terminationPckg ( termination );
       
   130 
       
   131     switch ( aType )
       
   132         {
       
   133         case ESessionCancel:
       
   134             {
       
   135             termination.type = ETerminatedByCancel;
       
   136             TIpcArgs arguments( &terminationPckg );
       
   137             iSession->CreateRequest( ESatSSessionTerminated, arguments );
       
   138             LOG( SIMPLE, "SATINTERNALCLIENT:   Terminated by cancel" )
       
   139             break;
       
   140             }
       
   141 
       
   142         case EEndKeyUsed:
       
   143             {
       
   144             termination.type = ETerminatedByEndKey;
       
   145             TIpcArgs arguments( &terminationPckg );
       
   146             iSession->CreateRequest( ESatSSessionTerminated, arguments );
       
   147             LOG( SIMPLE, "SATINTERNALCLIENT:   Terminated by end key" )
       
   148             break;
       
   149             }
       
   150 
       
   151         default:
       
   152             {
       
   153             LOG( SIMPLE, "SATINTERNALCLIENT:   Not terminated" )
       
   154             break;
       
   155             }
       
   156         }
       
   157 
       
   158     LOG( SIMPLE,
       
   159         "SATINTERNALCLIENT: CSatCActiveCommandHandler::SessionTerminated exiting" )
       
   160     }
       
   161 
       
   162 //  End of File