uifw/AknGlobalUI/AknCapServer/src/aknphonekeyforwarder.cpp
changeset 0 2f259fa3e83a
child 26 62ef28f7b435
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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 #include <e32property.h>
       
    19 #include <e32std.h> // needed because activeidle2domainpskeys.h doesn't include this
       
    20 #include "AknCapServerEntry.h"
       
    21 #include <activeidle2domainpskeys.h> // yet another nasty dep
       
    22 
       
    23 #define KPhoneAppUid TUid::Uid(0x100058B3)
       
    24 
       
    25 TBool AknPhoneKeyForwarder::ForwardKeyToPhoneApp(TAny* aKeyEvent)
       
    26     {
       
    27     RProperty::Set(
       
    28         KPSUidAiInformation, 
       
    29         KActiveIdleState,
       
    30         EPSAiNumberEntry );
       
    31 
       
    32     RWsSession& ws = CCoeEnv::Static()->WsSession();
       
    33     TApaTaskList list(ws);
       
    34     TApaTask phone = list.FindApp(KPhoneAppUid);
       
    35     if (phone.Exists())
       
    36         { 
       
    37         TKeyEvent& key  = *(TKeyEvent*)aKeyEvent;
       
    38         
       
    39         // make sure that phone will receive focus before sending key to it
       
    40         ws.SetWindowGroupOrdinalPosition(phone.WgId(), 0);
       
    41         
       
    42         // send key event
       
    43         phone.SendKey(key);
       
    44 
       
    45         // and check if the up event has been delivered to us meanwhile
       
    46         if (STATIC_CAST(CAknCapAppServerAppUi*,CEikonEnv::Static()->AppUi())->iUpReceived)
       
    47             {
       
    48             TWsEvent event;
       
    49             event.SetType(EEventKeyUp);
       
    50             *event.Key()=key;
       
    51             event.SetTimeNow();
       
    52             ws.SendEventToWindowGroup(phone.WgId(), event);
       
    53             }
       
    54         }
       
    55 
       
    56     return EFalse; // don't retry
       
    57     }
       
    58 
       
    59 TBool AknPhoneKeyForwarder::ForwardUpEventToPhoneApp(TAny* aKeyEvent)
       
    60     {
       
    61     RWsSession& ws = CCoeEnv::Static()->WsSession();
       
    62     TApaTaskList list(ws);
       
    63     TApaTask phone = list.FindApp(KPhoneAppUid);
       
    64     if (phone.Exists())
       
    65         { 
       
    66         TWsEvent event;
       
    67         event.SetType(EEventKeyUp);
       
    68         *event.Key()=*(TKeyEvent*)aKeyEvent;
       
    69         event.SetTimeNow();
       
    70         ws.SendEventToWindowGroup(phone.WgId(), event);
       
    71         }
       
    72     
       
    73     return EFalse; // no need to re-run
       
    74     }
       
    75 
       
    76 // End of file