|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Implementation for Avkon AppUi adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <aknview.h> |
|
20 #include <akntoolbar.h> |
|
21 #include <avkon.rsg> |
|
22 |
|
23 // User includes |
|
24 #include <hspublisherinfo.h> |
|
25 #include "xnappuiadapter.h" |
|
26 #include "xnappuiadapterimpl.h" |
|
27 #include "xnviewadapter.h" |
|
28 #include "xnuiengineappif.h" |
|
29 #include "xnfocuscontrol.h" |
|
30 #include "hscontentcontrolfactory.h" |
|
31 #include "xnviewadapter.h" |
|
32 #include "xnnode.h" |
|
33 |
|
34 #include "xuikon_builds_cfg.hrh" |
|
35 #include "debug.h" |
|
36 |
|
37 _LIT8( KActivateDefaultView, "activatedefault" ); |
|
38 |
|
39 // ============================ LOCAL FUNCTIONS ================================ |
|
40 |
|
41 // ============================ MEMBER FUNCTIONS =============================== |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CXnAppUiAdapter::CXnAppUiAdapter |
|
45 // C++ default constructor can NOT contain any code, that |
|
46 // might leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CXnAppUiAdapter::CXnAppUiAdapter( TUid aApplicationUid ) |
|
50 : iExitingApp( EFalse ), iApplicationUid( aApplicationUid ) |
|
51 { |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CXnAppUiAdapter::ConstructL |
|
56 // Second-phase constructor |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 EXPORT_C void CXnAppUiAdapter::ConstructL() |
|
60 { |
|
61 __TICK( "CXnAppUiAdapter::ConstructL" ); |
|
62 __TIME_MARK( time ); |
|
63 |
|
64 __PRINTS( "*** CXnAppUiAdapter::ConstructL - BaseConstructL" ); |
|
65 __TIME_MARK( time2 ); |
|
66 |
|
67 EnableLocalScreenClearer( EFalse ); |
|
68 |
|
69 CAknViewAppUi::BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); |
|
70 |
|
71 CAknToolbar* toolbar( CurrentFixedToolbar() ); |
|
72 |
|
73 if ( toolbar ) |
|
74 { |
|
75 toolbar->SetToolbarVisibility( EFalse ); |
|
76 |
|
77 toolbar->DisableToolbarL( ETrue ); |
|
78 } |
|
79 |
|
80 CEikStatusPane* sp( StatusPane() ); |
|
81 if ( sp ) |
|
82 { |
|
83 sp->EnableTransparent( ETrue ); |
|
84 } |
|
85 |
|
86 __TIME_ENDMARK( "CXnAppUiAdapter::ConstructL - BaseConstructL, done", time2 ); |
|
87 |
|
88 iImpl = CXnAppUiAdapterImpl::NewL( iApplicationUid, *this ); |
|
89 iImpl->ConstructL(); |
|
90 |
|
91 __TIME_ENDMARK( "CXnAppUiAdapter::ConstructL, done", time ); |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // Destructor |
|
96 // |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 EXPORT_C CXnAppUiAdapter::~CXnAppUiAdapter() |
|
100 { |
|
101 delete iUiEngineAppIf; |
|
102 |
|
103 delete iImpl; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CXnAppUiAdapter::HandleResourceChangeL |
|
108 // Handles resource changes |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 EXPORT_C void CXnAppUiAdapter::HandleResourceChangeL( TInt aType ) |
|
112 { |
|
113 __PRINTS( "*** CXnAppUiAdapter::HandleResourceChangeL" ); |
|
114 __TIME_MARK( time ); |
|
115 |
|
116 CAknViewAppUi::HandleResourceChangeL( aType ); |
|
117 |
|
118 if ( iImpl ) |
|
119 { |
|
120 iImpl->HandleResourceChangeL( aType ); |
|
121 } |
|
122 |
|
123 __TIME_ENDMARK( "CXnAppUiAdapter::HandleResourceChangeL, done", time ); |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CXnAppUiAdapter::UiEngine |
|
128 // Get UI engine proxy |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C TXnUiEngineAppIf* CXnAppUiAdapter::UiEngineL() |
|
132 { |
|
133 if ( !iUiEngineAppIf ) |
|
134 { |
|
135 iUiEngineAppIf = new ( ELeave ) TXnUiEngineAppIf( UiEngine() ); |
|
136 } |
|
137 |
|
138 return iUiEngineAppIf; |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CXnAppUiAdapter::HandleXuikonEventL |
|
143 // Handle callbacks from the engine |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 EXPORT_C void CXnAppUiAdapter::HandleXuikonEventL( |
|
147 CXnNodeAppIf& /*aOrigin*/, |
|
148 CXnNodeAppIf& /*aTrigger*/, |
|
149 CXnDomNode& /*aTriggerDefinition*/, |
|
150 CXnDomNode& /*aEvent*/ ) |
|
151 { |
|
152 // Default empty implementation |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CXnAppUiAdapter::LoadPublisher |
|
157 // |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 EXPORT_C void CXnAppUiAdapter::LoadPublisher( |
|
161 const TAiFwPublisherInfo& /*aPublisher*/ ) |
|
162 { |
|
163 // Default empty implementation |
|
164 } |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // CXnAppUiAdapter::DestroyPublisher |
|
168 // |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 EXPORT_C void CXnAppUiAdapter::DestroyPublisher( |
|
172 const TAiFwPublisherInfo& /*aPublisher*/ ) |
|
173 { |
|
174 // Default empty implementation |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CXnAppUiAdapter::DynInitMenuItemL |
|
179 // |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 EXPORT_C TBool CXnAppUiAdapter::DynInitMenuItemL( const TDesC& /*aItemType*/, |
|
183 RPointerArray< CXnNodeAppIf >* /*aList*/ ) |
|
184 { |
|
185 // Default empty implementation |
|
186 return EFalse; |
|
187 } |
|
188 |
|
189 // ----------------------------------------------------------------------------- |
|
190 // CXnAppUiAdapter::View |
|
191 // |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 EXPORT_C CAknView& CXnAppUiAdapter::View() const |
|
195 { |
|
196 return iImpl->ViewAdapter(); |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CXnAppUiAdapter::HandleEnterEditModeL |
|
201 // |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 EXPORT_C void CXnAppUiAdapter::HandleEnterEditModeL( TBool /*aEnter*/ ) |
|
205 { |
|
206 // Default empty implementation |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CXnAppUiAdapter::HandleEventL |
|
211 // |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 EXPORT_C void CXnAppUiAdapter::HandleEventL( const TDesC& /*aEvent*/, |
|
215 CXnNodeAppIf& /*aDestination*/ ) |
|
216 { |
|
217 // Default empty implementation |
|
218 } |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // CXnAppUiAdapter::PublisherInfo |
|
222 // |
|
223 // ----------------------------------------------------------------------------- |
|
224 // |
|
225 EXPORT_C TInt CXnAppUiAdapter::PublisherInfo( CXnNodeAppIf& /*aNode*/, |
|
226 THsPublisherInfo& /*aInfo*/ ) |
|
227 { |
|
228 // Default empty implementation |
|
229 return KErrNotSupported; |
|
230 } |
|
231 |
|
232 // ----------------------------------------------------------------------------- |
|
233 // CXnAppUiAdapter::PublisherInfo |
|
234 // |
|
235 // ----------------------------------------------------------------------------- |
|
236 // |
|
237 TInt CXnAppUiAdapter::PublisherInfo( CXnNode& aNode, |
|
238 THsPublisherInfo& aInfo ) |
|
239 { |
|
240 CXnNodeAppIf* node( NULL ); |
|
241 |
|
242 TRAPD( err, node = &aNode.AppIfL() ); |
|
243 |
|
244 if ( node ) |
|
245 { |
|
246 err = PublisherInfo( *node, aInfo ); |
|
247 } |
|
248 |
|
249 return err; |
|
250 } |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // CXnAppUiAdapter::RemoveViewL |
|
254 // |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 EXPORT_C void CXnAppUiAdapter::RemoveViewL( CAknView& aView ) |
|
258 { |
|
259 if ( iExitingApp ) return; // framework will destroy view |
|
260 TVwsViewId activeViewId(KNullUid,KNullUid); |
|
261 TBool activateDefaultView( EFalse ); |
|
262 if ( GetActiveViewId( activeViewId ) == KErrNone && |
|
263 activeViewId.iViewUid == aView.Id() ) |
|
264 { |
|
265 // currently active, deactivate |
|
266 activateDefaultView = ETrue; |
|
267 DeactivateActiveViewIfOwnerMatchL(); |
|
268 } |
|
269 |
|
270 if ( iView == &aView ) { iView = NULL; } |
|
271 CCoeAppUi::DeregisterView( aView ); |
|
272 |
|
273 const TInt count( iViews->Count() ); |
|
274 for ( TInt i = 0; i < count; ++i ) |
|
275 { |
|
276 CAknView* view( iViews->At( i ) ); |
|
277 if ( view == &aView && |
|
278 view->Id() == aView.Id() ) |
|
279 { |
|
280 iViews->Delete( i ); |
|
281 delete view; |
|
282 view = NULL; |
|
283 break; |
|
284 } |
|
285 } |
|
286 |
|
287 if ( activateDefaultView ) |
|
288 { |
|
289 // check which view is active now. |
|
290 activeViewId = TVwsViewId(KNullUid,KNullUid); |
|
291 GetActiveViewId( activeViewId ); |
|
292 |
|
293 TVwsViewId defaultViewId( KNullUid,KNullUid ); |
|
294 // activate default if needed |
|
295 if ( GetDefaultViewId( defaultViewId ) == KErrNone && |
|
296 activeViewId != defaultViewId ) |
|
297 { |
|
298 ActivateViewL( defaultViewId ); |
|
299 } |
|
300 } |
|
301 } |
|
302 |
|
303 // ----------------------------------------------------------------------------- |
|
304 // CXnAppUiAdapter::PrepareToExit |
|
305 // |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 EXPORT_C void CXnAppUiAdapter::PrepareToExit() |
|
309 { |
|
310 iExitingApp = ETrue; |
|
311 |
|
312 if ( iImpl ) |
|
313 { |
|
314 iImpl->UiStateListener().PrepareToExit(); |
|
315 |
|
316 iImpl->ViewAdapter().PrepareToExit(); |
|
317 |
|
318 iImpl->HsContentControlFactory()->PrepareToExit(); |
|
319 } |
|
320 |
|
321 CAknViewAppUi::PrepareToExit(); |
|
322 } |
|
323 |
|
324 // ----------------------------------------------------------------------------- |
|
325 // CXnAppUiAdapter::HandleUiReadyEventL |
|
326 // |
|
327 // ----------------------------------------------------------------------------- |
|
328 // |
|
329 EXPORT_C void CXnAppUiAdapter::HandleUiReadyEventL() |
|
330 { |
|
331 // Default empty implementation |
|
332 } |
|
333 |
|
334 // ----------------------------------------------------------------------------- |
|
335 // CXnAppUiAdapter::ProcessMessageL |
|
336 // |
|
337 // ----------------------------------------------------------------------------- |
|
338 // |
|
339 EXPORT_C void CXnAppUiAdapter::ProcessMessageL( TUid aUid, |
|
340 const TDesC8& /*aParams*/ ) |
|
341 { |
|
342 if ( aUid.iUid == KUidApaMessageSwitchOpenFileValue ) |
|
343 { |
|
344 // activate default homescreen view. |
|
345 // customcontrol is set so that window group order is not changed |
|
346 SetCustomControl( 1 ); |
|
347 TRAP_IGNORE( ActivateLocalViewL( |
|
348 View().Id(), TUid::Null(), KActivateDefaultView() ) ); |
|
349 SetCustomControl( 0 ); |
|
350 } |
|
351 } |
|
352 |
|
353 // ----------------------------------------------------------------------------- |
|
354 // CXnAppUiAdapter::ReloadUiL |
|
355 // |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 void CXnAppUiAdapter::ReloadUiL() |
|
359 { |
|
360 iImpl->ReloadUiL(); |
|
361 } |
|
362 |
|
363 // ----------------------------------------------------------------------------- |
|
364 // CXnAppUiAdapter::UiEngine |
|
365 // |
|
366 // ----------------------------------------------------------------------------- |
|
367 // |
|
368 CXnUiEngine& CXnAppUiAdapter::UiEngine() const |
|
369 { |
|
370 return iImpl->UiEngine(); |
|
371 } |
|
372 |
|
373 // ----------------------------------------------------------------------------- |
|
374 // CXnAppUiAdapter::ViewManager |
|
375 // |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 CXnViewManager& CXnAppUiAdapter::ViewManager() const |
|
379 { |
|
380 return iImpl->ViewManager(); |
|
381 } |
|
382 |
|
383 // ----------------------------------------------------------------------------- |
|
384 // CXnAppUiAdapter::ViewAdapter |
|
385 // |
|
386 // ----------------------------------------------------------------------------- |
|
387 // |
|
388 CXnViewAdapter& CXnAppUiAdapter::ViewAdapter() const |
|
389 { |
|
390 return iImpl->ViewAdapter(); |
|
391 } |
|
392 |
|
393 // ----------------------------------------------------------------------------- |
|
394 // CXnAppUiAdapter::UiStateListener |
|
395 // |
|
396 // ----------------------------------------------------------------------------- |
|
397 // |
|
398 CXnUiStateListener& CXnAppUiAdapter::UiStateListener() const |
|
399 { |
|
400 return iImpl->UiStateListener(); |
|
401 } |
|
402 |
|
403 // ----------------------------------------------------------------------------- |
|
404 // CXnAppUiAdapter::HsContentController |
|
405 // |
|
406 // ----------------------------------------------------------------------------- |
|
407 // |
|
408 MHsContentControlUi* CXnAppUiAdapter::HsContentController( |
|
409 const TDesC8& aType ) const |
|
410 { |
|
411 return iImpl->HsContentController( aType ); |
|
412 } |
|
413 |
|
414 // ----------------------------------------------------------------------------- |
|
415 // CXnAppUiAdapter::EffectManager |
|
416 // |
|
417 // ----------------------------------------------------------------------------- |
|
418 // |
|
419 CXnEffectManager* CXnAppUiAdapter::EffectManager() const |
|
420 { |
|
421 return iImpl->EffectManager(); |
|
422 } |
|
423 |
|
424 // ----------------------------------------------------------------------------- |
|
425 // CXnAppUiAdapter::HsContentControlSrv |
|
426 // |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 MHsContentControl* CXnAppUiAdapter::HsContentControlSrv() const |
|
430 { |
|
431 return iImpl->HsContentControlSrv(); |
|
432 } |
|
433 |
|
434 // ----------------------------------------------------------------------------- |
|
435 // CXnAppUiAdapter::ItemActivator |
|
436 // |
|
437 // ----------------------------------------------------------------------------- |
|
438 // |
|
439 CXnItemActivator& CXnAppUiAdapter::ItemActivator() const |
|
440 { |
|
441 return iImpl->ItemActivator(); |
|
442 } |
|
443 |
|
444 // ----------------------------------------------------------------------------- |
|
445 // CXnAppUiAdapter::FocusShown |
|
446 // |
|
447 // ----------------------------------------------------------------------------- |
|
448 // |
|
449 TBool CXnAppUiAdapter::FocusShown() const |
|
450 { |
|
451 return iImpl->ViewAdapter().FocusControl().IsVisible(); |
|
452 } |
|
453 |
|
454 // ----------------------------------------------------------------------------- |
|
455 // CXnAppUiAdapter::HideFocus |
|
456 // |
|
457 // ----------------------------------------------------------------------------- |
|
458 // |
|
459 void CXnAppUiAdapter::HideFocus() |
|
460 { |
|
461 return iImpl->ViewAdapter().FocusControl().MakeVisible( EFalse ); |
|
462 } |
|
463 |
|
464 // ----------------------------------------------------------------------------- |
|
465 // CXnAppUiAdapter::ShowFocus |
|
466 // |
|
467 // ----------------------------------------------------------------------------- |
|
468 // |
|
469 void CXnAppUiAdapter::ShowFocus() |
|
470 { |
|
471 return iImpl->ViewAdapter().FocusControl().MakeVisible( ETrue ); |
|
472 } |
|
473 |
|
474 // End of file |