author | Dario Sestito <darios@symbian.org> |
Fri, 17 Sep 2010 15:37:16 +0100 | |
branch | RCL_3 |
changeset 89 | 9f918e984081 |
parent 88 | 3321d3e205b6 |
child 93 | b01126ce0bec |
permissions | -rw-r--r-- |
83 | 1 |
/* |
2 |
* Copyright (c) 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: Data class to hold application root configuration info |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// System includes |
|
19 |
||
20 |
||
21 |
// User includes |
|
22 |
#include "xnviewmanager.h" |
|
23 |
#include "xnviewdata.h" |
|
24 |
||
25 |
#include "xnappuiadapter.h" |
|
26 |
#include "xncontroladapter.h" |
|
27 |
#include "xnuiengine.h" |
|
28 |
#include "xnecomhandler.h" |
|
29 |
#include "xncomposer.h" |
|
30 |
#include "xnodtparser.h" |
|
31 |
||
32 |
#include "xndomdocument.h" |
|
33 |
#include "xndomnode.h" |
|
34 |
#include "xnodt.h" |
|
35 |
||
36 |
#include "xnnode.h" |
|
37 |
#include "xntype.h" |
|
38 |
||
39 |
#include "xnpanic.h" |
|
40 |
||
41 |
#include "xnplugindata.h" |
|
42 |
#include "xnrootdata.h" |
|
43 |
||
44 |
#include "debug.h" |
|
45 |
||
46 |
// Constants |
|
47 |
const TInt KScheduleInterval( 2000000 ); |
|
88
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
48 |
_LIT8( KTemplateViewUID, "0x20026f50" ); |
83 | 49 |
|
50 |
// ============================ LOCAL FUNCTIONS ================================ |
|
51 |
||
52 |
// ============================ MEMBER FUNCTIONS =============================== |
|
53 |
// ----------------------------------------------------------------------------- |
|
54 |
// CXnRootData::NewL() |
|
55 |
// Two-phased constructor. |
|
56 |
// ----------------------------------------------------------------------------- |
|
57 |
// |
|
58 |
CXnRootData* CXnRootData::NewL( CXnViewManager& aManager, |
|
59 |
TUid aApplicationUid ) |
|
60 |
{ |
|
61 |
CXnRootData* self = CXnRootData::NewLC( aManager, aApplicationUid ); |
|
62 |
CleanupStack::Pop( self ); |
|
63 |
return self; |
|
64 |
} |
|
65 |
||
66 |
// ----------------------------------------------------------------------------- |
|
67 |
// CXnRootData::NewLC() |
|
68 |
// Two-phased constructor. |
|
69 |
// ----------------------------------------------------------------------------- |
|
70 |
// |
|
71 |
CXnRootData* CXnRootData::NewLC( CXnViewManager& aManager, |
|
72 |
TUid aApplicationUid ) |
|
73 |
{ |
|
74 |
CXnRootData* self = new ( ELeave ) CXnRootData( aManager, aApplicationUid ); |
|
75 |
CleanupStack::PushL( self ); |
|
76 |
self->ConstructL(); |
|
77 |
return self; |
|
78 |
} |
|
79 |
||
80 |
// ----------------------------------------------------------------------------- |
|
81 |
// CXnRootData::CXnRootData() |
|
82 |
// C++ default constructor |
|
83 |
// ----------------------------------------------------------------------------- |
|
84 |
// |
|
85 |
CXnRootData::CXnRootData( CXnViewManager& aManager, TUid aApplicationUid ) |
|
86 |
: CXnPluginData( aManager ), iApplicationUid( aApplicationUid ) |
|
87 |
{ |
|
88 |
iFlags.Clear( EIsRemovable ); |
|
89 |
} |
|
90 |
||
91 |
// ----------------------------------------------------------------------------- |
|
92 |
// CXnRootData::~CXnRootData() |
|
93 |
// C++ default destructor. |
|
94 |
// ----------------------------------------------------------------------------- |
|
95 |
// |
|
96 |
CXnRootData::~CXnRootData() |
|
97 |
{ |
|
88
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
98 |
delete iTemplateViewUid; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
99 |
iTemplateViewUid = NULL; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
100 |
|
83 | 101 |
if ( iLoadTimer ) |
102 |
{ |
|
103 |
iLoadTimer->Cancel(); |
|
104 |
} |
|
105 |
||
106 |
delete iLoadTimer; |
|
107 |
||
108 |
if ( iDestroyTimer ) |
|
109 |
{ |
|
110 |
iDestroyTimer->Cancel(); |
|
111 |
} |
|
112 |
||
113 |
delete iDestroyTimer; |
|
114 |
||
115 |
iViewsToDestroy.ResetAndDestroy(); |
|
116 |
||
117 |
iPluginsData.ResetAndDestroy(); |
|
118 |
||
119 |
delete iODT->DomDocument().RootNode()->LayoutNode(); |
|
120 |
||
121 |
delete iODT; |
|
122 |
||
123 |
delete iParser; |
|
124 |
delete iEcomHandler; |
|
125 |
||
126 |
User::Heap().Compress(); |
|
127 |
} |
|
128 |
||
129 |
// ----------------------------------------------------------------------------- |
|
130 |
// CXnRootData::ConstructL() |
|
131 |
// 2nd phase constructor |
|
132 |
// ----------------------------------------------------------------------------- |
|
133 |
// |
|
134 |
void CXnRootData::ConstructL() |
|
135 |
{ |
|
136 |
CXnPluginData::ConstructL(); |
|
137 |
||
138 |
iEcomHandler = CXnEcomHandler::NewL(); |
|
139 |
||
140 |
iParser = CXnODTParser::NewL( iManager, *iEcomHandler ); |
|
141 |
||
142 |
iLoadTimer = CPeriodic::NewL( CActive::EPriorityLow ); |
|
143 |
iDestroyTimer = CPeriodic::NewL( CActive::EPriorityLow ); |
|
144 |
} |
|
145 |
||
146 |
// ----------------------------------------------------------------------------- |
|
147 |
// CXnRootData::Load() |
|
148 |
// |
|
149 |
// ----------------------------------------------------------------------------- |
|
150 |
// |
|
151 |
TInt CXnRootData::Load() |
|
152 |
{ |
|
153 |
if ( Occupied() ) |
|
154 |
{ |
|
155 |
return KErrInUse; |
|
156 |
} |
|
157 |
||
158 |
TInt err( KErrNone ); |
|
159 |
||
160 |
// Load application root configuration |
|
161 |
TRAP( err, iODT = iManager.Composer().ComposeRootL( *this ) ); |
|
162 |
||
163 |
if ( !iODT ) |
|
164 |
{ |
|
165 |
// Can't recover |
|
166 |
return EXnInvalidConfiguration; |
|
167 |
} |
|
168 |
||
169 |
if ( !err ) |
|
170 |
{ |
|
171 |
TRAP( err, iManager.Parser().LoadRootL( *this, iApplicationUid ) ); |
|
172 |
} |
|
173 |
||
174 |
if ( !err ) |
|
175 |
{ |
|
176 |
for ( TInt i = 0; i < iPluginsData.Count(); i++ ) |
|
177 |
{ |
|
178 |
CXnViewData* plugin( |
|
179 |
static_cast< CXnViewData* >( iPluginsData[ i ] ) ); |
|
180 |
||
181 |
if ( plugin->Initial() ) |
|
182 |
{ |
|
183 |
err = plugin->Load(); |
|
184 |
||
185 |
if ( plugin->Occupied() ) |
|
186 |
{ |
|
187 |
// Initial view is succesfully composed. Some widget plugins |
|
188 |
// may have failed but it doesn't matter as those are removed. |
|
189 |
// Rest of the views will be loaded asynchronously by the RunLoadL() |
|
190 |
return err; |
|
191 |
} |
|
192 |
||
193 |
// Initial view failed |
|
194 |
iManager.RemoveFaultyView( plugin ); |
|
195 |
||
196 |
delete plugin; |
|
197 |
plugin = NULL; |
|
198 |
break; |
|
199 |
} |
|
200 |
} |
|
201 |
||
202 |
// Initial view loading failed, fallback to load any of the views |
|
203 |
while( iPluginsData.Count() ) |
|
204 |
{ |
|
205 |
CXnViewData* plugin( |
|
206 |
static_cast< CXnViewData* >( iPluginsData[ 0 ] ) ); |
|
207 |
||
208 |
plugin->SetInitial(); |
|
209 |
||
210 |
// Ignore error |
|
211 |
plugin->Load(); |
|
212 |
||
213 |
if ( plugin->Occupied() ) |
|
214 |
{ |
|
215 |
// Return error because of fallback condition |
|
216 |
return KXnErrViewPluginFailure; |
|
217 |
} |
|
218 |
||
219 |
// View failed, remove it |
|
220 |
iManager.RemoveFaultyView( plugin ); |
|
221 |
||
222 |
delete plugin; |
|
223 |
plugin = NULL; |
|
224 |
} |
|
225 |
} |
|
226 |
else if ( err == KErrNoMemory ) |
|
227 |
{ |
|
228 |
return err; |
|
229 |
} |
|
230 |
||
231 |
// Configuration loading failed totally |
|
232 |
return EXnInvalidConfiguration; |
|
233 |
} |
|
234 |
||
235 |
// ----------------------------------------------------------------------------- |
|
236 |
// CXnRootData::Destroy() |
|
237 |
// |
|
238 |
// ----------------------------------------------------------------------------- |
|
239 |
// |
|
240 |
void CXnRootData::Destroy() |
|
241 |
{ |
|
242 |
iLoadTimer->Cancel(); |
|
243 |
iDestroyTimer->Cancel(); |
|
244 |
||
245 |
iFlags.Set( EIsDispose ); |
|
246 |
||
247 |
iDestroyTimer->Start( TTimeIntervalMicroSeconds32( 0 ), |
|
248 |
TTimeIntervalMicroSeconds32( 0 ), |
|
249 |
TCallBack( RunDestroyL, this ) ); |
|
250 |
} |
|
251 |
||
252 |
// ----------------------------------------------------------------------------- |
|
253 |
// CXnRootData::LoadRemainingViews() |
|
254 |
// |
|
255 |
// ----------------------------------------------------------------------------- |
|
256 |
// |
|
88
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
257 |
void CXnRootData::LoadRemainingViewsL() |
83 | 258 |
{ |
259 |
if ( iFlags.IsClear( EIsDispose ) ) |
|
260 |
{ |
|
261 |
if ( !AllViewsLoaded() ) |
|
262 |
{ |
|
263 |
iLoadForward = ETrue; |
|
264 |
iLoadError = KErrNone; |
|
265 |
||
266 |
iLoadTimer->Cancel(); |
|
267 |
||
268 |
iLoadTimer->Start( TTimeIntervalMicroSeconds32( KScheduleInterval ), |
|
269 |
TTimeIntervalMicroSeconds32( KScheduleInterval ), |
|
270 |
TCallBack( RunLoadL, this ) ); |
|
271 |
} |
|
272 |
else |
|
273 |
{ |
|
274 |
iManager.NotifyAllViewsLoadedL(); |
|
275 |
} |
|
276 |
} |
|
277 |
} |
|
278 |
||
279 |
// ----------------------------------------------------------------------------- |
|
280 |
// CXnRootData::CancelLoadRemainingViews() |
|
281 |
// |
|
282 |
// ----------------------------------------------------------------------------- |
|
283 |
// |
|
284 |
void CXnRootData::CancelLoadRemainingViews() |
|
285 |
{ |
|
286 |
if ( iFlags.IsClear( EIsDispose ) && !AllViewsLoaded() ) |
|
287 |
{ |
|
288 |
iLoadTimer->Cancel(); |
|
289 |
} |
|
290 |
} |
|
291 |
||
292 |
// ----------------------------------------------------------------------------- |
|
293 |
// CXnRootData::ODT() |
|
294 |
// |
|
295 |
// ----------------------------------------------------------------------------- |
|
296 |
// |
|
297 |
CXnODT* CXnRootData::ODT() const |
|
298 |
{ |
|
299 |
return iODT; |
|
300 |
} |
|
301 |
||
302 |
// ----------------------------------------------------------------------------- |
|
303 |
// CXnRootData::RootNode() |
|
304 |
// |
|
305 |
// ----------------------------------------------------------------------------- |
|
306 |
// |
|
307 |
CXnNode* CXnRootData::RootNode() const |
|
308 |
{ |
|
309 |
return iODT->DomDocument().RootNode()->LayoutNode(); |
|
310 |
} |
|
311 |
||
312 |
// ----------------------------------------------------------------------------- |
|
313 |
// CXnRootData::Parser() |
|
314 |
// |
|
315 |
// ----------------------------------------------------------------------------- |
|
316 |
// |
|
317 |
CXnODTParser& CXnRootData::Parser() const |
|
318 |
{ |
|
319 |
return *iParser; |
|
320 |
} |
|
321 |
||
322 |
// ----------------------------------------------------------------------------- |
|
323 |
// CXnRootData::EcomHandler() |
|
324 |
// |
|
325 |
// ----------------------------------------------------------------------------- |
|
326 |
// |
|
327 |
CXnEcomHandler& CXnRootData::EcomHandler() const |
|
328 |
{ |
|
329 |
return *iEcomHandler; |
|
330 |
} |
|
331 |
||
332 |
// ----------------------------------------------------------------------------- |
|
333 |
// CXnRootData::ActiveViewData() |
|
334 |
// Finds the active view data |
|
335 |
// ----------------------------------------------------------------------------- |
|
336 |
// |
|
337 |
CXnViewData& CXnRootData::ActiveViewData() const |
|
338 |
{ |
|
339 |
for ( TInt i = 0; i < iPluginsData.Count(); i++ ) |
|
340 |
{ |
|
341 |
CXnViewData& plugin( static_cast< CXnViewData& >( *iPluginsData[i] ) ); |
|
342 |
||
343 |
if ( plugin.Active() ) |
|
344 |
{ |
|
345 |
return plugin; |
|
346 |
} |
|
347 |
} |
|
348 |
||
349 |
// If active is not set, then try initial |
|
350 |
for ( TInt i = 0; i < iPluginsData.Count(); i++ ) |
|
351 |
{ |
|
352 |
CXnViewData& plugin( static_cast< CXnViewData& >( *iPluginsData[i] ) ); |
|
353 |
||
354 |
if ( plugin.Initial() ) |
|
355 |
{ |
|
356 |
return plugin; |
|
357 |
} |
|
358 |
} |
|
359 |
||
360 |
Panic( EXnInvalidConfiguration ); |
|
361 |
||
362 |
// Remove compiler warning |
|
363 |
return static_cast< CXnViewData& > ( *iPluginsData[0] ); |
|
364 |
} |
|
365 |
||
366 |
// ----------------------------------------------------------------------------- |
|
367 |
// CXnRootData::PreviousViewData() |
|
368 |
// Finds the active view data |
|
369 |
// ----------------------------------------------------------------------------- |
|
370 |
// |
|
371 |
CXnViewData& CXnRootData::PreviousViewData() const |
|
372 |
{ |
|
373 |
CXnViewData& active( ActiveViewData() ); |
|
374 |
||
375 |
TInt count( iPluginsData.Count() ); |
|
376 |
||
377 |
if ( count == 1 ) |
|
378 |
{ |
|
379 |
// Only one view available |
|
380 |
return active; |
|
381 |
} |
|
382 |
||
383 |
TInt index( iPluginsData.Find( &active ) ); |
|
384 |
||
385 |
if ( index == 0 ) |
|
386 |
{ |
|
387 |
// Return the last |
|
388 |
return static_cast< CXnViewData& >( *iPluginsData[ count - 1 ] ); |
|
389 |
} |
|
390 |
else |
|
391 |
{ |
|
392 |
// Return the previous |
|
393 |
return static_cast< CXnViewData& >( *iPluginsData[ index - 1 ] ); |
|
394 |
} |
|
395 |
} |
|
396 |
||
397 |
// ----------------------------------------------------------------------------- |
|
398 |
// CXnRootData::NextViewData() |
|
399 |
// Finds the active view data |
|
400 |
// ----------------------------------------------------------------------------- |
|
401 |
// |
|
402 |
CXnViewData& CXnRootData::NextViewData() const |
|
403 |
{ |
|
404 |
CXnViewData& active( ActiveViewData() ); |
|
405 |
||
406 |
TInt count( iPluginsData.Count() ); |
|
407 |
||
408 |
if ( count == 1 ) |
|
409 |
{ |
|
410 |
// Only one view available |
|
411 |
return active; |
|
412 |
} |
|
413 |
||
414 |
TInt index( iPluginsData.Find( &active ) ); |
|
415 |
||
416 |
if ( index + 1 < count ) |
|
417 |
{ |
|
418 |
// Return the next |
|
419 |
return static_cast< CXnViewData& >( *iPluginsData[ index + 1 ] ); |
|
420 |
} |
|
421 |
else |
|
422 |
{ |
|
423 |
// Return the first |
|
424 |
return static_cast< CXnViewData& >( *iPluginsData[ 0 ] ); |
|
425 |
} |
|
426 |
} |
|
427 |
||
428 |
// ----------------------------------------------------------------------------- |
|
429 |
// CXnRootData::DestroyViewData() |
|
430 |
// Sets view data to be destroyed |
|
431 |
// ----------------------------------------------------------------------------- |
|
432 |
// |
|
433 |
void CXnRootData::DestroyViewData( CXnViewData* aViewData ) |
|
434 |
{ |
|
435 |
TInt index( iPluginsData.Find( aViewData ) ); |
|
436 |
||
437 |
if ( index != KErrNotFound ) |
|
438 |
{ |
|
439 |
iPluginsData.Remove( index ); |
|
440 |
||
88
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
441 |
if ( iViewsToDestroy.Find( aViewData ) == KErrNotFound && |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
442 |
iViewsToDestroy.Append( aViewData ) == KErrNone ) |
83 | 443 |
{ |
444 |
iDestroyTimer->Cancel(); |
|
445 |
||
446 |
iDestroyTimer->Start( TTimeIntervalMicroSeconds32( 0 ), |
|
447 |
TTimeIntervalMicroSeconds32( 0 ), |
|
448 |
TCallBack( RunDestroyL, this ) ); |
|
449 |
} |
|
450 |
} |
|
451 |
} |
|
452 |
||
453 |
// ----------------------------------------------------------------------------- |
|
454 |
// CXnRootData::AllViewsLoaded() |
|
455 |
// |
|
456 |
// ----------------------------------------------------------------------------- |
|
457 |
// |
|
458 |
TBool CXnRootData::AllViewsLoaded() const |
|
459 |
{ |
|
460 |
for ( TInt i = 0; i < iPluginsData.Count(); i++ ) |
|
461 |
{ |
|
462 |
if ( !iPluginsData[i]->Occupied() ) |
|
463 |
{ |
|
464 |
return EFalse; |
|
465 |
} |
|
466 |
} |
|
467 |
||
468 |
return ETrue; |
|
469 |
} |
|
470 |
||
471 |
// ----------------------------------------------------------------------------- |
|
472 |
// CXnRootData::AllViewsDestroyed() |
|
473 |
// |
|
474 |
// ----------------------------------------------------------------------------- |
|
475 |
// |
|
476 |
TBool CXnRootData::AllViewsDestroyed() const |
|
477 |
{ |
|
478 |
return ( iPluginsData.Count() == 0 ) && iFlags.IsSet( EIsDispose ); |
|
479 |
} |
|
480 |
||
481 |
// ----------------------------------------------------------------------------- |
|
482 |
// CXnRootData::RunLoadL() |
|
483 |
// |
|
484 |
// ----------------------------------------------------------------------------- |
|
485 |
// |
|
486 |
/* static */ TInt CXnRootData::RunLoadL( TAny* aAny ) |
|
487 |
{ |
|
488 |
__PRINTS( "*** CXnRootData::RunLoadL" ); |
|
489 |
||
490 |
CXnRootData* self = static_cast< CXnRootData* >( aAny ); |
|
491 |
||
492 |
if ( self->iFlags.IsSet( EIsDispose ) ) |
|
493 |
{ |
|
494 |
self->iLoadTimer->Cancel(); |
|
495 |
return KErrNone; |
|
496 |
} |
|
497 |
||
498 |
CXnPluginData& active( self->ActiveViewData() ); |
|
499 |
||
500 |
CXnPluginData* toLoad( NULL ); |
|
501 |
||
502 |
TInt index( self->iPluginsData.Find( &active ) ); |
|
503 |
TInt count( self->iPluginsData.Count() ); |
|
504 |
||
505 |
if ( self->iLoadForward ) |
|
506 |
{ |
|
507 |
self->iLoadForward = EFalse; |
|
508 |
||
509 |
// Start from the next one |
|
510 |
index = index + 1; |
|
511 |
||
512 |
if ( index == count ) |
|
513 |
{ |
|
514 |
index = 0; |
|
515 |
} |
|
516 |
||
517 |
for ( TInt i = index; i < self->iPluginsData.Count(); i++ ) |
|
518 |
{ |
|
519 |
if ( !self->iPluginsData[i]->Occupied() ) |
|
520 |
{ |
|
521 |
toLoad = self->iPluginsData[i]; |
|
522 |
break; |
|
523 |
} |
|
524 |
} |
|
525 |
} |
|
526 |
else |
|
527 |
{ |
|
528 |
self->iLoadForward = ETrue; |
|
529 |
||
530 |
if ( index == 0 ) |
|
531 |
{ |
|
532 |
index = count - 1; |
|
533 |
} |
|
534 |
else |
|
535 |
{ |
|
536 |
index = index - 1; |
|
537 |
} |
|
538 |
||
539 |
for ( TInt i = index; i >= 0; i-- ) |
|
540 |
{ |
|
541 |
if ( !self->iPluginsData[i]->Occupied() ) |
|
542 |
{ |
|
543 |
toLoad = self->iPluginsData[i]; |
|
544 |
break; |
|
545 |
} |
|
546 |
} |
|
547 |
} |
|
548 |
||
549 |
TInt err( KErrNone ); |
|
550 |
||
551 |
if ( !self->AllViewsLoaded() && toLoad ) |
|
552 |
{ |
|
553 |
err = toLoad->Load(); |
|
554 |
||
555 |
if ( err ) |
|
556 |
{ |
|
557 |
self->iLoadError = err; |
|
558 |
} |
|
559 |
} |
|
560 |
||
561 |
if ( err == KXnErrViewPluginFailure ) |
|
562 |
{ |
|
563 |
// Remove the view |
|
564 |
self->iManager.RemoveFaultyView( static_cast< CXnViewData* >( toLoad ) ); |
|
565 |
||
566 |
delete toLoad; |
|
567 |
toLoad = NULL; |
|
568 |
} |
|
569 |
||
570 |
if ( self->AllViewsLoaded() || err == KErrNoMemory ) |
|
571 |
{ |
|
572 |
self->iLoadTimer->Cancel(); |
|
573 |
||
574 |
// Show the error note only once |
|
575 |
self->iManager.HandleErrorNotes( self->iLoadError ); |
|
576 |
||
577 |
self->iLoadError = KErrNone; |
|
578 |
self->iManager.NotifyAllViewsLoadedL(); |
|
579 |
} |
|
580 |
||
581 |
__PRINTS( "*** CXnRootData::RunLoadL - done" ); |
|
582 |
||
583 |
return KErrNone; |
|
584 |
} |
|
585 |
||
586 |
// ----------------------------------------------------------------------------- |
|
587 |
// CXnRootData::SetMaxPages( TInt32 aPages ) |
|
588 |
// |
|
589 |
// ----------------------------------------------------------------------------- |
|
590 |
// |
|
591 |
void CXnRootData::SetMaxPages( TInt32 aPages ) |
|
592 |
{ |
|
593 |
iMaxPages = aPages; |
|
594 |
} |
|
595 |
||
596 |
// ----------------------------------------------------------------------------- |
|
597 |
// CXnRootData::MaxPages() |
|
598 |
// |
|
599 |
// ----------------------------------------------------------------------------- |
|
600 |
// |
|
601 |
TInt32 CXnRootData::MaxPages() |
|
602 |
{ |
|
603 |
return iMaxPages; |
|
604 |
} |
|
605 |
||
88
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
606 |
// --------------------------------------------------------------------------- |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
607 |
// Returns TemplateViewUid |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
608 |
// --------------------------------------------------------------------------- |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
609 |
// |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
610 |
const TDesC8& CXnRootData::TemplateViewUid() const |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
611 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
612 |
const TDesC8& templateViewUid = KTemplateViewUID; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
613 |
return iTemplateViewUid ? *iTemplateViewUid : templateViewUid; // qhd uid |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
614 |
}; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
615 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
616 |
// --------------------------------------------------------------------------- |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
617 |
// Sets TemplateViewUid |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
618 |
// --------------------------------------------------------------------------- |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
619 |
// |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
620 |
void CXnRootData::SetTemplateViewUidL( const TDesC8& aTemplateViewUid ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
621 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
622 |
delete iTemplateViewUid; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
623 |
iTemplateViewUid = NULL; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
624 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
625 |
iTemplateViewUid = aTemplateViewUid.AllocL(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
626 |
}; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
627 |
|
83 | 628 |
// ----------------------------------------------------------------------------- |
629 |
// CXnRootData::RunDestroyL() |
|
630 |
// |
|
631 |
// ----------------------------------------------------------------------------- |
|
632 |
// |
|
633 |
/* static */ TInt CXnRootData::RunDestroyL( TAny* aAny ) |
|
634 |
{ |
|
635 |
__PRINTS( "*** CXnRootData::RunDestroyL" ); |
|
636 |
||
637 |
CXnRootData* self = static_cast< CXnRootData* >( aAny ); |
|
638 |
||
639 |
if( self->iFlags.IsSet( EIsDispose ) ) |
|
640 |
{ |
|
641 |
for ( TInt i = 0; i < self->iViewsToDestroy.Count(); i++ ) |
|
642 |
{ |
|
643 |
if ( self->iPluginsData.Find( |
|
644 |
self->iViewsToDestroy[i] ) == KErrNotFound ) |
|
645 |
{ |
|
646 |
// These must be deleted also |
|
647 |
self->iPluginsData.AppendL( self->iViewsToDestroy[i] ); |
|
648 |
} |
|
649 |
} |
|
650 |
||
651 |
self->iViewsToDestroy.Reset(); |
|
652 |
||
653 |
if ( self->iPluginsData.Count() > 0 ) |
|
654 |
{ |
|
655 |
CXnPluginData* toDestroy( self->iPluginsData[0] ); |
|
656 |
||
657 |
delete toDestroy; |
|
658 |
toDestroy = NULL; |
|
659 |
||
660 |
self->iPluginsData.Remove( 0 ); |
|
661 |
||
662 |
User::Heap().Compress(); |
|
663 |
} |
|
664 |
||
665 |
if ( self->AllViewsDestroyed() ) |
|
666 |
{ |
|
667 |
// All done |
|
668 |
delete self; |
|
669 |
} |
|
670 |
} |
|
671 |
else |
|
672 |
{ |
|
673 |
if ( self->iViewsToDestroy.Count() > 0 ) |
|
674 |
{ |
|
675 |
CXnPluginData* toDestroy( self->iViewsToDestroy[0] ); |
|
676 |
||
677 |
delete toDestroy; |
|
678 |
toDestroy = NULL; |
|
679 |
||
680 |
self->iViewsToDestroy.Remove( 0 ); |
|
681 |
||
682 |
User::Heap().Compress(); |
|
683 |
} |
|
684 |
||
685 |
if ( self->iViewsToDestroy.Count() == 0 ) |
|
686 |
{ |
|
687 |
if ( self->iFlags.IsClear( EIsDispose ) ) |
|
688 |
{ |
|
689 |
self->iDestroyTimer->Cancel(); |
|
690 |
} |
|
691 |
} |
|
692 |
} |
|
693 |
||
694 |
__PRINTS( "*** CXnRootData::RunDestroyL - done" ); |
|
695 |
||
696 |
return KErrNone; |
|
697 |
} |
|
698 |
||
699 |
// End of file |
|
700 |