uifw/AvKon/src/AknCharMap.cpp
branchRCL_3
changeset 51 fcdfafb36fe7
parent 38 c52421ed5f07
child 55 aecbbf00d063
--- a/uifw/AvKon/src/AknCharMap.cpp	Thu Jul 15 18:56:19 2010 +0300
+++ b/uifw/AvKon/src/AknCharMap.cpp	Thu Aug 19 10:11:06 2010 +0300
@@ -396,7 +396,9 @@
         void SwitchEmotionVisibilityL();
         TBool NeedEmotionSwitchIcon() const;
         HBufC* ReadEmotionHBufCL();
-        void LoadEmotionTumbnails(const TDesC& aChars);
+        void LoadEmotionTumbnails(const TDesC& aText);
+        void PlayAnimationL(const TDesC& aText);
+        void StopAnimation(const TDesC& aText);
         void SetEmotionSize(const TSize& aSize);
         TBool IsEmotionChar(TChar aChar);
         TChar SwitchToSctChar();
@@ -438,6 +440,9 @@
         // Indicates whether menu sct is highlighted or not.
         TBool iMenuSctHighlighted;
         
+        // flag for focus status of char map dialog
+        TBool iCharMapFocusGained;
+        
     public: // for Emotion
         HBufC* iCharsSmiley;
         CSmileyModel* iSmileyModel;
@@ -1071,8 +1076,8 @@
         // start complex dynamic logic to locate title rect when emotion is unable
         TInt orientation = mirrored ? -1 : 1;
         TInt newLeft = titleRect.iTl.iX + orientation*rect.Width()/2;
-        TPoint titleTL( newLeft, titleRect.iTl.iY );
-        titleRect.SetRect( titleTL, titleRect.Size() );
+        TPoint titlePoint( newLeft, titleRect.iTl.iY );
+        titleRect.SetRect( titlePoint, titleRect.Size() );
         }
     AknLayoutUtils::LayoutLabel(iTitle, titleRect, textlayout.LayoutLine());
 
@@ -1496,11 +1501,24 @@
     return charsSmiley;
     }
 
-void CAknCharMapExtension::LoadEmotionTumbnails(const TDesC& aChars)
+void CAknCharMapExtension::LoadEmotionTumbnails(const TDesC& aText)
     {
     //If emotion tumbbails can't be load, 
     // no emotion tumbnail will be dispalyed.
-    TRAP_IGNORE( iSmileyModel->LoadStillImagesL(aChars) );
+    TRAP_IGNORE( iSmileyModel->LoadStillImagesL(aText) );
+    }
+
+const TInt KAnimationRepeat = 30;
+const TInt KAnimationDelay = 150*1000;
+
+void CAknCharMapExtension::PlayAnimationL(const TDesC& aText)
+    {
+    iSmileyModel->PlayAnimationL(aText, KAnimationRepeat, KAnimationDelay);
+    }
+
+void CAknCharMapExtension::StopAnimation(const TDesC& aText)
+    {
+    iSmileyModel->StopAnimation(aText);
     }
 
 void CAknCharMapExtension::SetEmotionSize(const TSize& aSize)
@@ -2100,10 +2118,6 @@
         iShowCasesRef = &iSpecialCharCases;
         iShowPagesRef = &iSpecialCharPages;
         
-        // default
-        iSpecialCharCase = EAknSCTLowerCase;
-        iChars = iCharsBufferLower;
-        
         if(iExtension->iCharsSmiley && iExtension->IsShowingEmotion())
             {
             iChars = iExtension->iCharsSmiley;
@@ -2128,6 +2142,11 @@
             {
             iChars = iExtension->iCharsQwerty;
             }
+        else
+            {
+            iSpecialCharCase = EAknSCTLowerCase;
+            iChars = iCharsBufferLower;
+            }
         }
 
     // calculate page count for all pages
@@ -2173,9 +2192,7 @@
         UpdateScrollIndicatorL();
         }
     
-    iExtension->LoadEmotionTumbnails(*iChars);
-    
-    SetSmileyAnimationActivityInCurrentPageL(ETrue);
+    Extension()->LoadEmotionTumbnails(*iChars);
     
     }
 
@@ -2364,7 +2381,14 @@
             {
             iExtension->iKeyBrdEvent = ETrue;
             iExtension->iHighlightVisible = ETrue;
-            iCursorPos = TPoint( 0, 0 );
+            if ( LengthOfRecentChar() == 0 && CurrentPage() == 1 )
+            	{
+                iCursorPos = TPoint( 0, 1 );
+            	}
+            else
+            	{
+                iCursorPos = TPoint( 0, 0 );
+            	}
             DrawCursor();
             return EKeyWasConsumed;
             }
