|
1 /* |
|
2 * Copyright (c) 2002-2008 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 #include "aknenv.h" |
|
19 #include "AknUtils.h" |
|
20 #include "aknEditStateIndicator.h" |
|
21 #include "AknSgcc.h" |
|
22 #include "AknSettingCache.h" |
|
23 |
|
24 #include <apgtask.h> |
|
25 #include <aknintermediate.h> |
|
26 #include <coeaui.h> |
|
27 #include <coemain.h> |
|
28 #include <AknQueryDialog.h> |
|
29 #include <aknnotewrappers.h> |
|
30 #include <eikfrlb.h> |
|
31 #include <eikfrlbd.h> |
|
32 #include <aknPopup.h> |
|
33 #include <aknlists.h> |
|
34 #include <eiklbv.h> |
|
35 #include <eiklbi.h> |
|
36 #include <AknWaitDialog.h> |
|
37 #include <AknLayout.lag> |
|
38 #include <bidivisual.h> |
|
39 #include <aknconsts.h> |
|
40 #include <AknBidiTextUtils.h> |
|
41 #include <CdlEngine.h> |
|
42 #include <CdlRefs.h> |
|
43 #include <AknLayout2DataDef.h> |
|
44 #include <LayoutPack.cdl.h> |
|
45 #include <CdlExplorer.h> |
|
46 #include <aknlayout.cdl.h> |
|
47 #include <aknapaclayout.cdl.h> |
|
48 #include <applayout.cdl.h> |
|
49 #include <appapaclayout.cdl.h> |
|
50 #include <skinlayout.cdl.h> |
|
51 #include <cdlfont.cdl.h> |
|
52 #include "AknFontRegistry.h" |
|
53 #include <barsread.h> |
|
54 #include <AknPriv.hrh> |
|
55 #include <aknlayoutscalable_apps.cdl.h> |
|
56 #include <aknlayoutscalable_avkon.cdl.h> |
|
57 #include <layoutmetadata.cdl.h> |
|
58 #include <featmgr.h> |
|
59 #include <AknIconSrvClient.h> |
|
60 #include <AknServerApp.h> |
|
61 #include <AknFontSpecification.h> |
|
62 |
|
63 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
64 #include <uikon/eikenvinterface.h> |
|
65 #endif |
|
66 // Needed to use MopGetObject |
|
67 #include <coemop.h> |
|
68 |
|
69 #include <e32property.h> |
|
70 #include <UikonInternalPSKeys.h> // KUikLayoutState |
|
71 #include <AvkonInternalCRKeys.h> // KAknQwertyInputModeActive |
|
72 #include "AknDebug.h" |
|
73 #include <coecntss.h> // CCoeControlStaticSettings |
|
74 #include <coefont.h> // For font size indices |
|
75 #include <AknLayoutConfig.h> |
|
76 |
|
77 #define APPLY_CONE_FONT_EXTRA_LARGE_FACTOR(a) ( a * 4 / 3 ) |
|
78 #define APPLY_CONE_FONT_EXTRA_SMALL_FACTOR(a) ( a * 3 / 4 ) |
|
79 |
|
80 #include "transitionmanager.h" |
|
81 #include<akntranseffect.h> // for Transition effect enumerations |
|
82 |
|
83 // TAknLayoutConfigScreenMode is defined like this because |
|
84 // the name CAknLayoutConfig::TScreenMode can't be used |
|
85 // in SDK header files (AknEnv.h). This technique essentially |
|
86 // gives us an alternative name for CAknLayoutConfig::TScreenMode, |
|
87 // which can be used in a public header. |
|
88 class TAknLayoutConfigScreenMode : public CAknLayoutConfig::TScreenMode |
|
89 { |
|
90 public: |
|
91 TAknLayoutConfigScreenMode(const CAknLayoutConfig::TScreenMode& aCopy) |
|
92 : CAknLayoutConfig::TScreenMode(aCopy) |
|
93 { |
|
94 } |
|
95 }; |
|
96 |
|
97 |
|
98 // CAknCommandMediator is an internal class for mediating MSK commands from |
|
99 // CBA to specified observer. |
|
100 NONSHARABLE_CLASS( CAknCommandMediator ) |
|
101 : public CBase, |
|
102 public MEikCommandObserver |
|
103 { |
|
104 public: |
|
105 CAknCommandMediator() {}; |
|
106 ~CAknCommandMediator(); |
|
107 void SetCbaObserverL( CEikButtonGroupContainer& aCba, |
|
108 MEikCommandObserver& aCommandObserver ); |
|
109 void InformCbaDeletion( CEikButtonGroupContainer& aCba ); |
|
110 void RemoveCbaObserver( MEikCommandObserver& aCommandObserver ); |
|
111 |
|
112 // From MEikCommandObserver |
|
113 void ProcessCommandL( TInt aCommandId ); |
|
114 |
|
115 private: |
|
116 |
|
117 CEikButtonGroupContainer *iCba; |
|
118 MEikCommandObserver* iCommandObserver; |
|
119 }; |
|
120 |
|
121 |
|
122 CAknCommandMediator::~CAknCommandMediator() |
|
123 { |
|
124 // These should already be deleted when CAknEnv is being deleted. |
|
125 iCba = NULL; |
|
126 iCommandObserver = NULL; |
|
127 } |
|
128 |
|
129 |
|
130 void CAknCommandMediator::ProcessCommandL( TInt aCommandId ) |
|
131 { |
|
132 __ASSERT_DEBUG( iCommandObserver, User::Invariant() ); |
|
133 if ( iCommandObserver ) |
|
134 { |
|
135 // Mediate event to the observer. |
|
136 iCommandObserver->ProcessCommandL( aCommandId ); |
|
137 } |
|
138 } |
|
139 |
|
140 void CAknCommandMediator::SetCbaObserverL( CEikButtonGroupContainer& aCba, |
|
141 MEikCommandObserver& aCommandObserver ) |
|
142 { |
|
143 // Remove mediator from observing the previously set cba. |
|
144 if ( iCba && iCba != &aCba ) |
|
145 { |
|
146 iCba->RemoveCommandObserver( 3 ); |
|
147 |
|
148 iCba = NULL; |
|
149 iCommandObserver = NULL; |
|
150 } |
|
151 |
|
152 // Update command observer. |
|
153 if ( &aCba && &aCommandObserver ) |
|
154 { |
|
155 aCba.UpdateCommandObserverL( 3, *this ); |
|
156 |
|
157 iCba = &aCba; |
|
158 iCommandObserver = &aCommandObserver; |
|
159 } |
|
160 } |
|
161 |
|
162 void CAknCommandMediator::InformCbaDeletion( CEikButtonGroupContainer& aCba ) |
|
163 { |
|
164 // Check whether the cba, for which the commands are being mediated, |
|
165 // is being deleted. |
|
166 if ( iCba == &aCba ) |
|
167 { |
|
168 iCba = NULL; |
|
169 iCommandObserver = NULL; |
|
170 } |
|
171 } |
|
172 |
|
173 void CAknCommandMediator::RemoveCbaObserver( |
|
174 MEikCommandObserver& aCommandObserver ) |
|
175 { |
|
176 if ( iCommandObserver && iCommandObserver == &aCommandObserver ) |
|
177 { |
|
178 __ASSERT_DEBUG( iCba, User::Invariant() ); |
|
179 iCba->RemoveCommandObserver( 3 ); |
|
180 |
|
181 iCba = NULL; |
|
182 iCommandObserver = NULL; |
|
183 } |
|
184 } |
|
185 |
|
186 |
|
187 // const TInt KAknEnvScrollHostGranularity = 1; |
|
188 const TInt KInitialRunInfoArraySize = 5; |
|
189 const TInt KAknEnvNoScreenModeLoaded = -1; |
|
190 |
|
191 // Avkon Color support |
|
192 const TUint8 ColorRemapTable[256] = |
|
193 { |
|
194 0xff, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
|
195 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, |
|
196 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, |
|
197 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, |
|
198 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, |
|
199 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, |
|
200 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, |
|
201 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, |
|
202 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, |
|
203 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, |
|
204 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, |
|
205 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, |
|
206 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, |
|
207 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, |
|
208 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, |
|
209 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xd7 |
|
210 }; |
|
211 |
|
212 EXPORT_C void CAknEnv::SetFepMenuObserver(MEikMenuObserver* aObserver) |
|
213 { |
|
214 iFepMenuObserver = aObserver; |
|
215 } |
|
216 |
|
217 EXPORT_C MEikMenuObserver* CAknEnv::FepMenuObserver() |
|
218 { |
|
219 return iFepMenuObserver; |
|
220 } |
|
221 |
|
222 EXPORT_C MAknEditingStateIndicator* CAknEnv::EditingStateIndicator() |
|
223 { |
|
224 return iEditStateIndicator; |
|
225 } |
|
226 |
|
227 EXPORT_C MAknEditingStateIndicator* CAknEnv::SwapEditingStateIndicator(MAknEditingStateIndicator* aIndicator) |
|
228 { |
|
229 MAknEditingStateIndicator* indicator = iEditStateIndicator; |
|
230 iEditStateIndicator = aIndicator; |
|
231 return indicator; |
|
232 } |
|
233 |
|
234 EXPORT_C void CAknEnv::ExitForegroundAppL() |
|
235 { |
|
236 RWsSession& wsSession=CEikonEnv::Static()->WsSession(); |
|
237 TInt count=wsSession.NumWindowGroups(0); |
|
238 CArrayFixFlat<TInt>* wgIds=new(ELeave) CArrayFixFlat<TInt>(count); |
|
239 CleanupStack::PushL(wgIds); |
|
240 // Get list of window group ids from WServ |
|
241 wsSession.WindowGroupList(0,wgIds); |
|
242 // Select the first in the list (which will always be the forground app) |
|
243 TInt wgId = (*wgIds)[0]; |
|
244 CleanupStack::PopAndDestroy(); // wgIds; |
|
245 |
|
246 // Exit app |
|
247 TApaTask task(wsSession); |
|
248 task.SetWgId(wgId); |
|
249 task.SendSystemEvent(EApaSystemEventShutdown); |
|
250 } |
|
251 |
|
252 |
|
253 |
|
254 EXPORT_C CAknEnv::CAknEnv() : iWsBufferRequestArray( 1 ), iLastScreenMode(KAknEnvNoScreenModeLoaded) |
|
255 { |
|
256 } |
|
257 |
|
258 EXPORT_C void CAknEnv::ConstructL() |
|
259 { |
|
260 TName threadName=RThread().Name(); |
|
261 TBool isEiksrvThread=(threadName.CompareC(EIKAPPUI_SERVER_THREAD_NAME)==KErrNone); |
|
262 |
|
263 User::LeaveIfError( RAknIconSrvClient::Connect() ); |
|
264 |
|
265 iCdlEngRef = CdlEngine::CreateCdlEngineL(); |
|
266 |
|
267 iSettingCache = CAknSettingCache::NewL(); |
|
268 |
|
269 //if KFeatureIdUiTransitionEffects is not supported, CTransitionManager::NewL returns NULL |
|
270 iTransitionManager = CTransitionManager::NewL( *iCoeEnv ); |
|
271 |
|
272 iStateArray = new(ELeave) CArrayPtrFlat<MAknIntermediateState>(1); |
|
273 CAknSgcClient::CreateL(); // owned by CCoeStatic system |
|
274 TAknPopupFader::CreateStaticL(); // owned by CCoeStatic system |
|
275 |
|
276 iRunInfoArray = new( ELeave ) |
|
277 TBidirectionalState::TRunInfo[KInitialRunInfoArraySize]; |
|
278 |
|
279 iRunInfoArrayLength = KInitialRunInfoArraySize; |
|
280 |
|
281 SetLayoutRequirementsL(); |
|
282 LoadAknLayoutL(); |
|
283 AssertLayoutLoaded(); |
|
284 iLayout = &AknLayout::CustomisationInstance(); |
|
285 |
|
286 // Set the current feature language |
|
287 if (FeatureManager::FeatureSupported(KFeatureIdJapanese)) |
|
288 { |
|
289 iFeatureLanguage = KFeatureIdJapanese; |
|
290 } |
|
291 |
|
292 } |
|
293 |
|
294 EXPORT_C CAknEnv* CAknEnv::Static() |
|
295 { |
|
296 return (CAknEnv*)CEikonEnv::Static()->Extension(); |
|
297 } |
|
298 |
|
299 EXPORT_C CAknEnv::~CAknEnv() |
|
300 { |
|
301 delete iCommandMediator; |
|
302 delete iTransitionManager; |
|
303 delete iCdlEngRef; |
|
304 delete iBusyMsgDialog; |
|
305 iBusyMsgDialog = NULL; // just in case scheduler callback tries to use this during exit |
|
306 delete iIdle; |
|
307 delete iStateArray; |
|
308 delete iSettingCache; |
|
309 delete [] iRunInfoArray; |
|
310 iWsBufferRequestArray.Close(); |
|
311 RAknIconSrvClient::Disconnect(); |
|
312 delete iFontRegistry; |
|
313 FeatureManager::UnInitializeLib(); |
|
314 } |
|
315 |
|
316 |
|
317 EXPORT_C void CAknEnv::RegisterIntermediateStateL(MAknIntermediateState *aState) |
|
318 { |
|
319 iStateArray->AppendL(aState); |
|
320 } |
|
321 |
|
322 EXPORT_C void CAknEnv::UnRegisterIntermediateState(MAknIntermediateState *aState) |
|
323 { |
|
324 TInt count = iStateArray->Count(); |
|
325 TInt i; |
|
326 for (i=0; i<count; i++) |
|
327 { |
|
328 if (iStateArray->At(i) == aState) |
|
329 break; |
|
330 } |
|
331 if (i<count) |
|
332 iStateArray->Delete(i); |
|
333 } |
|
334 |
|
335 EXPORT_C void CAknEnv::CloseAllIntermediateStates() |
|
336 { |
|
337 delete iIdle; |
|
338 iIdle = NULL; |
|
339 iIdle = CIdle::New(EActivePriorityWsEvents+1); |
|
340 if (iIdle) |
|
341 iIdle->Start(TCallBack(RealCloseIntermediateStates, this)); |
|
342 } |
|
343 |
|
344 // ----------------------------------------------------------------------------- |
|
345 // CAknEnv::GetTransparencyEnabled |
|
346 // ----------------------------------------------------------------------------- |
|
347 // |
|
348 EXPORT_C TBool CAknEnv::TransparencyEnabled() const |
|
349 { |
|
350 return iSettingCache->TransparencyEnabled(); |
|
351 } |
|
352 |
|
353 |
|
354 TInt CAknEnv::RealCloseIntermediateStates(TAny *aEnvAny) |
|
355 { |
|
356 CAknEnv *env = (CAknEnv*)aEnvAny; |
|
357 TInt count = env->iStateArray->Count(); |
|
358 for (TInt i=0; i<count; i++) |
|
359 { |
|
360 env->iStateArray->At(i)->CloseState(); |
|
361 } |
|
362 env->iStateArray->Reset(); |
|
363 |
|
364 // Destroy the CIdle. |
|
365 delete env->iIdle; |
|
366 env->iIdle = 0; |
|
367 return EFalse; |
|
368 } |
|
369 |
|
370 TBool CAknEnv::HasBlank() const |
|
371 { |
|
372 return iTransitionManager == NULL; //when there is no effects, there is screenblanker |
|
373 } |
|
374 |
|
375 void CAknEnv::TransitionEvent(TInt aEvent) |
|
376 { |
|
377 TransitionEvent(aEvent, KNullUid); |
|
378 } |
|
379 |
|
380 void CAknEnv::TransitionEvent(TInt aEvent, const TUid& aUid) |
|
381 { |
|
382 if(iTransitionManager != NULL) |
|
383 { |
|
384 switch(aEvent) |
|
385 { |
|
386 case AknTransEffect::EEmbeddedApplicationStart: |
|
387 iTransitionManager->SetEmbedded(); //go trough |
|
388 case AknTransEffect::EApplicationStartSwitch: |
|
389 case AknTransEffect::EApplicationStart: |
|
390 case AknTransEffect::EAppStartupBackground: |
|
391 iTransitionManager->AppStartup(aEvent, aUid); |
|
392 break; |
|
393 case AknTransEffect::EAppStartComplete: |
|
394 iTransitionManager->AppStartupComplete(); |
|
395 break; |
|
396 case AknTransEffect::EApplicationExit: |
|
397 iTransitionManager->AppExit(aEvent, aUid); |
|
398 break; |
|
399 case KAknTransitionDeactivate: |
|
400 break; |
|
401 case AknTransEffect::EApplicationActivate: |
|
402 iTransitionManager->AppSwitch(aEvent); |
|
403 break; |
|
404 case KAknTransitionEventAvkon: |
|
405 iTransitionManager->SetAvkon(); |
|
406 break; |
|
407 case KAknTransitionEventFlags: |
|
408 iTransitionManager->CheckFlags(); |
|
409 break; |
|
410 case KAknTransitionExitCancel: |
|
411 iTransitionManager->CancelExit(); |
|
412 break; |
|
413 default: |
|
414 __ASSERT_DEBUG(0, User::Panic(_L("Unknown transition"), aEvent)); |
|
415 User::Invariant(); |
|
416 } |
|
417 } |
|
418 } |
|
419 |
|
420 |
|
421 class CMyListBox : public CAknSinglePopupMenuStyleListBox |
|
422 { |
|
423 public: |
|
424 TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType) |
|
425 { |
|
426 if (aKeyEvent.iCode != EKeyOK) |
|
427 return CAknSinglePopupMenuStyleListBox::OfferKeyEventL(aKeyEvent, aType); |
|
428 return EKeyWasConsumed; |
|
429 } |
|
430 void ActivateL() |
|
431 { |
|
432 STATIC_CAST(CFormattedCellListBoxItemDrawer*,this->View()->ItemDrawer())->FormattedCellData()->SetSubCellAlignmentL(0,CGraphicsContext::ECenter); |
|
433 |
|
434 } |
|
435 }; |
|
436 |
|
437 EXPORT_C void CAknEnv::ExecuteEmptyPopupListL(const TDesC *aEmptyText, const TDesC *aPopupTitle, TInt aSoftKeyId) |
|
438 { |
|
439 HBufC *message = CCoeEnv::Static()->AllocReadResourceL(R_AVKON_EMPTY_POPUP_LIST_TEXT); |
|
440 CleanupStack::PushL(message); |
|
441 |
|
442 HBufC *emptysoftkey = CCoeEnv::Static()->AllocReadResourceL(R_TEXT_SOFTKEY_EMPTY); |
|
443 CleanupStack::PushL(emptysoftkey); |
|
444 |
|
445 if (!aEmptyText) |
|
446 { |
|
447 aEmptyText = message; |
|
448 } |
|
449 |
|
450 CEikFormattedCellListBox *list = new(ELeave)CMyListBox; |
|
451 CleanupStack::PushL(list); |
|
452 if (aSoftKeyId == 0) aSoftKeyId = R_AVKON_SOFTKEYS_CANCEL; |
|
453 |
|
454 CAknPopupList *popupList = CAknPopupList::NewL(list, aSoftKeyId, AknPopupLayouts::EMenuWindow); |
|
455 CleanupStack::PushL(popupList); |
|
456 list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); |
|
457 |
|
458 // Logical to visual conversion is already performed. |
|
459 list->UseLogicalToVisualConversion( ETrue ); |
|
460 |
|
461 // Some viewers use ok_empty; We remove left softkey if right softkey has |
|
462 // something else than empty. |
|
463 if (! ( aSoftKeyId == R_AVKON_SOFTKEYS_OK_EMPTY)) |
|
464 popupList->ButtonGroupContainer()->SetCommandL(0,EAknSoftkeyEmpty, *emptysoftkey); |
|
465 |
|
466 CDesCArrayFlat *items = new(ELeave)CDesCArrayFlat(1); |
|
467 CleanupStack::PushL(items); |
|
468 |
|
469 CTextListBoxModel* model=list->Model(); |
|
470 model->SetItemTextArray(items); |
|
471 model->SetOwnershipType(ELbmOwnsItemArray); |
|
472 CleanupStack::Pop(); // items |
|
473 |
|
474 list->View()->ItemDrawer()->SetFlags(CTextListItemDrawer::EDisableHighlight); |
|
475 |
|
476 list->View()->SetListEmptyTextL(*aEmptyText); |
|
477 |
|
478 if (aPopupTitle) |
|
479 { |
|
480 popupList->SetTitleL(*aPopupTitle); |
|
481 } |
|
482 CleanupStack::Pop(); // popupList |
|
483 popupList->ExecuteLD(); |
|
484 |
|
485 CleanupStack::PopAndDestroy( 3 ); // list, emptysoftkey, message |
|
486 } |
|
487 |
|
488 EXPORT_C void CAknEnv::ExecuteEmptyPopupListL(const TDesC *aEmptyText) |
|
489 { |
|
490 ExecuteEmptyPopupListL(aEmptyText,0); |
|
491 } |
|
492 |
|
493 EXPORT_C void CAknEnv::RunAppShutter() |
|
494 { |
|
495 CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
496 CAknAppUi* base = (CAknAppUi*)eikEnv->EikAppUi(); |
|
497 while (base && base->ContainerAppUi()) |
|
498 base = (CAknAppUi*)base->ContainerAppUi(); |
|
499 |
|
500 CEikAppServer* server = eikEnv->AppServer(); |
|
501 if (server) |
|
502 server->NotifyServerExit(EAknCmdExit); |
|
503 |
|
504 if (base) |
|
505 base->RunAppShutter(); |
|
506 } |
|
507 |
|
508 EXPORT_C CAknAppUi* CAknEnv::AppWithShutterRunning() |
|
509 { |
|
510 CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
511 CAknAppUi* app = (CAknAppUi*)eikEnv->EikAppUi(); |
|
512 do { |
|
513 if (app->IsAppShutterRunning()) |
|
514 return app; |
|
515 app = (CAknAppUi*)app->ContainerAppUi(); |
|
516 } while (app); |
|
517 |
|
518 return NULL; |
|
519 } |
|
520 |
|
521 EXPORT_C void CAknEnv::StopSchedulerWaitWithBusyMessage(CActiveSchedulerWait& aWait) |
|
522 { |
|
523 if (aWait.IsStarted()) |
|
524 { |
|
525 if (aWait.CanStopNow()) |
|
526 { |
|
527 aWait.AsyncStop(); |
|
528 } |
|
529 else |
|
530 { |
|
531 CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
532 CEikAppUi* appUi = eikEnv->EikAppUi(); |
|
533 if (appUi && !appUi->IsDisplayingDialog()) |
|
534 { |
|
535 // If the waiting control can't stop the scheduler immediately, try to show |
|
536 // a busy note to alert the user and prevent them from using the app till the |
|
537 // scheduler can return. |
|
538 // Some other service running in your app has started a scheduler wait, but not |
|
539 // stopped it before this waiting control exited. That service must stop it's scheduler wait |
|
540 // before this one can stop. |
|
541 // |
|
542 // The dialog is stored as member data with a reference count to ensure that it is deleted |
|
543 // on app exit and that it lasts as long as it should. |
|
544 CAknEnv* env = Static(); |
|
545 if (!env->iBusyMsgDialog) |
|
546 { |
|
547 TRAP_IGNORE( |
|
548 { |
|
549 env->iBusyMsgDialog = new(ELeave) CAknWaitDialog(reinterpret_cast<CEikDialog**>(&env->iBusyMsgDialog), ETrue); |
|
550 env->iBusyMsgDialog->ExecuteLD(R_SCHEDULER_STOP_BUSY_MESSAGE); |
|
551 }); |
|
552 } |
|
553 env->iBusyMsgCount++; |
|
554 aWait.AsyncStop(TCallBack(SchedulerStoppedCallBack, env)); |
|
555 } |
|
556 } |
|
557 } |
|
558 } |
|
559 |
|
560 TInt CAknEnv::SchedulerStoppedCallBack(TAny* aThis) |
|
561 { |
|
562 CAknEnv* self = static_cast<CAknEnv*>(aThis); |
|
563 self->DoSchedulerStoppedCallBack(); |
|
564 return 0; |
|
565 } |
|
566 |
|
567 void CAknEnv::DoSchedulerStoppedCallBack() |
|
568 { |
|
569 iBusyMsgCount--; |
|
570 if (iBusyMsgCount<=0 && iBusyMsgDialog) |
|
571 { |
|
572 TRAP_IGNORE(iBusyMsgDialog->ProcessFinishedL()); |
|
573 } |
|
574 } |
|
575 |
|
576 NONSHARABLE_CLASS(CLBCommandObserver) : public MEikCommandObserver |
|
577 { |
|
578 public: |
|
579 CLBCommandObserver(CEikButtonGroupContainer *aCba, CEikListBox *aListBox); |
|
580 void ProcessCommandL(TInt aCommandId); |
|
581 CEikButtonGroupContainer *iCba; |
|
582 CEikListBox *iListBox; |
|
583 }; |
|
584 |
|
585 |
|
586 CLBCommandObserver::CLBCommandObserver(CEikButtonGroupContainer *aCba, CEikListBox *aListBox) |
|
587 : iCba(aCba), iListBox(aListBox) |
|
588 { |
|
589 } |
|
590 |
|
591 void CLBCommandObserver::ProcessCommandL(TInt aCommandId) |
|
592 { |
|
593 // We will be executing this code only when commandid is correct. |
|
594 // so no need to test for aCommandId. |
|
595 if (aCommandId == EAknSoftkeyOk) |
|
596 { |
|
597 // We need to send a key event that will cause redraw of application state. |
|
598 // This is because of multi-item fetch in phonebook works kinda odd and |
|
599 // we need to update it's state. (just need to make sure findbox does |
|
600 // not eat this key :-) |
|
601 TKeyEvent keyevent; |
|
602 keyevent.iCode = EKeyApplicationF; |
|
603 keyevent.iModifiers = 0; |
|
604 CEikonEnv::Static()->SimulateKeyEventL(keyevent, EEventKey); |
|
605 } |
|
606 |
|
607 CEikButtonGroupContainer *cba = iCba; |
|
608 AVKONENV->RemoveCbaObserver(); |
|
609 // the next call is very likely to delete listbox and cba. |
|
610 // resend the event to the cba. |
|
611 STATIC_CAST(MEikCommandObserver*,cba)->ProcessCommandL(aCommandId); |
|
612 } |
|
613 |
|
614 |
|
615 EXPORT_C void CAknEnv::CreateCbaObserverL(CEikButtonGroupContainer *aCba, CEikListBox *aListBox) |
|
616 { |
|
617 RemoveCbaObserver(); |
|
618 iCbaCommandObserver = new(ELeave)CLBCommandObserver(aCba, aListBox); |
|
619 TRAPD(error, aCba->UpdateCommandObserverL(0, *iCbaCommandObserver)); |
|
620 if (error) |
|
621 { |
|
622 delete iCbaCommandObserver; |
|
623 iCbaCommandObserver = NULL; |
|
624 User::Leave(error); |
|
625 } |
|
626 } |
|
627 |
|
628 EXPORT_C void CAknEnv::RemoveCbaObserver() |
|
629 { |
|
630 if (iCbaCommandObserver) |
|
631 { |
|
632 STATIC_CAST(CLBCommandObserver*,iCbaCommandObserver)->iCba->RemoveCommandObserver(0); |
|
633 delete iCbaCommandObserver; |
|
634 iCbaCommandObserver = NULL; |
|
635 } |
|
636 } |
|
637 |
|
638 EXPORT_C void CAknEnv::InformCbaDeletion(CEikButtonGroupContainer *aCba) |
|
639 { |
|
640 if (iCbaCommandObserver) |
|
641 { |
|
642 if (STATIC_CAST(CLBCommandObserver*, iCbaCommandObserver)->iCba == aCba) |
|
643 { |
|
644 RemoveCbaObserver(); |
|
645 } |
|
646 } |
|
647 |
|
648 if ( iCommandMediator ) |
|
649 { |
|
650 iCommandMediator->InformCbaDeletion( *aCba ); |
|
651 } |
|
652 } |
|
653 |
|
654 // --------------------------------------------------------------------------- |
|
655 // Creates new command mediator if necessary, and sets it to mediate commands. |
|
656 // --------------------------------------------------------------------------- |
|
657 // |
|
658 EXPORT_C void CAknEnv::RequestCommandMediationL( |
|
659 CEikButtonGroupContainer& aCba, MEikCommandObserver& aCommandObserver ) |
|
660 { |
|
661 if ( !iCommandMediator ) |
|
662 { |
|
663 iCommandMediator = new ( ELeave ) CAknCommandMediator; |
|
664 } |
|
665 |
|
666 iCommandMediator->SetCbaObserverL( aCba, aCommandObserver ); |
|
667 } |
|
668 |
|
669 EXPORT_C void CAknEnv::EndCommandMediation( |
|
670 MEikCommandObserver& aCommandObserver ) |
|
671 { |
|
672 if ( iCommandMediator ) |
|
673 { |
|
674 iCommandMediator->RemoveCbaObserver( aCommandObserver ); |
|
675 } |
|
676 } |
|
677 |
|
678 |
|
679 EXPORT_C void CAknEnv::GetCurrentLayoutId(TAknLayoutId& aCurrentLayoutId) const |
|
680 { |
|
681 aCurrentLayoutId = iSettingCache->LayoutId(); |
|
682 } |
|
683 |
|
684 EXPORT_C void CAknEnv::GetCurrentGlobalUiZoom(TAknUiZoom& aCurrentGlobalUiZoom) const |
|
685 { |
|
686 aCurrentGlobalUiZoom = iSettingCache->GlobalUiZoom(); |
|
687 } |
|
688 |
|
689 |
|
690 // ----------------------------------------------------------------------------- |
|
691 // CAknEnv::RequestWsBuffer |
|
692 // ----------------------------------------------------------------------------- |
|
693 // |
|
694 EXPORT_C TInt CAknEnv::RequestWsBuffer( TInt aRequestedBufferSize ) |
|
695 { |
|
696 TInt ret = KErrGeneral; |
|
697 |
|
698 if ( aRequestedBufferSize > 0 ) |
|
699 { |
|
700 // Cut down to max size. |
|
701 if ( aRequestedBufferSize > KAknMaxWsBufferSize ) |
|
702 { |
|
703 aRequestedBufferSize = KAknMaxWsBufferSize; |
|
704 } |
|
705 |
|
706 // Generate request ID, they start from 1. |
|
707 TInt requestID = ++iRequestIdCounter; |
|
708 |
|
709 TWsBufferRequest request = {requestID, aRequestedBufferSize}; |
|
710 ret = iWsBufferRequestArray.Append( request ); |
|
711 |
|
712 if ( ret == KErrNone ) |
|
713 { |
|
714 if ( aRequestedBufferSize > iCurrentWsBufferRequest ) |
|
715 { |
|
716 SetWsBufferSize(); |
|
717 } |
|
718 |
|
719 // return the request ID |
|
720 ret = requestID; |
|
721 } |
|
722 } |
|
723 |
|
724 return ret; |
|
725 } |
|
726 |
|
727 // ----------------------------------------------------------------------------- |
|
728 // CAknEnv::CancelWsBufferRequest |
|
729 // ----------------------------------------------------------------------------- |
|
730 // |
|
731 EXPORT_C void CAknEnv::CancelWsBufferRequest( TInt aRequestID ) |
|
732 { |
|
733 // Real request IDs are always positive, ignore others. |
|
734 if ( aRequestID > 0 ) |
|
735 { |
|
736 TInt count = iWsBufferRequestArray.Count(); |
|
737 |
|
738 for ( TInt i = 0 ; i < count ; i++ ) |
|
739 { |
|
740 TWsBufferRequest& request = iWsBufferRequestArray[i]; |
|
741 |
|
742 if ( request.iRequestID == aRequestID ) |
|
743 { |
|
744 TInt canceledRequestSize = request.iRequestedSize; |
|
745 iWsBufferRequestArray.Remove( i ); |
|
746 |
|
747 // If the canceled request was not lower than the currently |
|
748 // highest request, set WS buffer size again according to the |
|
749 // list of requests. |
|
750 |
|
751 if ( canceledRequestSize >= iCurrentWsBufferRequest ) |
|
752 { |
|
753 SetWsBufferSize(); |
|
754 } |
|
755 break; |
|
756 } |
|
757 } |
|
758 } |
|
759 } |
|
760 |
|
761 // ----------------------------------------------------------------------------- |
|
762 // CAknEnv::SetWsBufferSize |
|
763 // ----------------------------------------------------------------------------- |
|
764 // |
|
765 void CAknEnv::SetWsBufferSize() |
|
766 { |
|
767 TInt count = iWsBufferRequestArray.Count(); |
|
768 |
|
769 // Only if there are no requests, default to KAknDefaultWsBufferSize. |
|
770 // This allows requesting also smaller WS buffer sizes for saving RAM. |
|
771 TInt highestRequest = count ? 0 : KAknDefaultWsBufferSize; |
|
772 |
|
773 // Find out the highest request |
|
774 for ( TInt i = 0 ; i < count ; i++ ) |
|
775 { |
|
776 TInt requestedSize = iWsBufferRequestArray[i].iRequestedSize; |
|
777 |
|
778 if ( requestedSize > highestRequest ) |
|
779 { |
|
780 highestRequest = requestedSize; |
|
781 } |
|
782 } |
|
783 |
|
784 SetWsBufferSize( highestRequest ); |
|
785 } |
|
786 |
|
787 // ----------------------------------------------------------------------------- |
|
788 // CAknEnv::SetWsBufferSize |
|
789 // ----------------------------------------------------------------------------- |
|
790 // |
|
791 void CAknEnv::SetWsBufferSize( TInt aRequestedBufferSize ) |
|
792 { |
|
793 TRAPD( err, iEikonEnv->WsSession().SetMaxBufferSizeL( |
|
794 aRequestedBufferSize ) ); |
|
795 |
|
796 if ( !iWsBufferRequestArray.Count() ) |
|
797 { |
|
798 iCurrentWsBufferRequest = 0; |
|
799 } |
|
800 |
|
801 else if ( err == KErrNone ) |
|
802 { |
|
803 iCurrentWsBufferRequest = aRequestedBufferSize; |
|
804 } |
|
805 } |
|
806 |
|
807 EXPORT_C CAknSettingCache& CAknEnv::SettingCache() const |
|
808 { |
|
809 return *iSettingCache; |
|
810 } |
|
811 |
|
812 TBidirectionalState::TRunInfo* CAknEnv::RunInfoArray( TInt& aLength ) const |
|
813 { |
|
814 aLength = iRunInfoArrayLength; |
|
815 return iRunInfoArray; |
|
816 } |
|
817 |
|
818 TInt CAknEnv::PrepareRunInfoArray( const TDesC& aLogicalText ) |
|
819 { |
|
820 TBidiLogicalToVisual converter( |
|
821 aLogicalText, |
|
822 iRunInfoArray, |
|
823 iRunInfoArrayLength ) ; |
|
824 |
|
825 TInt count = converter.Reorder(); |
|
826 return SetRequiredRunInfoArraySize( count ); |
|
827 } |
|
828 |
|
829 TInt CAknEnv::SetRequiredRunInfoArraySize( TInt aLength ) |
|
830 { |
|
831 TInt ret( KErrNone ); |
|
832 |
|
833 if ( iRunInfoArrayLength < aLength ) |
|
834 { |
|
835 TBidirectionalState::TRunInfo* array = |
|
836 new TBidirectionalState::TRunInfo[aLength]; |
|
837 |
|
838 if ( array ) |
|
839 { |
|
840 delete [] iRunInfoArray; |
|
841 iRunInfoArray = array; |
|
842 iRunInfoArrayLength = aLength; |
|
843 } |
|
844 else |
|
845 { |
|
846 ret = KErrNoMemory; |
|
847 } |
|
848 } |
|
849 |
|
850 return ret; |
|
851 } |
|
852 |
|
853 struct SStatusPaneEquivResIds |
|
854 { |
|
855 TInt iElaf; |
|
856 TInt iAbrw; |
|
857 }; |
|
858 |
|
859 struct SStatusPaneOrientationEquivResIds |
|
860 { |
|
861 TInt iResId; |
|
862 TInt iEqvivResId; |
|
863 }; |
|
864 |
|
865 |
|
866 /** |
|
867 * Mirrored (Arabic & Hebrew) mapping of status pane layout resources. |
|
868 * |
|
869 * Note that mirrored status pane layouts are not used anymore, |
|
870 * so there is no actual mapping here. |
|
871 */ |
|
872 const SStatusPaneEquivResIds KStatusPaneEquivResIds[] = |
|
873 { |
|
874 { R_AVKON_STATUS_PANE_LAYOUT_IDLE, R_AVKON_STATUS_PANE_LAYOUT_IDLE }, |
|
875 { R_AVKON_STATUS_PANE_LAYOUT_USUAL, R_AVKON_STATUS_PANE_LAYOUT_USUAL }, |
|
876 { R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE, R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE }, |
|
877 { R_AVKON_STATUS_PANE_LAYOUT_EMPTY, R_AVKON_STATUS_PANE_LAYOUT_EMPTY }, |
|
878 { R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE, R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE }, |
|
879 { R_AVKON_STATUS_PANE_LAYOUT_SMALL, R_AVKON_STATUS_PANE_LAYOUT_SMALL }, |
|
880 { R_AVKON_STATUS_PANE_LAYOUT_VT, R_AVKON_STATUS_PANE_LAYOUT_VT } |
|
881 |
|
882 // {R_AVKON_STATUS_PANE_LAYOUT_IDLE, R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED}, |
|
883 // {R_AVKON_STATUS_PANE_LAYOUT_USUAL, R_AVKON_STATUS_PANE_LAYOUT_USUAL_MIRRORED}, |
|
884 // {R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE, R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE_MIRRORED}, |
|
885 // {R_AVKON_STATUS_PANE_LAYOUT_EMPTY, R_AVKON_STATUS_PANE_LAYOUT_EMPTY}, |
|
886 // {R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE, R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED}, |
|
887 // {R_AVKON_STATUS_PANE_LAYOUT_SMALL, R_AVKON_STATUS_PANE_LAYOUT_SMALL}, |
|
888 // {R_AVKON_STATUS_PANE_LAYOUT_VT, R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED} |
|
889 }; |
|
890 |
|
891 |
|
892 /** |
|
893 * Status pane layout resource mapping for landscape orientation with right softkeys. |
|
894 * Here each of the status pane layout IDs which can not be used in RSK stacon mode are |
|
895 * mapped to the equivalent RSK stacon mode status pane resource IDs. |
|
896 */ |
|
897 const SStatusPaneOrientationEquivResIds KStatusPaneSoftkeysRightEquivResIds[] = |
|
898 { |
|
899 { R_AVKON_STATUS_PANE_LAYOUT_IDLE, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT }, |
|
900 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT }, |
|
901 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_EXT, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT }, |
|
902 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT }, |
|
903 |
|
904 { R_AVKON_STATUS_PANE_LAYOUT_USUAL, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
905 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
906 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
907 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_MIRRORED, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
908 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_WITH_BATTERY_PANE,R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
909 |
|
910 { R_AVKON_STATUS_PANE_LAYOUT_EMPTY, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
911 |
|
912 { R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
913 { R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
914 { R_AVKON_STATUS_PANE_LAYOUT_SMALL, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
915 |
|
916 { R_AVKON_STATUS_PANE_LAYOUT_VT, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
917 { R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
918 |
|
919 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
920 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT }, |
|
921 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
922 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT }, |
|
923 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT }, |
|
924 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT } |
|
925 }; |
|
926 |
|
927 |
|
928 /** |
|
929 * Status pane layout resource mapping for landscape orientation with left softkeys. |
|
930 * Here each of the status pane layout IDs which can not be used in LSK stacon mode are |
|
931 * mapped to the equivalent LSK stacon mode status pane resource IDs. |
|
932 */ |
|
933 const SStatusPaneOrientationEquivResIds KStatusPaneSoftkeysLeftEquivResIds[] = |
|
934 { |
|
935 { R_AVKON_STATUS_PANE_LAYOUT_IDLE, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT }, |
|
936 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT }, |
|
937 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_EXT, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT }, |
|
938 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT }, |
|
939 |
|
940 { R_AVKON_STATUS_PANE_LAYOUT_USUAL, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
941 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
942 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
943 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_MIRRORED, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
944 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_WITH_BATTERY_PANE,R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
945 |
|
946 { R_AVKON_STATUS_PANE_LAYOUT_EMPTY, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
947 |
|
948 { R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
949 { R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
950 { R_AVKON_STATUS_PANE_LAYOUT_SMALL, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
951 |
|
952 { R_AVKON_STATUS_PANE_LAYOUT_VT, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
953 { R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
954 |
|
955 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
956 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT }, |
|
957 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
958 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT }, |
|
959 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS, R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT }, |
|
960 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS, R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT } |
|
961 }; |
|
962 |
|
963 |
|
964 /** |
|
965 * Status pane layout resource mapping for landscape orientation with bottom softkeys (flat status pane). |
|
966 * Here each of the status pane layout IDs which can not be used in landscape BSK mode are |
|
967 * mapped to the equivalent landscape BSK mode status pane resource IDs. |
|
968 */ |
|
969 const SStatusPaneOrientationEquivResIds KStatusPaneSoftkeysBottomEquivResIds[] = |
|
970 { |
|
971 { R_AVKON_STATUS_PANE_LAYOUT_IDLE, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS }, |
|
972 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_EXT, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS }, |
|
973 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS }, |
|
974 |
|
975 { R_AVKON_STATUS_PANE_LAYOUT_USUAL, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
976 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
977 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_MIRRORED, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
978 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_WITH_BATTERY_PANE, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
979 |
|
980 { R_AVKON_STATUS_PANE_LAYOUT_VT, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
981 { R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
982 |
|
983 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
984 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS }, |
|
985 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
986 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS }, |
|
987 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
988 }; |
|
989 |
|
990 |
|
991 /** |
|
992 * Status pane layout resource mapping for portrait orientation. |
|
993 * Here each of the status pane layout IDs which can not be used in portrait mode are |
|
994 * mapped to the equivalent portrait mode status pane resource IDs. |
|
995 */ |
|
996 const SStatusPaneOrientationEquivResIds KStatusPanePortraitEquivResIds[] = |
|
997 { |
|
998 #ifndef __SERIES60_31__ |
|
999 { R_AVKON_STATUS_PANE_LAYOUT_IDLE, R_AVKON_STATUS_PANE_LAYOUT_IDLE_EXT },// UNCOMMENT this for enablling extended statuspane as default |
|
1000 #else |
|
1001 { R_AVKON_STATUS_PANE_LAYOUT_USUAL, R_AVKON_STATUS_PANE_LAYOUT_USUAL }, |
|
1002 #endif |
|
1003 |
|
1004 #ifndef __SERIES60_31__ |
|
1005 { R_AVKON_STATUS_PANE_LAYOUT_USUAL, R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT }, // UNCOMMENT this for enablling extended statuspane as default |
|
1006 #endif |
|
1007 |
|
1008 #ifndef __SERIES60_31__ |
|
1009 { R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT, R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT }, // UNCOMMENT this for enablling extended statuspane as default |
|
1010 { R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT, R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT }, // UNCOMMENT this for enablling extended statuspane as default |
|
1011 #else |
|
1012 { R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT, R_AVKON_STATUS_PANE_LAYOUT_USUAL }, // COMMENT this for enablling extended statuspane as default |
|
1013 { R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT, R_AVKON_STATUS_PANE_LAYOUT_USUAL }, // COMMENT this for enablling extended statuspane as default |
|
1014 #endif |
|
1015 { R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT, R_AVKON_STATUS_PANE_LAYOUT_IDLE }, |
|
1016 { R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT, R_AVKON_STATUS_PANE_LAYOUT_IDLE }, |
|
1017 { R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_RIGHT, R_AVKON_STATUS_PANE_LAYOUT_EMPTY }, |
|
1018 { R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_LEFT, R_AVKON_STATUS_PANE_LAYOUT_EMPTY }, |
|
1019 |
|
1020 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL, R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT }, |
|
1021 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE, R_AVKON_STATUS_PANE_LAYOUT_IDLE_EXT }, |
|
1022 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
1023 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT, R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT }, |
|
1024 { R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS, R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT }, |
|
1025 { R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS, R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT } |
|
1026 }; |
|
1027 |
|
1028 |
|
1029 /** |
|
1030 * Status pane layout resource mapping for widescreen status pane mode (nHD landscape). |
|
1031 * Here each of the status pane layout IDs which can not be used in nHD mode are |
|
1032 * mapped to the equivalent nHD resource IDs. |
|
1033 */ |
|
1034 const SStatusPaneOrientationEquivResIds KStatusPaneWidescreenEquivResIds[] = |
|
1035 { |
|
1036 { R_AVKON_STATUS_PANE_LAYOUT_USUAL, R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL }, |
|
1037 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT, R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL }, |
|
1038 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT, R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT }, |
|
1039 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_MIRRORED, R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL }, |
|
1040 { R_AVKON_STATUS_PANE_LAYOUT_USUAL_WITH_BATTERY_PANE, R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL }, |
|
1041 { R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT, R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL }, |
|
1042 { R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT, R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL }, |
|
1043 |
|
1044 { R_AVKON_STATUS_PANE_LAYOUT_IDLE, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE }, |
|
1045 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_EXT, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE }, |
|
1046 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS }, |
|
1047 { R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE }, |
|
1048 { R_AVKON_STATUS_PANE_LAYOUT_VT, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE }, |
|
1049 { R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE }, |
|
1050 { R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE }, |
|
1051 { R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT, R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE }, |
|
1052 |
|
1053 { R_AVKON_STATUS_PANE_LAYOUT_SMALL, R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL }, |
|
1054 { R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE, R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL }, |
|
1055 { R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED, R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL }, |
|
1056 |
|
1057 { R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_RIGHT, R_AVKON_STATUS_PANE_LAYOUT_EMPTY}, |
|
1058 { R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_LEFT, R_AVKON_STATUS_PANE_LAYOUT_EMPTY} |
|
1059 }; |
|
1060 |
|
1061 |
|
1062 static TBool IsAreaSideRightPaneActive() |
|
1063 { |
|
1064 return EFalse; |
|
1065 } |
|
1066 |
|
1067 |
|
1068 EXPORT_C TInt CAknEnv::StatusPaneResIdForCurrentLayout( TInt aResId ) const |
|
1069 { |
|
1070 TInt resId = aResId; |
|
1071 |
|
1072 // static mapping of usual layouts first. |
|
1073 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
1074 { |
|
1075 // Map A&H first if needed |
|
1076 const SStatusPaneEquivResIds* equiv = NULL; |
|
1077 for (TUint ii=0; ii<sizeof(KStatusPaneEquivResIds)/sizeof(*KStatusPaneEquivResIds); ii++) |
|
1078 { |
|
1079 if (KStatusPaneEquivResIds[ii].iElaf == resId || KStatusPaneEquivResIds[ii].iAbrw == resId) |
|
1080 { |
|
1081 equiv = &KStatusPaneEquivResIds[ii]; |
|
1082 resId = equiv->iElaf; |
|
1083 break; |
|
1084 } |
|
1085 } |
|
1086 |
|
1087 // Get the cba location. |
|
1088 CAknLayoutConfig::TScreenMode screenMode = CAknSgcClient::ScreenMode(); |
|
1089 TAknPrivSoftkeyLocation softkeyLocation = screenMode.SoftkeyLocation(); |
|
1090 |
|
1091 |
|
1092 if ( IsAreaSideRightPaneActive() ) |
|
1093 { |
|
1094 for ( TUint ii = 0; |
|
1095 ii < sizeof( KStatusPaneWidescreenEquivResIds ) / |
|
1096 sizeof( *KStatusPaneWidescreenEquivResIds ); |
|
1097 ii++ ) |
|
1098 { |
|
1099 if ( KStatusPaneWidescreenEquivResIds[ii].iResId == resId) |
|
1100 { |
|
1101 resId = KStatusPaneWidescreenEquivResIds[ii].iEqvivResId; |
|
1102 break; |
|
1103 } |
|
1104 } |
|
1105 } |
|
1106 else if (softkeyLocation == EAknPrivSoftkeyLocationRight) |
|
1107 { |
|
1108 for ( TUint ii = 0; |
|
1109 ii < sizeof( KStatusPaneSoftkeysRightEquivResIds ) / |
|
1110 sizeof( *KStatusPaneSoftkeysRightEquivResIds ); |
|
1111 ii++) |
|
1112 { |
|
1113 if (KStatusPaneSoftkeysRightEquivResIds[ii].iResId == resId) |
|
1114 { |
|
1115 resId = KStatusPaneSoftkeysRightEquivResIds[ii].iEqvivResId; |
|
1116 break; |
|
1117 } |
|
1118 } |
|
1119 } |
|
1120 else if (softkeyLocation == EAknPrivSoftkeyLocationLeft) |
|
1121 { |
|
1122 for ( TUint ii = 0; |
|
1123 ii < sizeof( KStatusPaneSoftkeysLeftEquivResIds ) / |
|
1124 sizeof( *KStatusPaneSoftkeysLeftEquivResIds ); |
|
1125 ii++ ) |
|
1126 { |
|
1127 if (KStatusPaneSoftkeysLeftEquivResIds[ii].iResId == resId) |
|
1128 { |
|
1129 resId = KStatusPaneSoftkeysLeftEquivResIds[ii].iEqvivResId; |
|
1130 break; |
|
1131 } |
|
1132 } |
|
1133 } |
|
1134 else if (softkeyLocation == EAknPrivSoftkeyLocationBottom) |
|
1135 { |
|
1136 for ( TUint ii = 0; |
|
1137 ii < sizeof( KStatusPaneSoftkeysBottomEquivResIds ) / |
|
1138 sizeof( *KStatusPaneSoftkeysBottomEquivResIds ); |
|
1139 ii++ ) |
|
1140 { |
|
1141 if (KStatusPaneSoftkeysBottomEquivResIds[ii].iResId == resId) |
|
1142 { |
|
1143 resId = KStatusPaneSoftkeysBottomEquivResIds[ii].iEqvivResId; |
|
1144 break; |
|
1145 } |
|
1146 } |
|
1147 } |
|
1148 } |
|
1149 else |
|
1150 { |
|
1151 for ( TUint ii = 0; |
|
1152 ii < sizeof( KStatusPanePortraitEquivResIds ) / |
|
1153 sizeof( *KStatusPanePortraitEquivResIds ); ii++ ) |
|
1154 { |
|
1155 if (KStatusPanePortraitEquivResIds[ii].iResId == resId) |
|
1156 { |
|
1157 resId = KStatusPanePortraitEquivResIds[ii].iEqvivResId; |
|
1158 break; |
|
1159 } |
|
1160 } |
|
1161 } |
|
1162 // end of static mapping |
|
1163 |
|
1164 const SStatusPaneEquivResIds* equiv = NULL; |
|
1165 for ( TUint ii = 0; |
|
1166 ii < sizeof( KStatusPaneEquivResIds ) / |
|
1167 sizeof( *KStatusPaneEquivResIds ); |
|
1168 ii++ ) |
|
1169 { |
|
1170 if ( KStatusPaneEquivResIds[ii].iElaf == resId || |
|
1171 KStatusPaneEquivResIds[ii].iAbrw == resId ) |
|
1172 { |
|
1173 equiv = &KStatusPaneEquivResIds[ii]; |
|
1174 break; |
|
1175 } |
|
1176 } |
|
1177 |
|
1178 if (!equiv) |
|
1179 { |
|
1180 return resId; |
|
1181 } |
|
1182 |
|
1183 if (iSettingCache->LayoutId() == EAknLayoutIdABRW) |
|
1184 { |
|
1185 return equiv->iAbrw; |
|
1186 } |
|
1187 else |
|
1188 { |
|
1189 return equiv->iElaf; |
|
1190 } |
|
1191 } |
|
1192 |
|
1193 EXPORT_C TBool CAknEnv::LoadAknLayoutL() |
|
1194 { |
|
1195 // Get required layout parameters |
|
1196 CAknLayoutConfig::TScreenMode screenMode = CAknSgcClient::ScreenMode(); |
|
1197 return LoadAknLayoutL(screenMode); |
|
1198 } |
|
1199 |
|
1200 EXPORT_C TBool CAknEnv::LoadAknLayoutL(const TAknLayoutConfigScreenMode& aScreenMode) |
|
1201 { |
|
1202 // Get required layout parameters |
|
1203 TAknLayoutId id; |
|
1204 GetCurrentLayoutId(id); |
|
1205 TAknUiZoom zoom = ResolveCurrentUiZoom(); |
|
1206 |
|
1207 // Check to see if the layout is already loaded |
|
1208 if (id == iLastLayoutId && |
|
1209 aScreenMode.ModeNumber() == iLastScreenMode && |
|
1210 zoom == iLastZoom) |
|
1211 return EFalse; |
|
1212 |
|
1213 return TryLoadAknLayoutL(id, aScreenMode, zoom); |
|
1214 } |
|
1215 |
|
1216 void CAknEnv::ReloadAknLayoutL() |
|
1217 { |
|
1218 // Get layout parameters for the current layout |
|
1219 CAknLayoutConfig::TScreenMode screenMode = CAknSgcClient::ScreenMode(); |
|
1220 TAknLayoutId id; |
|
1221 GetCurrentLayoutId(id); |
|
1222 TAknUiZoom zoom = ResolveCurrentUiZoom(); |
|
1223 |
|
1224 // always load the current layout |
|
1225 TryLoadAknLayoutL(id, screenMode, zoom); |
|
1226 } |
|
1227 |
|
1228 |
|
1229 void CleanupLayoutPacks(TAny* aPtr) |
|
1230 { |
|
1231 RPointerArray<LayoutPack::CInstance>* packPtr = (RPointerArray<LayoutPack::CInstance>*)aPtr; |
|
1232 packPtr->ResetAndDestroy(); |
|
1233 delete packPtr; |
|
1234 } |
|
1235 |
|
1236 TInt CompareLayoutPacks(const LayoutPack::CInstance& aLeft, const LayoutPack::CInstance& aRight) |
|
1237 { |
|
1238 return aLeft.priority() - aRight.priority(); |
|
1239 } |
|
1240 |
|
1241 TBool CAknEnv::TryLoadAknLayoutL(TAknLayoutId aId, const TAknLayoutConfigScreenMode& aScreenMode, TAknUiZoom aUiZoom) |
|
1242 { |
|
1243 // Load an appropriate layout |
|
1244 TBool layoutLoaded = ETrue; |
|
1245 if (!LoadAknLayoutL(aId, aScreenMode, aUiZoom)) |
|
1246 { |
|
1247 // fall back to normal zoom |
|
1248 if (!LoadAknLayoutL(aId, aScreenMode, EAknUiZoomNormal)) |
|
1249 { |
|
1250 // fall back to western layout |
|
1251 layoutLoaded = LoadAknLayoutL(EAknLayoutIdELAF, aScreenMode, EAknUiZoomNormal); |
|
1252 } |
|
1253 } |
|
1254 |
|
1255 // just in case the current required layout has changed, remember |
|
1256 // the new settings |
|
1257 if (layoutLoaded) |
|
1258 { |
|
1259 iLastLayoutId = aId; |
|
1260 iLastScreenMode = aScreenMode.ModeNumber(); |
|
1261 iLastZoom = aUiZoom; |
|
1262 } |
|
1263 |
|
1264 return layoutLoaded; |
|
1265 } |
|
1266 |
|
1267 TBool CAknEnv::LoadAknLayoutL(TAknLayoutId aId, const TAknLayoutConfigScreenMode& aScreenMode, TAknUiZoom aUiZoom) |
|
1268 { |
|
1269 RPointerArray<LayoutPack::CInstance>* bestPacks = new(ELeave) RPointerArray<LayoutPack::CInstance>(1); |
|
1270 CleanupStack::PushL(TCleanupItem(CleanupLayoutPacks, bestPacks)); |
|
1271 |
|
1272 CCdlRefs* refs = CdlEngine::FindInstancesLC(LayoutPack::KCdlInterfaceUid); |
|
1273 |
|
1274 TInt count = refs->CountRefs(); |
|
1275 TBool styleMatchAlreadyFound = EFalse; |
|
1276 for (TInt ii=0; ii<count; ii++) |
|
1277 { |
|
1278 TCdlRef ref = refs->Ref(ii); |
|
1279 LayoutPack::CInstance* pack = LayoutPack::CInstance::NewLC(ref); |
|
1280 if (pack->id() == aId && pack->size() == aScreenMode.PixelsTwipsAndRotation().iPixelSize && pack->zoom() == aUiZoom) |
|
1281 { |
|
1282 TBool styleMatchInNewPack = pack->styleHash() == aScreenMode.ScreenStyleHash(); |
|
1283 if (styleMatchInNewPack && !styleMatchAlreadyFound) |
|
1284 { |
|
1285 bestPacks->ResetAndDestroy(); |
|
1286 styleMatchAlreadyFound = ETrue; |
|
1287 } |
|
1288 if (!styleMatchAlreadyFound || styleMatchInNewPack) |
|
1289 { |
|
1290 bestPacks->AppendL(pack); |
|
1291 CleanupStack::Pop(pack); |
|
1292 continue; // skip the PopAndDestroy below |
|
1293 } |
|
1294 } |
|
1295 CleanupStack::PopAndDestroy(pack); |
|
1296 } |
|
1297 |
|
1298 CleanupStack::PopAndDestroy(refs); |
|
1299 |
|
1300 // now sort the best layout packs in priority order and load them |
|
1301 TLinearOrder<LayoutPack::CInstance> order( CompareLayoutPacks ); |
|
1302 bestPacks->Sort(order); |
|
1303 |
|
1304 count = bestPacks->Count(); |
|
1305 if (count) |
|
1306 { |
|
1307 // record the current process SID and the current CDL_Font id |
|
1308 RProcess process; |
|
1309 TSecureId thisProcessId = process.SecureId(); |
|
1310 TCdlRef cdlFontRef = CDL_Font::CustomisationInstance().Ref(); |
|
1311 CCdlRefs* allRefs = CCdlRefs::NewLC(); |
|
1312 for (TInt ii=0; ii<count; ii++) |
|
1313 { |
|
1314 LayoutPack::CInstance* pack = (*bestPacks)[ii]; |
|
1315 TInt appUid(pack->appUid()); |
|
1316 if(appUid == 0 || appUid == thisProcessId) |
|
1317 { |
|
1318 // load this layout |
|
1319 CCdlRefs* packRefs = CdlExplorerUtils::CreateRefsLC(*pack, pack->contents()); |
|
1320 allRefs->AppendL(*packRefs); |
|
1321 CleanupStack::PopAndDestroy(packRefs); |
|
1322 } |
|
1323 } |
|
1324 CdlEngine::SetLocalStateL(*allRefs); |
|
1325 CleanupStack::PopAndDestroy(allRefs); |
|
1326 |
|
1327 // set the screen mode for this app |
|
1328 iEikonEnv->ScreenDevice()->SetScreenSizeAndRotation(aScreenMode.PixelsTwipsAndRotation()); |
|
1329 // update the fonts only if the CDL_Font instance has changed |
|
1330 if (cdlFontRef != CDL_Font::CustomisationInstance().Ref()) |
|
1331 { |
|
1332 // Set the CCoeFontProvider font size array |
|
1333 SetConeFontSizeArrayL(); |
|
1334 // Update Font system |
|
1335 iEikonEnv->UpdateSystemFontsL(); |
|
1336 } |
|
1337 } |
|
1338 |
|
1339 CleanupStack::PopAndDestroy(); // CleanupLayoutPacks |
|
1340 |
|
1341 return count; |
|
1342 } |
|
1343 |
|
1344 TAknUiZoom CAknEnv::ResolveCurrentUiZoom() |
|
1345 { |
|
1346 TAknUiZoom zoom = EAknUiZoomAutomatic; |
|
1347 CAknAppUi* app = (CAknAppUi*)iEikonEnv->EikAppUi(); |
|
1348 if(app) |
|
1349 { |
|
1350 zoom = app->LocalUiZoom(); |
|
1351 } |
|
1352 if(zoom == EAknUiZoomAutomatic) |
|
1353 { |
|
1354 GetCurrentGlobalUiZoom(zoom); |
|
1355 } |
|
1356 return zoom; |
|
1357 } |
|
1358 |
|
1359 void CAknEnv::SetLayoutRequirementsL() |
|
1360 { |
|
1361 // set the requirements that loaded layouts have to meet, such as being ROM-only |
|
1362 // These are ordered in terms of most frequently accessed, to speed up lookups. |
|
1363 Layout_Meta_Data::RequireCustomisationL(); |
|
1364 AknLayoutScalable_Avkon::RequireCustomisationL(); |
|
1365 AknLayout::RequireCustomisationL(); |
|
1366 AppLayout::RequireCustomisationL(); |
|
1367 AknLayoutScalable_Apps::RequireCustomisationL(); |
|
1368 AknApacLayout::RequireCustomisationL(); |
|
1369 AppApacLayout::RequireCustomisationL(); |
|
1370 CDL_Font::RequireCustomisationL(); |
|
1371 SkinLayout::RequireCustomisationL(); |
|
1372 LayoutPack::RequireCustomisationL(); |
|
1373 } |
|
1374 |
|
1375 void CAknEnv::AssertLayoutLoaded() |
|
1376 { |
|
1377 // Check that all necessary layouts have customisation instances loaded. |
|
1378 // These are not needed any more since all instances are always loaded. |
|
1379 // __ASSERT_ALWAYS(AknLayout::IsCustomisationStarted(), Panic(EAknPanicLayoutMissing_AknLayout)); |
|
1380 // __ASSERT_ALWAYS(!FeatureManager::FeatureSupported(KFeatureIdAvkonApac) || AknApacLayout::IsCustomisationStarted(), Panic(EAknPanicLayoutMissing_ApacLayout)); |
|
1381 } |
|
1382 |
|
1383 |
|
1384 EXPORT_C void CAknEnv::InstallAknEnvAsExtensionL(CEikonEnv* aEnv) |
|
1385 { |
|
1386 FeatureManager::InitializeLibL(); |
|
1387 CAknEnv* aknEnv = new(ELeave) CAknEnv; |
|
1388 aknEnv->iCoeEnv = aEnv; |
|
1389 aEnv->SetExtension(aknEnv); |
|
1390 aknEnv->iFontRegistry = CAknFontRegistry::NewL(); |
|
1391 } |
|
1392 |
|
1393 CAknFontRegistry& CAknEnv::FontRegistry() const |
|
1394 { |
|
1395 return *iFontRegistry; |
|
1396 } |
|
1397 |
|
1398 EXPORT_C TRgb CAknEnv::AvkonColor(TInt aIndex) |
|
1399 { |
|
1400 return TRgb::Color256(ColorRemapTable[aIndex]); |
|
1401 } |
|
1402 |
|
1403 void CAknEnv::SetConeFontSizeArrayL() const |
|
1404 { |
|
1405 RArray<TInt> logicalToPixelSizes( TCoeFont::EExtraLarge + 1 ); // Granularity chosen to be the final size |
|
1406 CleanupClosePushL( logicalToPixelSizes ); |
|
1407 |
|
1408 // Three standard text layouts are used for the middle 3 of the 5 members of the pixel size array |
|
1409 // The sizes for the 2 outsize (extra small and extra large) are generated by hand using hardcoded factors |
|
1410 |
|
1411 // Append in order. Extra small and then small: |
|
1412 TAknTextComponentLayout textComponentLay = AknLayoutScalable_Avkon::text_secondary(); |
|
1413 TAknTextLineLayout layout = textComponentLay.LayoutLine(); |
|
1414 TAknFontSpecification spec( layout.FontId() ); |
|
1415 TInt textPaneHeight = spec.TextPaneHeight(); |
|
1416 |
|
1417 logicalToPixelSizes.AppendL( APPLY_CONE_FONT_EXTRA_SMALL_FACTOR(textPaneHeight) ); |
|
1418 logicalToPixelSizes.AppendL( textPaneHeight ); |
|
1419 |
|
1420 // Medium: |
|
1421 textComponentLay = AknLayoutScalable_Avkon::text_primary(); |
|
1422 layout = textComponentLay.LayoutLine(); |
|
1423 spec = TAknFontSpecification( layout.FontId() ); |
|
1424 textPaneHeight = spec.TextPaneHeight(); |
|
1425 |
|
1426 logicalToPixelSizes.AppendL( textPaneHeight ); |
|
1427 |
|
1428 // Large and then Extra Large |
|
1429 textComponentLay = AknLayoutScalable_Avkon::text_title(); |
|
1430 layout = textComponentLay.LayoutLine(); |
|
1431 spec = TAknFontSpecification( layout.FontId() ); |
|
1432 textPaneHeight = spec.TextPaneHeight(); |
|
1433 |
|
1434 logicalToPixelSizes.AppendL( textPaneHeight ); |
|
1435 logicalToPixelSizes.AppendL( APPLY_CONE_FONT_EXTRA_LARGE_FACTOR(textPaneHeight) ); |
|
1436 |
|
1437 // Set this into the environment |
|
1438 // Propagation to all CCoeFontProviders is performed by the framework itself |
|
1439 CCoeControlStaticSettings::SetLogicalToPixelFontSizesL(logicalToPixelSizes); |
|
1440 |
|
1441 logicalToPixelSizes.Reset(); |
|
1442 CleanupStack::PopAndDestroy( &logicalToPixelSizes ); |
|
1443 } |
|
1444 |
|
1445 // Avkon layout |
|
1446 EXPORT_C const AknLayout::CInstance& CAknEnv::AknLayout() const |
|
1447 { |
|
1448 return *iLayout; |
|
1449 } |
|
1450 CArrayPtr<CAknSystemFont>* CAknEnv::SystemFontArray() const |
|
1451 { |
|
1452 return iSystemFontArray; |
|
1453 } |
|
1454 |
|
1455 EXPORT_C TBool CAknEnv::SplitViewActive() const |
|
1456 { |
|
1457 return iSplitViewActive; |
|
1458 } |
|
1459 |
|
1460 #ifdef RD_SCALABLE_UI_V2 |
|
1461 void CAknEnv::SplitViewActive( const TBool aSplitViewActive ) |
|
1462 { |
|
1463 iSplitViewActive = aSplitViewActive; |
|
1464 } |
|
1465 #endif // RD_SCALABLE_UI_V2 |
|
1466 |
|
1467 // --------------------------------------------------------------------------- |
|
1468 // Check if the feature language is same. |
|
1469 // --------------------------------------------------------------------------- |
|
1470 TBool CAknEnv::IsFeatureLanguage(TInt aFeatureLanguage) |
|
1471 { |
|
1472 return (iFeatureLanguage == aFeatureLanguage)? ETrue : EFalse; |
|
1473 } |
|
1474 |
|
1475 void CAknEnv::ShutOrHideAppL() |
|
1476 { |
|
1477 CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
1478 CAknAppUi* base = (CAknAppUi*)eikEnv->EikAppUi(); |
|
1479 while (base && base->ContainerAppUi()) |
|
1480 { |
|
1481 base = (CAknAppUi*)base->ContainerAppUi(); |
|
1482 } |
|
1483 |
|
1484 if (base && base->ExitHidesInBackground()) |
|
1485 { |
|
1486 if ( !base->IsAppHiddenInBackground() ) |
|
1487 { |
|
1488 base->ProcessCommandL(EAknCmdHideInBackground); |
|
1489 } |
|
1490 } |
|
1491 else |
|
1492 { |
|
1493 RunAppShutter(); |
|
1494 } |
|
1495 } |
|
1496 |
|
1497 // End of File |