uifw/AvKon/src/AknSctDialog.cpp
branchRCL_3
changeset 72 a5e7a4f63858
parent 64 85902f042028
equal deleted inserted replaced
64:85902f042028 72:a5e7a4f63858
    54 
    54 
    55 #include <AknTasHook.h>
    55 #include <AknTasHook.h>
    56 #include "aknsctfocushandler.h"
    56 #include "aknsctfocushandler.h"
    57 
    57 
    58 #include <eikdialogext.h>
    58 #include <eikdialogext.h>
    59 #include <aknglobalpopupprioritycontroller.h>
       
    60 
    59 
    61 //
    60 //
    62 // class CAknCharMapDialog
    61 // class CAknCharMapDialog
    63 //
    62 //
    64 
    63 
    90     ~CAknCharMapDialogExtension();
    89     ~CAknCharMapDialogExtension();
    91 
    90 
    92 private:
    91 private:
    93     CAknCharMapDialogExtension(CAknCharMapDialog* aCaller);
    92     CAknCharMapDialogExtension(CAknCharMapDialog* aCaller);
    94     void ConstructL();
    93     void ConstructL();
    95 
       
    96 public: // New method
       
    97     void SetCharacterCaseIfRequiredL();
       
    98     
    94     
    99 public:
    95 public:
   100     TInt iFlags;
    96     TInt iFlags;
   101     TBool iQwertyMode;
    97     TBool iQwertyMode;
   102     CAknCharMapDialog* iCaller;
    98     CAknCharMapDialog* iCaller;
   103     TBool iHaveReceivedKeyEvent;
    99     TBool iHaveReceivedKeyEvent;
   104 
   100 
   105     TInt iShowAnotherTableCharCase;
   101     TInt iShowAnotherTableCharCase;
   106     TAknCharMapPictoMode    iPictoMode;
   102     TAknCharMapPictoMode    iPictoMode;
   107     TAknCharMapEmotionMode  iEmotionMode;
   103     TAknCharMapEmotionMode  iEmotionMode;
   108     TBool iFirstOrientation;
   104 
   109     TBool iSimKeyDown;
       
   110     };
   105     };
   111 
   106 
   112 // -----------------------------------------------------------------------------
   107 // -----------------------------------------------------------------------------
   113 // CAknCharMapDialogExtension::CAknCharMapDialogExtension
   108 // CAknCharMapDialogExtension::CAknCharMapDialogExtension
   114 //
   109 //
   115 // Constructor of extension
   110 // Constructor of extension
   116 // -----------------------------------------------------------------------------
   111 // -----------------------------------------------------------------------------
   117 //
   112 //
   118 CAknCharMapDialogExtension::CAknCharMapDialogExtension(CAknCharMapDialog* aCaller) : 
   113 CAknCharMapDialogExtension::CAknCharMapDialogExtension(CAknCharMapDialog* aCaller) : 
   119 iFlags(0), iQwertyMode(EFalse), iCaller(aCaller), 
   114 iFlags(0), iQwertyMode(EFalse), iCaller(aCaller), 
   120 iShowAnotherTableCharCase(-1), iPictoMode(EAknCharMapPictoNoUse), iEmotionMode(EAknCharMapEmotionNoUse),
   115 iShowAnotherTableCharCase(-1), iPictoMode(EAknCharMapPictoNoUse), iEmotionMode(EAknCharMapEmotionNoUse)
   121 iSimKeyDown( EFalse )
       
   122     {
   116     {
   123     }
   117     }
   124 
   118 
   125 // -----------------------------------------------------------------------------
   119 // -----------------------------------------------------------------------------
   126 // CAknCharMapDialogExtension::~CAknCharMapDialogExtension
   120 // CAknCharMapDialogExtension::~CAknCharMapDialogExtension
   153 // Symbian construction
   147 // Symbian construction
   154 // -----------------------------------------------------------------------------
   148 // -----------------------------------------------------------------------------
   155 //
   149 //
   156 void CAknCharMapDialogExtension::ConstructL()
   150 void CAknCharMapDialogExtension::ConstructL()
   157     {
   151     {
   158     iFirstOrientation = Layout_Meta_Data::IsLandscapeOrientation();
       
   159     }
       
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // CAknCharMapDialogExtension::SetCharacterCaseIfRequiredL
       
   163 //
       
   164 // change the character case, when orientation changed if any.
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 void CAknCharMapDialogExtension::SetCharacterCaseIfRequiredL()
       
   168     {
       
   169     TBool landscape = Layout_Meta_Data::IsLandscapeOrientation();
       
   170     TInt charCase = EAknSCTLowerCase;
       
   171     CAknCharMap* charmapControl =
       
   172             STATIC_CAST( CAknCharMap*, iCaller->Control( EAknSCTQueryContentId ) );
       
   173 
       
   174     // Set character case logic changed from Timebox 92 PS2, if Orientation is Landscape
       
   175     //   the case will be QWERTY, otherwise it will be LOWER. However, it is possible for
       
   176     //   Landscape launches LOWER case, or Poratrait does QWERTY at the first time launched,
       
   177     //   in this case, we need to store the first SCT launched case.
       
   178     if ( landscape )
       
   179         {
       
   180         iFlags |= ECharMapDialogItemLockNumericKeys;
       
   181         charCase = EAknSCTQwerty;
       
   182         }
       
   183     else
       
   184         {
       
   185         iFlags &= ( ~ECharMapDialogItemLockNumericKeys );
       
   186         charCase = EAknSCTLowerCase;
       
   187         }
       
   188 
       
   189     if ( landscape == iFirstOrientation )
       
   190     	{
       
   191         // Note, it should be equal to first char case once it return
       
   192         //    to the first orientation
       
   193         charCase = iCaller->CharacterCase();
       
   194     	}
       
   195     charmapControl->SetCharacterCaseL( charCase );
       
   196 
       
   197     }
   152     }
   198 
   153 
   199 // CAknCharMapDialog
   154 // CAknCharMapDialog
   200 EXPORT_C CAknCharMapDialog::CAknCharMapDialog(TInt aCharCase, TDes& aSpecialChars, TInt aCharSetResourceId) : 
   155 EXPORT_C CAknCharMapDialog::CAknCharMapDialog(TInt aCharCase, TDes& aSpecialChars, TInt aCharSetResourceId) : 
   201     iSpecialChars(&aSpecialChars), iCharCase(aCharCase), iCharSetResourceId(aCharSetResourceId)
   156     iSpecialChars(&aSpecialChars), iCharCase(aCharCase), iCharSetResourceId(aCharSetResourceId)
   221     }
   176     }
   222 
   177 
   223 EXPORT_C void CAknCharMapDialog::HandleResourceChange(TInt aType)
   178 EXPORT_C void CAknCharMapDialog::HandleResourceChange(TInt aType)
   224     {
   179     {
   225     CAknCharMap* charmapControl = static_cast<CAknCharMap*>( Control( EAknSCTQueryContentId ) );
   180     CAknCharMap* charmapControl = static_cast<CAknCharMap*>( Control( EAknSCTQueryContentId ) );
   226 
       
   227     if (aType==KEikDynamicLayoutVariantSwitch)
       
   228         {
       
   229         TRAP_IGNORE(iExtension->SetCharacterCaseIfRequiredL());
       
   230         //DoLayout();
       
   231         }
       
   232 
   181 
   233     CAknDialog::HandleResourceChange(aType);
   182     CAknDialog::HandleResourceChange(aType);
   234 
   183 
   235     if (aType==KEikDynamicLayoutVariantSwitch)
   184     if (aType==KEikDynamicLayoutVariantSwitch)
   236         {
   185         {
   297 
   246 
   298     // Selection key / select softkey adds a character only if 5-key was not used
   247     // Selection key / select softkey adds a character only if 5-key was not used
   299     // to select multiple characters before.
   248     // to select multiple characters before.
   300     if (aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyExit)
   249     if (aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyExit)
   301         {
   250         {
       
   251         // In Japanese UI, SCT isn't closed by pressing "Select" softkey,
       
   252         // but SCT is closed by pressing "Back"(button id is EAknSoftkeyClose).
   302         MAknSctFocusHandler* handler = charmapControl->FocusHandler();
   253         MAknSctFocusHandler* handler = charmapControl->FocusHandler();
       
   254         if (charmapControl->IsJapaneseSctUi() &&
       
   255             aButtonId != EAknSoftkeyExit &&
       
   256             handler->FocusedControl() == charmapControl)
       
   257             {
       
   258             TKeyEvent key;
       
   259             key.iCode=EKeySpace;
       
   260             key.iModifiers=0;
       
   261             handler->FocusedControl()->OfferKeyEventL(key, EEventKey);
       
   262             return(EFalse);
       
   263             }
       
   264         // else
   303         TKeyEvent key;
   265         TKeyEvent key;
   304         key.iCode=EKeyOK;
   266         key.iCode=EKeyOK;
   305         key.iModifiers=0;
   267         key.iModifiers=0;
   306         if(handler->FocusedControl()->OfferKeyEventL(key, EEventKey) == EKeyWasNotConsumed)
   268         if(handler->FocusedControl()->OfferKeyEventL(key, EEventKey) == EKeyWasNotConsumed)
   307             {
   269             {
   384 	/// -- Change Window Priority for dialog and CBA 
   346 	/// -- Change Window Priority for dialog and CBA 
   385 	
   347 	
   386 	DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); //
   348 	DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); //
   387 	ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);
   349 	ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);
   388 	
   350 	
   389 	// Boost its priority in GlobalPopupPriorityController queue, because its window priority is higher than zero,
   351 	CEikDialog::Extension()->SetPriority(CActive::EPriorityStandard);
   390     // otherwise, GlobalPopupPriorityController will dim it wrongly.
       
   391     // This code only effects for aknnfysrv.exe, since input server doesn't have GlobalPopupPriorityController instance.
       
   392     AknGlobalPopupPriorityController::SetPopupPriorityL(*this, 1);
       
   393     
       
   394 	CEikDialog::Extension()->SetPriority(CActive::EPriorityStandard);	
       
   395     }
   352     }
   396 
   353 
   397 EXPORT_C void CAknCharMapDialog::SetSizeAndPosition( const TSize& aSize )
   354 EXPORT_C void CAknCharMapDialog::SetSizeAndPosition( const TSize& aSize )
   398     {
   355     {
   399     if ( AknLayoutUtils::PenEnabled() )
   356     if ( AknLayoutUtils::PenEnabled() )
   479 
   436 
   480             default:
   437             default:
   481                 break;
   438                 break;
   482             }
   439             }
   483         }
   440         }
   484     else if ( aModifiers == EEventKeyDown )
   441     else if (aModifiers == EEventKeyUp)
   485         {
   442         {
   486         switch ( aKeyEvent.iScanCode )
   443         switch (aKeyEvent.iScanCode)
   487             {
   444             {
   488             case EStdKeyLeftFunc:
   445             case EStdKeyLeftFunc:
   489             case EStdKeyRightFunc:
   446             case EStdKeyRightFunc:
   490                 {
   447                 {
   491                 iExtension->iSimKeyDown = ETrue;
   448                 if (!aKeyEvent.iRepeats) // switch another table when repeat count is 0 only.
   492                 }
       
   493                 break;
       
   494             default:
       
   495                 break;
       
   496             }
       
   497         }
       
   498     else if ( aModifiers == EEventKeyUp )
       
   499         {
       
   500         switch ( aKeyEvent.iScanCode )
       
   501             {
       
   502             case EStdKeyLeftFunc:
       
   503             case EStdKeyRightFunc:
       
   504                 {
       
   505                 if ( !aKeyEvent.iRepeats  && iExtension->iSimKeyDown ) // switch another table when repeat count is 0 only.
       
   506                     {
   449                     {
   507                     if (!isLockNumericKeys) // Check whether current input mode is Qwerty.
   450                     if (!isLockNumericKeys) // Check whether current input mode is Qwerty.
   508                         {
   451                         {
   509                         SwitchTablesOrPagesL();
   452                         SwitchTablesOrPagesL();
   510                         }
   453                         }
   511                     }
   454                     }
   512                 iExtension->iSimKeyDown = EFalse;
       
   513                 }
   455                 }
   514                 break;
   456                 break;
   515             default:
   457             default:
   516                 break;
   458                 break;
   517             }
   459             }
   993         {
   935         {
   994         cba.DrawNow();
   936         cba.DrawNow();
   995         }
   937         }
   996     }
   938     }
   997 
   939 
   998 TInt CAknCharMapDialog::CharacterCase()
   940 
   999 	{
       
  1000 	return iCharCase & KCharMapCaseMask;
       
  1001 	}
       
  1002 //  End of File
   941 //  End of File