@@ -2764,8 +2788,6 @@
         // Sets the character case because the buffer content may have changed.
         SetCharacterCaseL(iSpecialCharCase);
         
-        SetSmileyAnimationActivityInCurrentPageL(ETrue);
-        
         TInt cursorIndexAfterSwitch;
         if ( !iExtension->iKeyBrdEvent )
             {
@@ -2789,6 +2811,8 @@
         // the new first row is the top row on the page where the new focus is.
         TInt pageVolume = iMaxColumns * iExtension->iMaxVisibleRows;
         iFirstVisibleRow = (cursorIndexAfterSwitch / pageVolume * pageVolume) / iMaxColumns;
+        
+        SetSmileyAnimationActivityInCurrentPageL(ETrue);
 
         // the cursor positions are relative to current page
         TInt cursorIndexAfterSwitchInPage = cursorIndexAfterSwitch - (iMaxColumns * iFirstVisibleRow);
@@ -2863,11 +2887,13 @@
 
     else if(aType == KEikMessageFadeAllWindows) // focus gained // KEikMessageWindowsFadeChange
         {
+        Extension()->iCharMapFocusGained = ETrue;
         SetSmileyAnimationActivityInCurrentPageL(ETrue);
         }
     
     else if(aType == KAknMessageFocusLost) // focus lost
         {
+        Extension()->iCharMapFocusGained = EFalse;
         SetSmileyAnimationActivityInCurrentPageL(EFalse);
         
         if ( iExtension->iHighlightVisible )
@@ -3444,15 +3470,17 @@
 
     TPoint pos = iGridTopLeft;
     TSize size(iGridItemWidth*iMaxColumns+1, iGridItemHeight);
+    
+    // eliminate the overlap area between menu sct and the first menu item.
+    if ( Extension()->iMenuSct )
+        {
+        // provide a dirty fix for Menu SCT, since Layout data is not suitable for this
+        size = TSize( Rect().Width()- 1, iGridItemHeight - 1 );
+        }
     if(iIsMirrored)
         {
         pos.iX += iGridItemWidth - size.iWidth;
         }
-    // eliminate the overlap area between menu sct and the first menu item.
-    if ( Extension()->iMenuSct )
-        {
-        size.iHeight--;
-        }
 
     AknsDrawUtils::Background(skin, cc, this, aGc, TRect(pos,size));
 
@@ -4851,20 +4879,29 @@
         firstCellLayRect.LayoutRect(gridRect,
             AknLayoutScalable_Avkon::cell_graphic_popup_pane_cp2(0,0,0));
 
+        TAknLayoutRect rightCellLayRect;
+        rightCellLayRect.LayoutRect(gridRect,
+            AknLayoutScalable_Avkon::cell_graphic_popup_pane_cp2(0,1,0));
         TRect firstCellRect;
+
+        // Cell width.
+        iGridItemWidth =
+            rightCellLayRect.Rect().iTl.iX - firstCellLayRect.Rect().iTl.iX;
+        if (iGridItemWidth < 0)
+            {
+            iGridItemWidth = -iGridItemWidth;
+            }
+        
         if ( Extension()->iMenuSct )
             {
             firstCellRect = TRect( TPoint(0, 0),
-                 TSize( firstCellLayRect.Rect().Width(), Rect().Height() ) );
+                 TSize( iGridItemWidth, Rect().Height() ) );
             }
         else
             {
             firstCellRect = firstCellLayRect.Rect();
             }
 
-        TAknLayoutRect rightCellLayRect;
-        rightCellLayRect.LayoutRect(gridRect,
-            AknLayoutScalable_Avkon::cell_graphic_popup_pane_cp2(0,1,0));
 
         TInt firstVisibleIndex = iFirstVisibleRow * iMaxColumns;
         // Max columns.
@@ -4874,14 +4911,6 @@
         // Max visible rows.
         iExtension->iMaxVisibleRows = gridRect.Height() / firstCellRect.Height();
 
-        // Cell width.
-        iGridItemWidth =
-            rightCellLayRect.Rect().iTl.iX - firstCellLayRect.Rect().iTl.iX;
-        if (iGridItemWidth < 0)
-            {
-            iGridItemWidth = -iGridItemWidth;
-            }
-
         // Cell height.
         if ( Extension()->iMenuSct )
             {
@@ -5653,6 +5682,11 @@
         {
         resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS_CHINESE;
         }
+    else if (FeatureManager::FeatureSupported(KFeatureIdKorean))
+        {
+        // Added korea character support
+        resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS_KOREAN;
+        }
 
     CCoeEnv::Static()->CreateResourceReaderLC( reader, resourceId );
     ConstructFromResourceL( reader );
@@ -5853,7 +5887,7 @@
             }
         
         CAknCharMapHistory::THistoryFilter historyFilter;
-        if(iExtension->IsEmotionEnabled())
+        if(Extension()->IsEmotionEnabled())
             {
             historyFilter = CAknCharMapHistory::EHistoryFilterMixed;
             }
@@ -5886,21 +5920,32 @@
                 {
                 iShowCasesRef = &iSpecialCharCases;
                 iShowPagesRef = &iSpecialCharPages;
-                iChars = iCharsBufferLower;
+
                 if (iCharsBufferUpper && iSpecialCharCase==EAknSCTUpperCase)
+                    {
                     iChars = iCharsBufferUpper;
+                    }
                 else if (iCharsBufferNumeric && iSpecialCharCase==EAknSCTNumeric)
+                    {
                     iChars = iCharsBufferNumeric;
+                    }
                 else if (iCharsBufferFull && iSpecialCharCase==EAknSCTFullCase)
+                    {
                     iChars = iCharsBufferFull;
+                    }
                 else if (iCharsBufferHalf && iSpecialCharCase==EAknSCTHalfCase)
+                    {
                     iChars = iCharsBufferHalf;
+                    }
                 else if (iExtension->iCharsQwerty && iSpecialCharCase==EAknSCTQwerty)
+                    {
                     iChars = iExtension->iCharsQwerty;
-
-                if(iChars == iCharsBufferLower)
+                    }
+                else
                     {
+                    // default
                     iSpecialCharCase = EAknSCTLowerCase;
+                    iChars = iCharsBufferLower;
                     }
                 }
             // mark that iChars doesn't point to HBufC
@@ -5957,7 +6002,10 @@
         iExtension->iFlags |= EAknCharMapCharsAllocated; // mark that iChars points to HBufC
         }
     
