coreapplicationuis/SysAp/Src/sysapkeymanagement.cpp
branchRCL_3
changeset 19 924385140d98
parent 0 2e3d3ce01487
child 20 c2c61fdca848
--- a/coreapplicationuis/SysAp/Src/sysapkeymanagement.cpp	Thu Aug 19 10:05:08 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/sysapkeymanagement.cpp	Tue Aug 31 15:24:25 2010 +0300
@@ -134,6 +134,10 @@
             {
             iRootWindowGroup.CancelCaptureKeyUpAndDowns( info->iUpAndDownKeyHandles[upAndDownKeyHandleCounter] );
             }
+        for ( TInt keyHandleCounter = info->iLongKeyPressHandle.Count()-1; keyHandleCounter >= 0; keyHandleCounter-- )
+             {
+             iRootWindowGroup.CancelCaptureLongKey( info->iLongKeyPressHandle[keyHandleCounter] );
+             }
         }
     }
 
@@ -166,8 +170,10 @@
                                        captureKey, info->iPluginUid ) );
 			if (info->iIsKeyProvider)
 			    {
+			    TUint repeatValue = 0;
 			    TInt captureUpDownKey = info->iKeys[keyCounter].iScanCode;
 			    TUint modifiers = info->iKeys[keyCounter].iModifiers;
+			    repeatValue = info->iKeys[keyCounter].iRepeats; 
 			    
                 TInt32 keyHandle = iRootWindowGroup.CaptureKey( captureKey, modifiers, modifiers );
                 
@@ -196,6 +202,19 @@
                     //error of Append ignored, key will not be cancelled. We can live with that.
                     TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureKeys UpAndDowns: Append failed, error %d"), upAndDownKeyHandle ) );
                     }
+                if( repeatValue == 1 )
+                    {
+                    TInt32 longKeyPressHandle = iRootWindowGroup.CaptureLongKey( captureKey, captureKey,0, modifiers,0, ELongCaptureWaitShort);
+                    if ( longKeyPressHandle < KErrNone )
+                        {
+                       TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureLongKey : error %d"), longKeyPressHandle ) );
+                       continue; // other keys may be possible to capture, so continue
+                        }
+                    if ( ( longKeyPressHandle = info->iLongKeyPressHandle.Append( longKeyPressHandle ) ) != KErrNone ) //store handle for CancelCaptureKeyUpAndDowns
+                         {
+                          TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureLongKey : Append failed, error %d"), longKeyPressHandle ) );
+                         }                               
+                    }
 			    }
 			else
 			    {