62
|
1 |
/*
|
|
2 |
* Copyright (c) 2009, 2010 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: Helper class to handle virtual keypad text labels
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CDIALERKEYPADLABELMANAGER_H
|
|
19 |
#define CDIALERKEYPADLABELMANAGER_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <e32std.h>
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <badesca.h>
|
|
25 |
#include "cdialercenrepwrapper.h"
|
|
26 |
|
|
27 |
|
|
28 |
// FORWARD DECLARATIONS
|
|
29 |
class CCoeEnv;
|
|
30 |
class CPtiEngine;
|
|
31 |
class CEnvironmentChangeNotifier;
|
|
32 |
|
|
33 |
|
|
34 |
// CALLBACK INTERFACE
|
|
35 |
NONSHARABLE_CLASS( MDialerKeyPadLabelManagerCallback )
|
|
36 |
{
|
|
37 |
public:
|
|
38 |
/**
|
|
39 |
* This event is given when change in system settings has
|
|
40 |
* caused key label texts to change. All the TPtrC descriptors
|
|
41 |
* previously returned by CDialerKeyPadLabelManager become
|
|
42 |
* dangling references when this happens and they must not
|
|
43 |
* be used after this method is called.
|
|
44 |
*/
|
|
45 |
virtual void KeyLabelsChanged() = 0;
|
|
46 |
};
|
|
47 |
|
|
48 |
|
|
49 |
// CLASS DECLARATION
|
|
50 |
|
|
51 |
/**
|
|
52 |
* CDialerKeyPadLabelManager
|
|
53 |
*
|
|
54 |
*/
|
|
55 |
NONSHARABLE_CLASS( CDialerKeyPadLabelManager ) : public CBase, public MDialerCenRepObserver
|
|
56 |
{
|
|
57 |
public: // Constructors and destructor
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Destructor.
|
|
61 |
*/
|
|
62 |
~CDialerKeyPadLabelManager();
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Two-phased constructor.
|
|
66 |
*/
|
|
67 |
static CDialerKeyPadLabelManager* NewL( CCoeEnv& aCoeEnv,
|
|
68 |
MDialerKeyPadLabelManagerCallback& aObserver );
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Two-phased constructor.
|
|
72 |
*/
|
|
73 |
static CDialerKeyPadLabelManager* NewLC( CCoeEnv& aCoeEnv,
|
|
74 |
MDialerKeyPadLabelManagerCallback& aObserver );
|
|
75 |
|
|
76 |
private: // consturctors
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Constructor for performing 1st stage construction
|
|
80 |
*/
|
|
81 |
CDialerKeyPadLabelManager( CCoeEnv& aCoeEnv,
|
|
82 |
MDialerKeyPadLabelManagerCallback& aObserver );
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Symbian default constructor for performing 2nd stage construction
|
|
86 |
*/
|
|
87 |
void ConstructL();
|
|
88 |
|
|
89 |
public: // methods
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Get number label for the button.
|
|
93 |
* @return Reference to the number text in current global number mode.
|
|
94 |
* The reference is valid until this label manager is deleted or
|
|
95 |
* global number mode is changed. Callback KeyLabelsChanged()
|
|
96 |
* is given to observer in the latter case.
|
|
97 |
*/
|
|
98 |
TPtrC ButtonNumLabel( TInt aIndex ) const;
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Get first row alphabet label for the button
|
|
102 |
* @return Reference to descriptor containing text for the first
|
|
103 |
* row of alphabets to be shown on the key. The reference is
|
|
104 |
* valid until this label manager is deleted or input language
|
|
105 |
* is changed. Callback KeyLabelsChanged()
|
|
106 |
* is given to observer in the latter case.
|
|
107 |
*/
|
|
108 |
TPtrC ButtonFirstAlphaLabel( TInt aIndex ) const;
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Get second row alphabet label for the button
|
|
112 |
* @return Reference to descriptor containing text for the first
|
|
113 |
* row of alphabets to be shown on the key. The reference is
|
|
114 |
* valid until this label manager is deleted or input language
|
|
115 |
* is changed. Callback KeyLabelsChanged()
|
|
116 |
* is given to observer in the latter case.
|
|
117 |
*/
|
|
118 |
TPtrC ButtonSecondAlphaLabel( TInt aIndex ) const;
|
|
119 |
|
|
120 |
public: // from MDialerCenRepObserver
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Handle change in one of the observed repositories.
|
|
124 |
*/
|
|
125 |
void HandleRepositoryChange( TUid aRepository, TUint32 aId );
|
|
126 |
|
|
127 |
private: // methods
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Handle environment change event. We are interested about digit
|
|
131 |
* type changes in locale data.
|
|
132 |
*/
|
|
133 |
void HandleEnvChange();
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Static wrapper for HandleEnvChange() function to be passed in TCallBack object.
|
|
137 |
*/
|
|
138 |
static TInt EnvChangeCallback( TAny* aSelfPtr );
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Update button text labels to match current input and UI language.
|
|
142 |
*/
|
|
143 |
void UpdateTextLabelsL();
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Update button number labels to use current global number mode.
|
|
147 |
*/
|
|
148 |
void UpdateNumLabelsL();
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Get the full path of the keypad resource file to be used in current situation.
|
|
152 |
* @param aFileName On return, contains the file name. Caller is responsible
|
|
153 |
* of supplying large enough buffer. Maximum path length
|
|
154 |
* in Symbian is 256 characters.
|
|
155 |
*/
|
|
156 |
void GetResourceFileNameL( TDes& aFileName );
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Returns code of the script to be used in current situation.
|
|
160 |
* It depends on the current input language, current UI language, and all
|
|
161 |
* available input languages on the device.
|
|
162 |
*/
|
|
163 |
TInt LabelScriptToUseL() const;
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Returns code of the Chinese script to be used in key labels.
|
|
167 |
* This depends on the currently active Chinese adaptive search mode.
|
|
168 |
* This should be used only when current input language is Chinese.
|
|
169 |
*/
|
|
170 |
TInt ChineseScriptToUseL() const;
|
|
171 |
|
|
172 |
private: // data
|
|
173 |
|
|
174 |
/** Control environment to use for resource management */
|
|
175 |
CCoeEnv& iCoeEnv;
|
|
176 |
|
|
177 |
/** Observer is notified when keypad labels are changed */
|
|
178 |
MDialerKeyPadLabelManagerCallback& iObserver;
|
|
179 |
|
|
180 |
/** PtiEngine instance is needed to find out available input languages */
|
|
181 |
CPtiEngine* iPtiEngine;
|
|
182 |
|
|
183 |
/** AknFep repository stores the current input language */
|
|
184 |
CDialerCenRepWrapper* iAknFepRepository;
|
|
185 |
|
|
186 |
/** Avkon repository stores the current Chinese matching mode */
|
|
187 |
CDialerCenRepWrapper* iAvkonRepository;
|
|
188 |
|
|
189 |
/** Helper to observe locale changes. Locale data contains digit type used for number labels. */
|
|
190 |
CEnvironmentChangeNotifier* iEnvChangeNotifier;
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Array of number labels. Indexing matches that of the
|
|
194 |
* CDialerKeypadContainer::iButtons array. Owned.
|
|
195 |
*/
|
|
196 |
CDesCArray* iKeypadNumLabelArray;
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Array of first row alphabet labels. Indexing matches that of the
|
|
200 |
* CDialerKeypadContainer::iButtons array. Owned.
|
|
201 |
*/
|
|
202 |
CDesCArray* iKeypadFirstLabelArray;
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Array of second row alphabet labels. Indexing matches that of the
|
|
206 |
* CDialerKeypadContainer::iButtons array. Owned.
|
|
207 |
*/
|
|
208 |
CDesCArray* iKeypadSecondLabelArray;
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Offset value of currently loaded keypad resource.
|
|
212 |
* 0 if there's no loaded resource.
|
|
213 |
*/
|
|
214 |
TInt iResourceOffset;
|
|
215 |
|
|
216 |
/** Script ID of the current keypad labels */
|
|
217 |
TInt iLabelScriptInUse;
|
|
218 |
|
|
219 |
/** Digit type currently used for keypad number labels */
|
|
220 |
TDigitType iDigitTypeInUse;
|
|
221 |
};
|
|
222 |
|
|
223 |
#endif // CDIALERKEYPADLABELMANAGER_H
|
|
224 |
|