-    iExtension->LoadEmotionTumbnails(*iChars);
+    Extension()->LoadEmotionTumbnails(*iChars);
+    
+    // control will never get focus event while it is in EditMenu mode
+    Extension()->iCharMapFocusGained = ETrue;
 
     // The "PlayAnimationL" in "SetSmileyAnimationActivityInCurrentPageL"
     // will leave. If we ignore it, just no animation is played.
@@ -6214,9 +6262,15 @@
 
 TBool CAknCharMap::IsJapaneseSctUi() const
     {
+    //Japanese feature for SCT will not be supported since TB9.2 PS2,
+    //so it always return EFalse.
     return EFalse;
     }
 
+TBool CAknCharMap::IsKoreanSctUi() const
+    {
+    return FeatureManager::FeatureSupported( KFeatureIdKorean );
+    }
 // -----------------------------------------------------------------------------
 // CAknCharMap::TitleWithSelectingSpecialChar()
 // Return the title string with the selecting special characters
@@ -6708,37 +6762,22 @@
         }
     }
 
-const TInt KAnimationRepeat = 30;
-const TInt KAnimationDelay = 1000*1000;
-
 void CAknCharMap::SetSmileyAnimationActivityInCurrentPageL(TBool aIsActive)
     {
-    TInt begin = iFirstVisibleRow * iMaxColumns;
-    TInt end = iExtension->iMaxVisibleRows * iMaxColumns + begin;
-    if( end > iChars->Length() ) 
-        {
-        end = iChars->Length();
-        }
-
-    for( TInt i(begin); i<end; i++ )
-        {
-        TChar code = (*iChars)[i];
-        CAknSmileyIcon* icon = iExtension->EmotionIcon(code);
-        if( !icon ) 
-            {
-            continue;
-            }
-
-        if( ( aIsActive ) && 
-           ( Extension()->IsShowingEmotion() || Extension()->iMenuSctHighlighted) 
-           )
-            {
-            icon->PlayAnimationL( KAnimationRepeat, KAnimationDelay );
-            }
-        else
-            {
-            icon->StopAnimation();
-            }
+    TInt pos = iFirstVisibleRow * iMaxColumns;
+    TInt maxLength = iChars->Length() - pos;
+    TInt length = iExtension->iMaxVisibleRows * iMaxColumns;
+    if(length > maxLength) length = maxLength;
+
+    const TPtrC textInCurrentPage = iChars->Mid(pos, length);
+    
+    if(Extension()->iCharMapFocusGained && aIsActive)
+        {
+        Extension()->PlayAnimationL(textInCurrentPage);
+        }
+    else
+        {
+        Extension()->StopAnimation(textInCurrentPage);
         }
     }