coreapplicationuis/NspsWsPlugin/src/NspsWsPlugin.cpp
changeset 0 2e3d3ce01487
child 21 c4cbaa4fb734
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     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:  CNspsWsPlugin method definitions
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32property.h>
       
    21 #include "CoreApplicationUIsInternalPSKeys.h"
       
    22 #include "NspsWsPluginDllStd.h"
       
    23 #include "NspsWsPlugin.h"         // this
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CNspsWsPlugin::CNspsWsPlugin()
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 
       
    33 CNspsWsPlugin::CNspsWsPlugin()
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CNspsWsPlugin::~CNspsWsPlugin()
       
    39 // -----------------------------------------------------------------------------
       
    40 
       
    41 CNspsWsPlugin::~CNspsWsPlugin()
       
    42     {
       
    43     if ( iFunctions )
       
    44         {
       
    45         iFunctions->GetRawEvents( EFalse );
       
    46         }
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CNspsWsPlugin::CommandReplyL( TInt /*aOpcode*/, TAny* /*aArgs*/ )
       
    51 // -----------------------------------------------------------------------------
       
    52 
       
    53 TInt CNspsWsPlugin::CommandReplyL( TInt /*aOpcode*/, TAny* /*aArgs*/ )
       
    54     {
       
    55     return KErrNone;
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CNspsWsPlugin::Command( TInt aOpcode, TAny* /*aArgs*/ )
       
    60 // -----------------------------------------------------------------------------
       
    61 
       
    62 void CNspsWsPlugin::Command( TInt aOpcode, TAny* /*aArgs*/ )
       
    63     {
       
    64     TRACES( RDebug::Print(_L("CNspsWsPlugin::Command( aOpcode:%d"), aOpcode) );
       
    65     switch ( aOpcode )
       
    66         {
       
    67         case EActivateNspsKeyeventForwarding:
       
    68             if( !iForwardRawKeyeventsToLights && !iForwardRawKeyeventsToNcn && !iForwardRawKeyeventsToSysAp )
       
    69                 {
       
    70                 iFunctions->GetRawEvents( ETrue );
       
    71                 }
       
    72             iForwardRawKeyeventsToSysAp = ETrue;
       
    73             break;
       
    74         case EDeActivateNspsKeyeventForwarding:
       
    75             if( ! ( iForwardRawKeyeventsToNcn || iForwardRawKeyeventsToLights ) )
       
    76                 {
       
    77                 iFunctions->GetRawEvents( EFalse );
       
    78                 }
       
    79             iForwardRawKeyeventsToSysAp = EFalse;
       
    80             break;
       
    81         
       
    82         case EActivateKeyeventForwardingForNcn:
       
    83             if( !iForwardRawKeyeventsToLights && !iForwardRawKeyeventsToNcn && !iForwardRawKeyeventsToSysAp )
       
    84                 {
       
    85                 iFunctions->GetRawEvents( ETrue );
       
    86                 }
       
    87             iForwardRawKeyeventsToNcn = ETrue;
       
    88             break;
       
    89         case EDeActivateKeyeventForwardingForNcn:
       
    90             if( !( iForwardRawKeyeventsToSysAp || iForwardRawKeyeventsToLights ) )
       
    91                 {
       
    92                 iFunctions->GetRawEvents( EFalse );
       
    93                 }
       
    94             iForwardRawKeyeventsToNcn = EFalse;
       
    95             break;
       
    96             
       
    97         case EActivateKeyeventForwardingForLights:
       
    98             if( !iForwardRawKeyeventsToLights && !iForwardRawKeyeventsToNcn && !iForwardRawKeyeventsToSysAp )
       
    99                 {
       
   100                 iFunctions->GetRawEvents( ETrue );
       
   101                 }
       
   102             iForwardRawKeyeventsToLights = ETrue;
       
   103             break;
       
   104         case EDeActivateKeyeventForwardingForLights:
       
   105             if( !( iForwardRawKeyeventsToSysAp || iForwardRawKeyeventsToNcn ) )
       
   106                 {
       
   107                 iFunctions->GetRawEvents( EFalse );
       
   108                 }
       
   109             iForwardRawKeyeventsToLights = EFalse;
       
   110             break;
       
   111             
       
   112         default:
       
   113             // do nothing
       
   114             break;
       
   115         }
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CNspsWsPlugin::Animate( TDateTime* /*aDateTime*/ )
       
   120 // -----------------------------------------------------------------------------
       
   121 
       
   122 void CNspsWsPlugin::Animate( TDateTime* /*aDateTime*/ )
       
   123     {
       
   124     }
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CNspsWsPlugin::ConstructL( TAny* /*aArgs*/, TBool /*aHasFocus*/ )
       
   128 // -----------------------------------------------------------------------------
       
   129 
       
   130 void CNspsWsPlugin::ConstructL( TAny* /*aArgs*/, TBool /*aHasFocus*/ )
       
   131     {
       
   132     TRACES( RDebug::Print( _L( "CNspsWsPlugin::ConstructL" ) ) );
       
   133     }
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 // CNspsWsPlugin::Redraw()
       
   137 // -----------------------------------------------------------------------------
       
   138 
       
   139 void CNspsWsPlugin::Redraw()
       
   140     {
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CNspsWsPlugin::FocusChanged( TBool /*aState*/ )
       
   145 // -----------------------------------------------------------------------------
       
   146 
       
   147 void CNspsWsPlugin::FocusChanged( TBool /*aState*/ )
       
   148     {
       
   149     }
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // CSysApAppUi::CNspsWsPlugin::OfferRawEvent( const TRawEvent& aRawEvent )
       
   153 // -----------------------------------------------------------------------------
       
   154 
       
   155 TBool CNspsWsPlugin::OfferRawEvent( const TRawEvent& aRawEvent )
       
   156     {
       
   157     if ( aRawEvent.Type() == TRawEvent::EKeyDown )
       
   158         {
       
   159         TRACES( RDebug::Print( _L( "CNspsWsPlugin::OfferRawEvent:TRawEvent::EKeyDown" ) ) );
       
   160 
       
   161         if ( iForwardRawKeyeventsToLights )
       
   162             {
       
   163             TRACES( RDebug::Print(_L("CNspsWsPlugin::OfferRawEvent:TRawEvent::EKeyDown, Forwarded to Lights Controller" ) ) );
       
   164             RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsLightsRawKeyEvent, ECoreAppUIsKeyEvent );
       
   165             }
       
   166 
       
   167         if ( iForwardRawKeyeventsToSysAp )
       
   168             {
       
   169             TRACES( RDebug::Print(_L("CNspsWsPlugin::OfferRawEvent:TRawEvent::EKeyDown, Forwarded to SysAp" ) ) );
       
   170             RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsNspsRawKeyEvent, ECoreAppUIsKeyEvent );
       
   171             }
       
   172 
       
   173         if ( iForwardRawKeyeventsToNcn )
       
   174             {
       
   175             TRACES( RDebug::Print(_L("CNspsWsPlugin::OfferRawEvent:TRawEvent::EKeyDown, Forwarded to MessageToneQuitting" ) ) );
       
   176             RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsMessageToneQuit, ECoreAppUIsStopTonePlaying );
       
   177             }
       
   178         }
       
   179     
       
   180     if ( aRawEvent.Type() == TRawEvent::EButton1Down ) // tapping screen also silents message tone
       
   181         {
       
   182         if ( iForwardRawKeyeventsToNcn )
       
   183             {
       
   184             TRACES( RDebug::Print(_L("CNspsWsPlugin::OfferRawEvent:TRawEvent::EPointerSwitchOn, Forwarded to MessageToneQuitting" ) ) );
       
   185             RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsMessageToneQuit, ECoreAppUIsStopTonePlaying );
       
   186             }
       
   187         }
       
   188             
       
   189     return EFalse;
       
   190     }
       
   191 
       
   192 // End of File
       
   193 
       
   194