fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepPredictiveSettingData.cpp
branchRCL_3
changeset 44 ecbabf52600f
equal deleted inserted replaced
43:ebd48d2de13c 44:ecbabf52600f
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:          
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 /*
       
    28  * ============================================================================
       
    29  *  Name     : CAknFepPredictiveSettingData from AknFepPredictiveSettingData 
       
    30  * ============================================================================
       
    31  */
       
    32 
       
    33 #include <e32property.h>
       
    34 #include <AvkonInternalCRKeys.h>
       
    35 #include <AknFepInternalPSKeys.h>
       
    36 #include "AknFepPredictiveSettingData.h"
       
    37 
       
    38 CAknFepPredictiveSettingData *CAknFepPredictiveSettingData::NewL()
       
    39 	{
       
    40 	CAknFepPredictiveSettingData *self = CAknFepPredictiveSettingData::NewLC();
       
    41 	CleanupStack::Pop(self);
       
    42 	return self;
       
    43 	}
       
    44 
       
    45 CAknFepPredictiveSettingData *CAknFepPredictiveSettingData::NewLC()
       
    46 	{
       
    47 	CAknFepPredictiveSettingData *self = new (ELeave) CAknFepPredictiveSettingData();
       
    48 	CleanupStack::PushL(self);
       
    49 	return self;
       
    50 	}
       
    51 
       
    52 CAknFepPredictiveSettingData::~CAknFepPredictiveSettingData()
       
    53 	{
       
    54 	}
       
    55 
       
    56 CAknFepPredictiveSettingData::CAknFepPredictiveSettingData()
       
    57 	{
       
    58 	}
       
    59 
       
    60 
       
    61 
       
    62 void CAknFepPredictiveSettingData::LoadL(TInt aAutoWordCompl,
       
    63 										 TInt aTypingCorrection,
       
    64 										 TInt aNumberCandidates,
       
    65 										 TInt aPrimaryCandidate,
       
    66 										 TInt aPhysicalKeyboards,
       
    67 										 TInt aAWCBitmask)
       
    68     {
       
    69     iAutoWordCompl = aAutoWordCompl;
       
    70     iTypingCorrection = aTypingCorrection;
       
    71     iNumberCandidates = aNumberCandidates;
       
    72     iPrimaryCandidate = aPrimaryCandidate;
       
    73     iPhysicalKeyboards = aPhysicalKeyboards;
       
    74     iAWCBitmask = aAWCBitmask;
       
    75     }
       
    76     
       
    77 void CAknFepPredictiveSettingData::SaveL() const
       
    78     {
       
    79     }
       
    80 
       
    81 TPtiKeyboardType CAknFepPredictiveSettingData::ActiveKeyboardType() const
       
    82 	{    
       
    83 	TInt keyboardType = EPtiKeyboardNone;
       
    84 #ifdef RD_SCALABLE_UI_V2
       
    85 	// Get physical keyboard type
       
    86 	RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardType );
       
    87 
       
    88 	//1. When active keyboard is virtual keyboard, 
       
    89 	// need to get the active virtual keyboard type 
       
    90 	// and set keyboardType again.	
       
    91 	//2. When the default physical keyboard is 0, 
       
    92 	// it means that there is no physical keyboard,
       
    93 	// also need to get the active virtual keyboard type.
       
    94 	TInt isVirtualInputActive = 0;
       
    95 	RProperty::Get( KPSUidAknFep, KAknFepTouchInputActive, 
       
    96 					isVirtualInputActive );    
       
    97 	if ( isVirtualInputActive > 0 || keyboardType == 0 )
       
    98 		{
       
    99 		// Active keyboard is virtual keyboard          
       
   100 		RProperty::Get( KPSUidAknFep, KAknFepVirtualKeyboardType, 
       
   101 						keyboardType );      
       
   102 		}
       
   103 #else
       
   104 	// Get physical keyboard type
       
   105 	RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardType );	    
       
   106 #endif
       
   107 
       
   108 	if ( keyboardType <= 0 || keyboardType >= EPtiKeyboardMaxLayout )
       
   109 		{
       
   110 	    keyboardType = EPtiKeyboardNone;
       
   111 		}        
       
   112 	return (TPtiKeyboardType)keyboardType;
       
   113     }
       
   114 
       
   115 TPtiKeyboardType CAknFepPredictiveSettingData::OwnerKeyboardType() const
       
   116 	{
       
   117 	TInt keyboardType = EPtiKeyboardNone;
       
   118 #ifdef RD_SCALABLE_UI_V2	
       
   119 	// When dialog state is 2, it means that the setting dialog is opened
       
   120 	// for virtual qwerty keyboard, therefore, 
       
   121 	// returning value of virtual qwerty keyboard type is necessary 
       
   122 	TInt dialogState = 0;
       
   123 	RProperty::Get( KPSUidAknFep, KAknFepSettingDialogState, dialogState );    	
       
   124 	if ( dialogState == 2 )
       
   125 		{
       
   126 		// The setting dialog is opened by virtual qwerty keyboard,
       
   127 	    // then need to get current virtual keyboard type 
       
   128 	    keyboardType = EPtiKeyboardQwerty4x12;
       
   129 		}
       
   130 	else
       
   131 		{
       
   132 	    // Get physical keyboard type
       
   133 	    RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardType );	    
       
   134 		}
       
   135 #else
       
   136     // Get physical keyboard type
       
   137     RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardType );		
       
   138 #endif // RD_SCALABLE_UI_V2
       
   139 
       
   140 	if ( keyboardType <= 0 || keyboardType >= EPtiKeyboardMaxLayout )
       
   141 		{
       
   142 	    keyboardType = EPtiKeyboardNone;
       
   143 		}		
       
   144 	return (TPtiKeyboardType)keyboardType;	
       
   145 	}
       
   146 
       
   147 //EOF