phoneuis/dialer/src/cdialernumberentry.cpp
branchRCL_3
changeset 25 91c2fb4b78df
parent 19 544e34b3255a
child 34 b68fcd923911
--- a/phoneuis/dialer/src/cdialernumberentry.cpp	Wed Apr 14 15:56:42 2010 +0300
+++ b/phoneuis/dialer/src/cdialernumberentry.cpp	Tue Apr 27 16:37:10 2010 +0300
@@ -50,6 +50,10 @@
 const TInt KNumberEntryControlCount = 2; //  = number entry, label
 
 _LIT( KPhoneValidChars, "0123456789*#+pwPW" );
+const TInt KKeyCtrlA( 1 );
+const TInt KKeyCtrlC( 3 );
+const TInt KKeyCtrlV( 22 );
+const TInt KKeyCtrlX( 24 );
 
 // ========================= MEMBER FUNCTIONS ================================
 
@@ -157,8 +161,8 @@
     
     CCoeControl::SetFocus( aFocus, aDrawNow );
     iEditor->SetFocus( aFocus );
-     
-    DIALER_PRINT("numberentry::SetFocus>");    
+    
+    DIALER_PRINT("numberentry::SetFocus>");
     }
 
 
@@ -340,7 +344,7 @@
 TKeyResponse CDialerNumberEntry::OfferKeyEventL( 
                                             const TKeyEvent& aKeyEvent, 
                                             TEventCode aType )
-    {       
+    {
     TKeyResponse handled = EKeyWasNotConsumed;
         
     // First, offer keyevent to easy dialer.
@@ -352,12 +356,38 @@
     // Then to number entry editor. 
     if (handled == EKeyWasNotConsumed)
         {
-        handled = iEditor->OfferKeyEventL(aKeyEvent, aType);
+        // Clipboard support
+        if ( aKeyEvent.iCode == KKeyCtrlA ) // CTRL + A
+            {
+            iEditor->SelectAllL();
+            handled = EKeyWasConsumed;
+            }
+        else if ( aKeyEvent.iCode == KKeyCtrlC ) // CTRL + C
+            {
+            iEditor->CcpuCopyL();
+            handled = EKeyWasConsumed;
+            }
+        else if ( aKeyEvent.iCode == KKeyCtrlV ) // CTRL + V
+            {
+            iEditor->CcpuPasteL();
+            handled = EKeyWasConsumed;
+            }
+        else if ( aKeyEvent.iCode == KKeyCtrlX ) // CTRL + X
+            {
+            iEditor->CcpuCutL();
+            handled = EKeyWasConsumed;
+            }
+        // Key events 1 - 28 can be generated by CTRL + key combinations.
+        // Filter all unwanted key events, only BS is accepted by editor.
+        else if ( aKeyEvent.iCode == EKeyBackspace || aKeyEvent.iCode >= EKeySpace )
+            {
+            handled = iEditor->OfferKeyEventL(aKeyEvent, aType);
+            }
         }
-        
+    
     return handled;
     }
-    
+
 // ---------------------------------------------------------------------------
 // CDialerNumberEntry::CountComponentControls 
 // ---------------------------------------------------------------------------
@@ -410,7 +440,7 @@
         DIALER_PRINT("numberentry::Draw.Frame.failed"); 
         }
                             
-    gc.SetBrushStyle( CGraphicsContext::ENullBrush );        
+    gc.SetBrushStyle( CGraphicsContext::ENullBrush );
     }
 
 
@@ -698,14 +728,14 @@
     {
     if ( iOperationMode == EModeEasyDialing )
         {
-        aOuterRect = Rect();
+        aOuterRect = aFrameRect;
         TAknLayoutRect innerRectLayout;
         innerRectLayout.LayoutRect( aOuterRect, AknLayoutScalable_Apps::bg_dia3_numentry_pane_g1() );
         aInnerRect = innerRectLayout.Rect();
         
         // Add a bit of margin to left and right ends of the entry field if layout
         // doens't define enough. This is to enhance the touch usability.
-        static const TInt KMinMargin( 10 );
+        static const TInt KMinMargin( 15 );
         aInnerRect.iTl.iX = Max( aInnerRect.iTl.iX, aOuterRect.iTl.iX + KMinMargin );
         aInnerRect.iBr.iX = Min( aInnerRect.iBr.iX, aOuterRect.iBr.iX - KMinMargin );
         }
@@ -715,13 +745,13 @@
             {
             TAknLayoutRect frameTopRight;
             frameTopRight.LayoutRect( 
-             aFrameRect, 
-             AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g3().LayoutLine() );
+                aFrameRect, 
+                AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g3().LayoutLine() );
                     
             TAknLayoutRect frameBottomLeft;
             frameBottomLeft.LayoutRect( 
-             aFrameRect, 
-             AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g4().LayoutLine() );
+                aFrameRect, 
+                AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g4().LayoutLine() );
     
             aOuterRect = TRect( frameTopRight.Rect().iTl, 
                                 frameBottomLeft.Rect().iBr );
@@ -760,7 +790,7 @@
         // Hide prompt text
         if ( iLabel->Text()->Length() )
             {
-            iLabel->MakeVisible( EFalse );     
+            iLabel->MakeVisible( EFalse );
             }         
         iNumberContents = ETrue;
         }
@@ -769,7 +799,7 @@
         // Show prompt text
         if ( iLabel->Text()->Length() )
             {
-            iLabel->MakeVisible( ETrue );     
+            iLabel->MakeVisible( ETrue );
             } 
         iNumberContents = EFalse;
         }