|
1 /* |
|
2 * Copyright (c) 2005 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: Data model for GSLangPlugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef GSLANGMODEL_H |
|
19 #define GSLANGMODEL_H |
|
20 |
|
21 // INCLUDES |
|
22 #include "GSLangPlugin.hrh" |
|
23 |
|
24 #include <backgroundimage.h> |
|
25 #include <badesca.h> |
|
26 #include <bldvariant.hrh> |
|
27 #include <centralrepository.h> |
|
28 #include <cenrepnotifyhandler.h> |
|
29 #include <e32base.h> |
|
30 #include <generalsettingsvariant.hrh> |
|
31 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
32 #include <PtiDefs.h> |
|
33 #endif |
|
34 //class CCommsDatabase; |
|
35 class CGSLangContainer; |
|
36 |
|
37 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
38 class CCoeEnv; |
|
39 #endif |
|
40 |
|
41 // CONSTANTS |
|
42 const TInt KGSLanguageMask = 0x03FF; |
|
43 const TInt KGSPredTxtFlagDefault = 1; // Default ON |
|
44 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
45 const TInt KGSPredTxtBitMaskDefault = 0xFFFF; |
|
46 #endif |
|
47 |
|
48 // For switching values in SwitchValue() |
|
49 const TInt KGSSettingOff = 0; |
|
50 |
|
51 _LIT( KGSWelcomeNoteImgPath, "c:\\resource\\apps\\welcomeimage.mbm" ); |
|
52 |
|
53 // Multitap timer default value |
|
54 const TInt KGSMultiTapTimerDefault = 1000000; // 1.0sec |
|
55 // Japanese Special Char Flag default value |
|
56 const TInt KGSJapaneseSpecialCharFlagDefault = 0x000F; |
|
57 |
|
58 /** |
|
59 * Data model for GSLangPlugin. |
|
60 * @lib GSLangPlugin.dll |
|
61 * @since Series60 3.1 |
|
62 */ |
|
63 class CGSLangModel : public CBase, |
|
64 public MCenRepNotifyHandlerCallback |
|
65 { |
|
66 public: // Constructor and destructor |
|
67 /** |
|
68 * Two-phased constructor |
|
69 */ |
|
70 static CGSLangModel* NewL( CGSLangContainer* aContainer ); |
|
71 |
|
72 /** |
|
73 * Destructor |
|
74 */ |
|
75 ~CGSLangModel(); |
|
76 |
|
77 public: // Enums |
|
78 enum TLanguage |
|
79 { |
|
80 // Phone language |
|
81 EGSUiLanguage, |
|
82 // Writing language |
|
83 EGSInputLanguage |
|
84 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
85 #ifdef FF_DUAL_LANGUAGE_SUPPORT |
|
86 // Secondary writing language |
|
87 ,EGSInputLanguageSecondary |
|
88 #endif |
|
89 #endif |
|
90 }; |
|
91 |
|
92 enum TPredictiveType |
|
93 { |
|
94 // Japanese predictive |
|
95 EGSLangJapanese, |
|
96 // predictive for other (common) languages |
|
97 EGSLangOther |
|
98 }; |
|
99 public: // New |
|
100 |
|
101 /** |
|
102 * Get the list of supported languages from PTIEngine |
|
103 * @param aInstalledLangCodes array of installed lang codes |
|
104 * from SysLangUtil |
|
105 * @param aSeedLanguages array of Pti Language codes |
|
106 * @param aLanguageNames array for language names |
|
107 * |
|
108 * @since 2.6 |
|
109 */ |
|
110 void GetLanguagesFromPtiL( |
|
111 CArrayFix<TInt>* aInstalledLangCodes, |
|
112 CArrayFix<TInt>* aSeedLanguages, |
|
113 CDesCArray* aLanguageNames ); |
|
114 |
|
115 /** |
|
116 * Display/Input Text Language Selection. |
|
117 * @param aType Language type (UI/Input) |
|
118 * Returns language value(Symbian OS value) from HAL, or from CenRep |
|
119 * in some special cases. |
|
120 * @return 0: Automatic |
|
121 * 1: English |
|
122 * 2: French |
|
123 * 3. German |
|
124 * 4. Spanish |
|
125 * 5. Italian |
|
126 * 6. Swedish |
|
127 * 7. Danish |
|
128 * 8. Norwegian |
|
129 * 9. Finnish |
|
130 * 13. Portuguese |
|
131 * 14. Turkish |
|
132 * 15. Icelandic |
|
133 * 16. Russian |
|
134 * 17. Hungarian |
|
135 * 18. Dutch |
|
136 * 25. Czech |
|
137 * 26. Slovak |
|
138 * 27. Polish |
|
139 * 28. Slovenian |
|
140 * 39. Tagalog |
|
141 * 42. Bulgarian |
|
142 * 45. Croatian |
|
143 * 49. Estonian |
|
144 * 54. Greek |
|
145 * 59. Indonesian |
|
146 * 67. Latvian |
|
147 * 68. Lithuanian |
|
148 * 70: Malaysia |
|
149 * 78. Romanian |
|
150 * 79. Serbian |
|
151 * 93: Ukrainian |
|
152 */ |
|
153 TInt LanguageL( TLanguage aType ); |
|
154 |
|
155 /** |
|
156 * Set Display/Input Text Language value to HAL and/or CenRep |
|
157 * @param aType Language type (UI/Input) |
|
158 * @param aLanguage Symbian OS Value of Display Text Language. |
|
159 * |
|
160 * @return ETrue: no errors |
|
161 * EFalse: an error has occurred |
|
162 */ |
|
163 TBool SetLanguageL( TLanguage aType, TInt aLanguage ); |
|
164 |
|
165 /** |
|
166 * Predictive Text Language selection. |
|
167 * Get setting value from CenRep |
|
168 * @param aPredictive Japanese/Other |
|
169 * @return 0: Off |
|
170 * 1: On |
|
171 */ |
|
172 TInt PredictiveOnOff( TPredictiveType aPredictive ); |
|
173 |
|
174 /** |
|
175 * Set Predictive Text Lanuage value to CenRep |
|
176 * @param aPredictive Japanese/Other |
|
177 * @param aMode OnOff Value of T9/FEP |
|
178 * |
|
179 * @return ETrue: no errors |
|
180 * EFalse: an error has occurred |
|
181 */ |
|
182 TBool SetPredictiveOnOff( TPredictiveType aPredictive, TInt aMode ); |
|
183 |
|
184 /* |
|
185 * Returns Bool value according to predictive dictionary availability. |
|
186 * PTI Engine used for lang avaibility retrieving |
|
187 * @return ETrue: no errors |
|
188 * EFalse: an error has occurred |
|
189 * @since 2.6 |
|
190 */ |
|
191 TBool CheckDictionaryFromPtiL(TInt aLangCode, TBool aCheckEngine = EFalse); |
|
192 |
|
193 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
194 /* |
|
195 * Returns Bool value according to predictive dictionary availability. |
|
196 * PTI Engine used for lang avaibility retrieving |
|
197 * @return ETrue: no errors |
|
198 * EFalse: an error has occurred |
|
199 */ |
|
200 TBool CheckT9FromPtiLForPredictionL(TPtiEngineInputMode inputMode = EPtiEngineInputModeNone, TInt aLangCode = 0); |
|
201 #endif |
|
202 |
|
203 /* Gets default number mode when arabic language is used. |
|
204 * @param aNbrModeType number mode type from GSLangPlugin.hrh |
|
205 * @return TInt corresponding value in language variant |
|
206 */ |
|
207 TInt DefaultNumberMode( TInt aNbrModeType ); |
|
208 |
|
209 /* Sets default number mode when arabic language is used. |
|
210 * @param aMode either Latin or Arabic |
|
211 * @param aNbrModeType number mode type from GSLangPlugin.hrh |
|
212 */ |
|
213 void SetDefaultNumberMode( TInt aMode, TInt aNbrModeType ); |
|
214 |
|
215 /* |
|
216 * Default Input Method Selection. |
|
217 * Returns input method value(In Hexadecimal value) from CenRep. |
|
218 * @return 0x10: (Pinyin) |
|
219 * 0x20: (Zhuyin) |
|
220 * 0x40: (Stroke) |
|
221 * 0x80: (Latin Upper Case) |
|
222 * 0x100: (Latin Lower Case) |
|
223 */ |
|
224 TInt DefaultInputMethodL(); |
|
225 |
|
226 /* |
|
227 * Sets default Input Method. |
|
228 * @param aMethod Permanent input method . |
|
229 */ |
|
230 void SetDefaultInputMethodL( TInt aMethod ); |
|
231 |
|
232 /** |
|
233 * Predictive On/Off |
|
234 * @param |
|
235 * @param |
|
236 */ |
|
237 void ChangePredictiveOnOffSettingL( TBool aShowOnOffSettingPage, |
|
238 TPredictiveType aPredictive ); |
|
239 |
|
240 /** |
|
241 * Shows predictive setting page. |
|
242 */ |
|
243 TBool ShowPredictiveOnOffSettingPageL( TInt& aOnOffcurrent ); |
|
244 |
|
245 /** |
|
246 * Checks call state. |
|
247 */ |
|
248 TInt CheckCallStateL(); |
|
249 |
|
250 /** |
|
251 * Keypress timeout (means Multitap timer). |
|
252 * Get setting value |
|
253 * @since 3.0 |
|
254 * @return milli second |
|
255 * |
|
256 */ |
|
257 TInt KeypressTimeout(); |
|
258 |
|
259 /** |
|
260 * Set Keypress timeout value to CenRep |
|
261 * Keypress timeout value means Multitap timer. |
|
262 * @since 3.0 |
|
263 * @param aMilliSecond |
|
264 * @return ETrue: no errors |
|
265 * EFalse: an error has occurred |
|
266 */ |
|
267 TBool SetKeypressTimeout( TInt aMilliSecond ); |
|
268 |
|
269 /** |
|
270 * Japanese qwerty specific flags. |
|
271 * Get setting value of each apanese qwerty specific flags |
|
272 * @since 3.0 |
|
273 * @param aFlag one of flag is set |
|
274 * @return TBool ON/OFF or Full/Half-width |
|
275 * (Flags) : (Arguments) : (Return value) |
|
276 * Comma : EGSJapQwertyFlagComma : ETrue-Japanese comma |
|
277 * Period : EGSJapQwertyFlagPeriod : ETrue-Japanese period |
|
278 * Width Of Space : EGSJapQwertyFlagSpaceFullWidth : ETrue-Full width |
|
279 */ |
|
280 TBool JapanQwertyFlags( const TGSJapQwertyFlags aFlag ); |
|
281 |
|
282 /** |
|
283 * Set Keypress timeout value to CenRep |
|
284 * Set value of each Japanese qwerty specific flags |
|
285 * @since 3.0 |
|
286 * @param aFlag one of flag is set |
|
287 * @param aValue is set ON/OFF |
|
288 * @return ETrue: no errors |
|
289 * EFalse: an error has occurred |
|
290 */ |
|
291 TBool SetJapanQwertyFlags( const TGSJapQwertyFlags aFlag, |
|
292 TBool aValue ); |
|
293 |
|
294 /** |
|
295 * Get Chinese CangJie input method value |
|
296 * @return currently selected setting page index |
|
297 */ |
|
298 TInt ChiCangJieInputL(); |
|
299 |
|
300 /** |
|
301 * Set Chinese CangJie input method value |
|
302 * @param newly selected setting page index |
|
303 */ |
|
304 void SetChiCangJieInputL( TInt aMode ); |
|
305 |
|
306 /** |
|
307 * Check if Chinese Cangjie input is supported |
|
308 * @param newly selected setting page index |
|
309 */ |
|
310 TBool CheckCangjieSupportL( TInt aLangCode ); |
|
311 |
|
312 /* |
|
313 * Get Predictive mode value |
|
314 * 0 --> Normal |
|
315 * 1 --> Autocompletion |
|
316 * @return currently selected setting page index |
|
317 */ |
|
318 TInt PredictiveModeL(); |
|
319 |
|
320 /* |
|
321 * Set Predictive mode value |
|
322 * 0 --> Normal |
|
323 * 1 --> Autocompletion |
|
324 * @param newly selected setting page index |
|
325 */ |
|
326 void SetPredictiveModeL( TInt aMode ); |
|
327 |
|
328 /* |
|
329 * Checks free disk space on device for language switch |
|
330 * @return ETrue if there is not enough free space |
|
331 * @return EFalse if there is enough free space |
|
332 */ |
|
333 TBool CheckDiskSpaceL(); |
|
334 |
|
335 /* |
|
336 * Checks for autoword completion feature support |
|
337 * @return ETrue if supported |
|
338 * @return EFalse if not supported |
|
339 */ |
|
340 TBool CheckAutoWordCompletionSupportL(); |
|
341 |
|
342 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
343 /* |
|
344 * Checks for multiple keyboards |
|
345 * @return ETrue if device has multiple keyboards |
|
346 * @return EFalse if device has one keyboard |
|
347 */ |
|
348 TBool DeviceHasMultipleKeyboardsL(); |
|
349 |
|
350 TInt PredictionBitMaskL(); |
|
351 |
|
352 void SetPredictionBitMaskL(TInt aBitMask); |
|
353 |
|
354 TInt PhysicalKeyboardsL(); |
|
355 |
|
356 /** |
|
357 * Get the list of supported secondary input languages |
|
358 * Some input languages will not be on this list, e.g. |
|
359 * Chinese, Japanese etc. |
|
360 * @param aSeedLanguages array of Pti Language codes |
|
361 * @param aLanguageNames array for language names |
|
362 * |
|
363 * @since 3.2 |
|
364 */ |
|
365 void GetSecondaryInputLanguagesL( |
|
366 CArrayFix<TInt>* aSeedLanguages, |
|
367 CDesCArray* aLanguageNames, |
|
368 CCoeEnv* aCoeEnv); |
|
369 #endif |
|
370 |
|
371 private: // from MCenRepNotifyHandlerCallback |
|
372 void HandleNotifyInt( TUint32 aId, TInt aNewValue ); |
|
373 |
|
374 private: // Private constructors |
|
375 |
|
376 /** |
|
377 * Default C++ contructor |
|
378 */ |
|
379 CGSLangModel( CGSLangContainer* aContainer ); |
|
380 |
|
381 /** |
|
382 * Symbian OS default constructor |
|
383 * @return void |
|
384 */ |
|
385 void ConstructL(); |
|
386 |
|
387 private: |
|
388 void InitializeCentralRepositoriesL(); |
|
389 void CloseCentralRepositories(); |
|
390 void HandleCenrepValueChangedL( TUint32 aId ); |
|
391 |
|
392 private: // Data |
|
393 |
|
394 // Pointer to container. Not owned. |
|
395 CGSLangContainer* iContainer; |
|
396 |
|
397 CRepository* iAknFepRepository; |
|
398 CRepository* iCommonEngineRepository; |
|
399 CRepository* iPersonalizationRepository; |
|
400 CRepository* iLocaleRepository; |
|
401 CRepository* iStartupConfRepository; |
|
402 CRepository* iScreensaverRepository; |
|
403 // CenRep notify handler for input language |
|
404 CCenRepNotifyHandler* iNotifyHandlerForITL; |
|
405 // CenRep notify handler for dictionary |
|
406 CCenRepNotifyHandler* iNotifyHandlerForT9; |
|
407 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
408 // CenRep notify handler for prediction extension |
|
409 CCenRepNotifyHandler* iNotifyHandlerForPredExt; |
|
410 #endif |
|
411 // CenRep notify handler for Japanese predictive mode |
|
412 CCenRepNotifyHandler* iNotifyHandlerForJapanesePredTxt; |
|
413 }; |
|
414 |
|
415 |
|
416 #endif // GSLANGMODEL_H |
|
417 // End of File |