104 TBool iHaveReceivedKeyEvent; |
103 TBool iHaveReceivedKeyEvent; |
105 |
104 |
106 TInt iShowAnotherTableCharCase; |
105 TInt iShowAnotherTableCharCase; |
107 TAknCharMapPictoMode iPictoMode; |
106 TAknCharMapPictoMode iPictoMode; |
108 TAknCharMapEmotionMode iEmotionMode; |
107 TAknCharMapEmotionMode iEmotionMode; |
109 |
108 TBool iFirstOrientation; |
110 private: |
|
111 NONSHARABLE_CLASS(CSubscriber) : public CActive |
|
112 { |
|
113 public: |
|
114 CSubscriber(TCallBack aCallBack, RProperty& aProperty); |
|
115 ~CSubscriber(); |
|
116 |
|
117 public: // New functions |
|
118 void SubscribeL(); |
|
119 void StopSubscribe(); |
|
120 |
|
121 private: // from CActive |
|
122 void RunL(); |
|
123 void DoCancel(); |
|
124 |
|
125 private: |
|
126 TCallBack iCallBack; |
|
127 RProperty& iProperty; |
|
128 }; |
|
129 |
|
130 private: |
|
131 CSubscriber* iQwertyModeStatusSubscriber; |
|
132 RProperty iQwertyModeStatusProperty; |
|
133 TInt iOldCharCase; |
|
134 }; |
109 }; |
135 |
110 |
136 // ----------------------------------------------------------------------------- |
111 // ----------------------------------------------------------------------------- |
137 // CAknCharMapDialogExtension::CAknCharMapDialogExtension |
112 // CAknCharMapDialogExtension::CAknCharMapDialogExtension |
138 // |
113 // |
183 // Symbian construction |
151 // Symbian construction |
184 // ----------------------------------------------------------------------------- |
152 // ----------------------------------------------------------------------------- |
185 // |
153 // |
186 void CAknCharMapDialogExtension::ConstructL() |
154 void CAknCharMapDialogExtension::ConstructL() |
187 { |
155 { |
188 // Start also listening qwerty mode status. |
156 iFirstOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
189 User::LeaveIfError(iQwertyModeStatusProperty.Attach(KCRUidAvkon, |
157 } |
190 KAknQwertyInputModeActive)); |
158 |
191 |
159 // ----------------------------------------------------------------------------- |
192 iQwertyModeStatusSubscriber = new (ELeave) CSubscriber( |
160 // CAknCharMapDialogExtension::SetCharacterCaseIfRequiredL |
193 TCallBack(QwertyModeChangeNotification, this), iQwertyModeStatusProperty); |
161 // |
194 |
162 // change the character case, when orientation changed if any. |
195 iQwertyModeStatusSubscriber->SubscribeL(); |
163 // ----------------------------------------------------------------------------- |
196 |
164 // |
197 iOldCharCase=-1; // no default character case at beginning |
165 void CAknCharMapDialogExtension::SetCharacterCaseIfRequiredL() |
198 } |
166 { |
199 |
167 TBool landscape = Layout_Meta_Data::IsLandscapeOrientation(); |
200 TInt CAknCharMapDialogExtension::QwertyModeChangeNotification(TAny* aObj) |
168 TInt charCase = EAknSCTLowerCase; |
201 { |
169 CAknCharMap* charmapControl = |
202 if (aObj != NULL) |
170 STATIC_CAST( CAknCharMap*, iCaller->Control( EAknSCTQueryContentId ) ); |
203 { |
171 |
204 static_cast<CAknCharMapDialogExtension*>(aObj)->HandleQwertyModeChangeNotification(); |
172 // Set character case logic changed from Timebox 92 PS2, if Orientation is Landscape |
205 return KErrNone; |
173 // the case will be QWERTY, otherwise it will be LOWER. However, it is possible for |
|
174 // Landscape launches LOWER case, or Poratrait does QWERTY at the first time launched, |
|
175 // in this case, we need to store the first SCT launched case. |
|
176 if ( landscape ) |
|
177 { |
|
178 iFlags |= ECharMapDialogItemLockNumericKeys; |
|
179 charCase = EAknSCTQwerty; |
206 } |
180 } |
207 else |
181 else |
208 { |
182 { |
209 return KErrArgument; |
183 iFlags &= ( ~ECharMapDialogItemLockNumericKeys ); |
210 } |
184 charCase = EAknSCTLowerCase; |
211 } |
185 } |
212 |
186 |
213 void CAknCharMapDialogExtension::SetCharacterCaseIfRequiredL() |
187 if ( landscape == iFirstOrientation ) |
214 { |
188 { |
215 TInt value = 0; |
189 // Note, it should be equal to first char case once it return |
216 iQwertyModeStatusProperty.Get(value); |
190 // to the first orientation |
217 iQwertyMode = value; |
191 charCase = iCaller->CharacterCase(); |
218 |
192 } |
219 CAknCharMap* charmapControl = |
193 charmapControl->SetCharacterCaseL( charCase ); |
220 STATIC_CAST(CAknCharMap*, iCaller->Control(EAknSCTQueryContentId)); |
194 |
221 |
|
222 if ( (iQwertyMode) == (charmapControl->CharacterCase() == EAknSCTQwerty) ) |
|
223 { |
|
224 // No change for Qwerty mode |
|
225 return; |
|
226 } |
|
227 |
|
228 if (iQwertyMode) |
|
229 { |
|
230 iFlags |= ECharMapDialogItemLockNumericKeys; |
|
231 |
|
232 iOldCharCase=charmapControl->CharacterCase(); |
|
233 charmapControl->SetCharacterCaseL(EAknSCTQwerty); |
|
234 } |
|
235 else |
|
236 { |
|
237 iFlags &= (~ECharMapDialogItemLockNumericKeys); |
|
238 if (iOldCharCase!=-1) |
|
239 { |
|
240 charmapControl->SetCharacterCaseL(iOldCharCase); |
|
241 } |
|
242 else |
|
243 { |
|
244 charmapControl->SetCharacterCaseL(EAknSCTLowerCase); |
|
245 iOldCharCase = EAknSCTLowerCase; |
|
246 } |
|
247 } |
|
248 //charmapControl->DrawNow(); |
|
249 } |
|
250 |
|
251 void CAknCharMapDialogExtension::HandleQwertyModeChangeNotification() |
|
252 { |
|
253 TInt value = 0; |
|
254 iQwertyModeStatusProperty.Get(value); |
|
255 iQwertyMode = value; |
|
256 |
|
257 CAknCharMap* charmapControl = |
|
258 STATIC_CAST(CAknCharMap*, iCaller->Control(EAknSCTQueryContentId)); |
|
259 |
|
260 if ( (iQwertyMode) == (charmapControl->CharacterCase() == EAknSCTQwerty) ) |
|
261 { |
|
262 // No change for Qwerty mode |
|
263 return; |
|
264 } |
|
265 |
|
266 if (iQwertyMode) |
|
267 { |
|
268 iFlags |= ECharMapDialogItemLockNumericKeys; |
|
269 |
|
270 iOldCharCase=charmapControl->CharacterCase(); |
|
271 TRAP_IGNORE( charmapControl->SetCharacterCaseL(EAknSCTQwerty) ); |
|
272 } |
|
273 else |
|
274 { |
|
275 iFlags &= ~ECharMapDialogItemLockNumericKeys; |
|
276 if (iOldCharCase!=-1) |
|
277 { |
|
278 TRAP_IGNORE( charmapControl->SetCharacterCaseL(iOldCharCase) ); |
|
279 } |
|
280 else |
|
281 { |
|
282 TRAP_IGNORE( charmapControl->SetCharacterCaseL(EAknSCTLowerCase) ); |
|
283 iOldCharCase = EAknSCTLowerCase; |
|
284 } |
|
285 } |
|
286 |
|
287 // Reset focus. |
|
288 charmapControl->TakeFocus(); |
|
289 |
|
290 // Draw new characters. |
|
291 charmapControl->DrawNow(); |
|
292 } |
|
293 |
|
294 // CAknCharMapDialogExtension::CSubscriber |
|
295 CAknCharMapDialogExtension::CSubscriber::CSubscriber(TCallBack aCallBack, RProperty& aProperty) |
|
296 : CActive(EPriorityNormal), iCallBack(aCallBack), iProperty(aProperty) |
|
297 { |
|
298 CActiveScheduler::Add(this); |
|
299 } |
|
300 |
|
301 CAknCharMapDialogExtension::CSubscriber::~CSubscriber() |
|
302 { |
|
303 Cancel(); |
|
304 } |
|
305 |
|
306 void CAknCharMapDialogExtension::CSubscriber::SubscribeL() |
|
307 { |
|
308 if (!IsActive()) |
|
309 { |
|
310 iProperty.Subscribe(iStatus); |
|
311 SetActive(); |
|
312 } |
|
313 } |
|
314 |
|
315 void CAknCharMapDialogExtension::CSubscriber::StopSubscribe() |
|
316 { |
|
317 Cancel(); |
|
318 } |
|
319 |
|
320 void CAknCharMapDialogExtension::CSubscriber::RunL() |
|
321 { |
|
322 if (iStatus.Int() == KErrNone) |
|
323 { |
|
324 iCallBack.CallBack(); |
|
325 SubscribeL(); |
|
326 } |
|
327 } |
|
328 |
|
329 void CAknCharMapDialogExtension::CSubscriber::DoCancel() |
|
330 { |
|
331 iProperty.Cancel(); |
|
332 } |
195 } |
333 |
196 |
334 // CAknCharMapDialog |
197 // CAknCharMapDialog |
335 EXPORT_C CAknCharMapDialog::CAknCharMapDialog(TInt aCharCase, TDes& aSpecialChars, TInt aCharSetResourceId) : |
198 EXPORT_C CAknCharMapDialog::CAknCharMapDialog(TInt aCharCase, TDes& aSpecialChars, TInt aCharSetResourceId) : |
336 iSpecialChars(&aSpecialChars), iCharCase(aCharCase), iCharSetResourceId(aCharSetResourceId) |
199 iSpecialChars(&aSpecialChars), iCharCase(aCharCase), iCharSetResourceId(aCharSetResourceId) |
535 /// -- Change Window Priority for dialog and CBA |
397 /// -- Change Window Priority for dialog and CBA |
536 |
398 |
537 DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); // |
399 DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); // |
538 ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); |
400 ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); |
539 |
401 |
540 CEikDialog::Extension()->SetPriority(CActive::EPriorityStandard); |
402 // Boost its priority in GlobalPopupPriorityController queue, because its window priority is higher than zero, |
|
403 // otherwise, GlobalPopupPriorityController will dim it wrongly. |
|
404 // This code only effects for aknnfysrv.exe, since input server doesn't have GlobalPopupPriorityController instance. |
|
405 AknGlobalPopupPriorityController::SetPopupPriorityL(*this, 1); |
|
406 |
|
407 CEikDialog::Extension()->SetPriority(CActive::EPriorityStandard); |
541 } |
408 } |
542 |
409 |
543 EXPORT_C void CAknCharMapDialog::SetSizeAndPosition( const TSize& aSize ) |
410 EXPORT_C void CAknCharMapDialog::SetSizeAndPosition( const TSize& aSize ) |
544 { |
411 { |
545 if ( AknLayoutUtils::PenEnabled() ) |
412 if ( AknLayoutUtils::PenEnabled() ) |