textinput/peninputfingerhwrar/src/peninputfingerhwrardatastore.cpp
branchRCL_3
changeset 12 5e18d8c489d6
parent 7 6defe5d1bd39
child 19 ac7e4d1d9209
equal deleted inserted replaced
11:c8fb4cf7b3ae 12:5e18d8c489d6
    16 */
    16 */
    17 
    17 
    18 //SYSTEM INCLUDE
    18 //SYSTEM INCLUDE
    19 #include <centralrepository.h>
    19 #include <centralrepository.h>
    20 #include <settingsinternalcrkeys.h>
    20 #include <settingsinternalcrkeys.h>
       
    21 #include <CommonEngineDomainCRKeys.h>
    21 
    22 
    22 //FEP INCLUDE
    23 //FEP INCLUDE
    23 #include <aknfeppeninputenums.h>
    24 #include <aknfeppeninputenums.h>
    24 #include <aknfepglobalenums.h>
    25 #include <AknFepGlobalEnums.h>
    25 #include <aknfepinternalcrkeys.h>
    26 #include <AknFepInternalCRKeys.h>
    26 
    27 
    27 //USER INCLUDE
    28 //USER INCLUDE
    28 #include "peninputfingerhwrarlayout.h"
    29 #include "peninputfingerhwrarlayout.h"
    29 #include "peninputfingerhwrardatastore.h"
    30 #include "peninputfingerhwrardatastore.h"
    30 #include "peninputfingerhwrarengine.h"
    31 #include "peninputfingerhwrarengine.h"
    68     
    69     
    69     iKeyMappingStringList.ResetAndDestroy();
    70     iKeyMappingStringList.ResetAndDestroy();
    70     iKeyMappingStringList.Close();
    71     iKeyMappingStringList.Close();
    71 
    72 
    72     delete iRepositoryFep;
    73     delete iRepositoryFep;
       
    74     delete iCommonEngineRepository;
    73 //    delete iTriggerStr;   
    75 //    delete iTriggerStr;   
    74     delete iHwrEngine;
    76     delete iHwrEngine;
    75     delete iUserDefinedResource;
    77     delete iUserDefinedResource;
    76     
    78     
    77     if ( iDefaultNumberMapping )
    79     if ( iDefaultNumberMapping )
   447 TBool CPeninputFingerHwrArDataStore::Highlight()
   449 TBool CPeninputFingerHwrArDataStore::Highlight()
   448    {
   450    {
   449    return iIsHighlightCell;
   451    return iIsHighlightCell;
   450    }
   452    }
   451  
   453  
   452 // -----------------------------------------------------------------------------
       
   453 // CPeninputFingerHwrArDataStore::RemoveDuplicateCand
       
   454 // -----------------------------------------------------------------------------
       
   455 //
       
   456 TInt CPeninputFingerHwrArDataStore::RemoveDuplicateCand(const RPointerArray<HBufC>& aSrc,
       
   457                                                  RPointerArray<HBufC>& aTgt,
       
   458                                                  TInt aSrcStartIdx,
       
   459                                                  TInt aTgtStartIdx)
       
   460     {
       
   461     TInt lastOverlapIdx = KInvalidIndex;
       
   462 
       
   463     // on the assumption that if candidate overlap,
       
   464     // it is overlap only once
       
   465     TInt srccandcnt = aSrc.Count();
       
   466 
       
   467     for (TInt i = aSrcStartIdx; i < srccandcnt; i++)
       
   468         {
       
   469         for (TInt j = aTgtStartIdx; j < aTgt.Count(); j++)
       
   470             {
       
   471             if (aTgt[j]->Compare(*(aSrc[i])) == 0)
       
   472                 {
       
   473                 lastOverlapIdx = i;
       
   474                 delete aTgt[j];
       
   475                 aTgt.Remove(j);
       
   476                 j--;
       
   477                 break;
       
   478                 }
       
   479             }
       
   480         }
       
   481 
       
   482     return lastOverlapIdx;
       
   483     }        
       
   484        
       
   485  // ----------------------------------------------------------------------------
   454  // ----------------------------------------------------------------------------
   486  // C++ constructor
   455  // C++ constructor
   487  // ----------------------------------------------------------------------------
   456  // ----------------------------------------------------------------------------
   488  //
   457  //
   489  CPeninputFingerHwrArDataStore::CPeninputFingerHwrArDataStore(CPeninputFingerHwrArLayout* aLayout)
   458  CPeninputFingerHwrArDataStore::CPeninputFingerHwrArDataStore(CPeninputFingerHwrArLayout* aLayout)
   490      :iLayout( aLayout )
   459      :iLanguage(ELangNone),
       
   460       iCurrentNumberMode(EAknEditorStandardNumberModeKeymap),
       
   461       iLayout( aLayout ),
       
   462       iIsHighlightCell(ETrue),
       
   463       iIsNativeNumMode(EFalse)
   491      {
   464      {
   492      iLanguage = ELangNone;
       
   493      iCurrentNumberMode = EAknEditorStandardNumberModeKeymap;
       
   494      iIsHighlightCell = ETrue;
       
   495      }
   465      }
   496 
   466 
   497  // ----------------------------------------------------------------------------
   467  // ----------------------------------------------------------------------------
   498  // Second phase constructor
   468  // Second phase constructor
   499  // ----------------------------------------------------------------------------
   469  // ----------------------------------------------------------------------------
   509      //create the hwr engine
   479      //create the hwr engine
   510      iHwrEngine = CPeninputFingerHwrArEngine::NewL( aPtiEngine, this );
   480      iHwrEngine = CPeninputFingerHwrArEngine::NewL( aPtiEngine, this );
   511      
   481      
   512      //initialize the key mapping list
   482      //initialize the key mapping list
   513      InitKeyMappingListL();
   483      InitKeyMappingListL();
       
   484      
       
   485      // read number mode flag.
       
   486      //create the repository for common engine.
       
   487      iCommonEngineRepository = CRepository::NewL(KCRUidCommonEngineKeys);
       
   488      TInt displayLang = 0;
       
   489      iCommonEngineRepository->Get(KGSDisplayTxtLang,displayLang);
       
   490      if( displayLang == ELangTest )
       
   491          {
       
   492          displayLang = User::Language();
       
   493          }     
       
   494      if(displayLang == ELangArabic)
       
   495          {
       
   496          iIsNativeNumMode = ETrue;
       
   497          }
       
   498      else
       
   499          {
       
   500          iIsNativeNumMode = EFalse;
       
   501          }
       
   502      iRepositoryFep->Set(KAknFepDefaultArabicNumberMode,iIsNativeNumMode);
       
   503      
   514      }
   504      }
   515 
   505 
   516  // ----------------------------------------------------------------------------
   506  // ----------------------------------------------------------------------------
   517  // Initialize the key mapping list
   507  // Initialize the key mapping list
   518  // ----------------------------------------------------------------------------
   508  // ----------------------------------------------------------------------------
   699 // CPeninputFingerHwrArDataStore::IsArabicNumber
   689 // CPeninputFingerHwrArDataStore::IsArabicNumber
   700 // ----------------------------------------------------------------------------
   690 // ----------------------------------------------------------------------------
   701 //	
   691 //	
   702 TBool CPeninputFingerHwrArDataStore::IsArabicNumber(TUint16 aChar)
   692 TBool CPeninputFingerHwrArDataStore::IsArabicNumber(TUint16 aChar)
   703     {
   693     {
   704 	if(aChar >= 0x0661 && aChar <= 0x0669)
   694 	if(aChar >= 0x0660 && aChar <= 0x0669)
   705 	    {
   695 	    {
   706 		return ETrue;
   696 		return ETrue;
   707 		}
   697 		}
   708 	
   698 	
   709     return EFalse;	
   699     return EFalse;	
   710 	}
   700 	}
   711 	
   701 
       
   702 // ----------------------------------------------------------------------------
       
   703 // CPeninputFingerHwrArDataStore::IsNumberOnlyMode
       
   704 // ----------------------------------------------------------------------------
       
   705 //  
       
   706 TBool CPeninputFingerHwrArDataStore::IsNumberOnlyMode()
       
   707     {
       
   708     if(PrimaryRange() == ERangeNumber)
       
   709         {
       
   710         return ETrue;
       
   711         }
       
   712     return EFalse;
       
   713     }
       
   714 
       
   715 // ----------------------------------------------------------------------------
       
   716 // CPeninputFingerHwrArDataStore::IsNativeNumMode
       
   717 // ----------------------------------------------------------------------------
       
   718 //  
       
   719 TBool CPeninputFingerHwrArDataStore::IsNativeNumMode()
       
   720     {
       
   721     return iIsNativeNumMode;
       
   722     }
   712 // End Of File
   723 // End Of File