34
|
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: View Manager
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// System includes
|
|
19 |
#include <startupdomainpskeys.h>
|
|
20 |
#include <AknUtils.h>
|
|
21 |
#include <AknsWallpaperUtils.h>
|
|
22 |
#include <AknSkinsInternalCRKeys.h>
|
|
23 |
#include <StringLoader.h>
|
|
24 |
#include <xnuiengine.rsg>
|
|
25 |
#include <aknnotewrappers.h>
|
|
26 |
#include <AknsConstants.h>
|
|
27 |
#include <aifwdefs.h>
|
|
28 |
#include <gfxtranseffect/gfxtranseffect.h>
|
|
29 |
#include <akntransitionutils.h>
|
|
30 |
#include <xnuiengine.rsg>
|
|
31 |
|
|
32 |
// User includes
|
|
33 |
#include "xnapplication.h"
|
|
34 |
#include "xnuiengine.h"
|
|
35 |
#include "xnproperty.h"
|
|
36 |
#include "xndomnode.h"
|
|
37 |
#include "xndomlist.h"
|
|
38 |
#include "xnnode.h"
|
|
39 |
#include "xncomposer.h"
|
|
40 |
#include "xneditor.h"
|
|
41 |
#include "xnrootdata.h"
|
|
42 |
#include "xnviewdata.h"
|
|
43 |
#include "xnappuiadapter.h"
|
|
44 |
#include "xncontroladapter.h"
|
|
45 |
#include "xnviewnodeimpl.h"
|
|
46 |
#include "xnviewadapter.h"
|
|
47 |
#include "xnodt.h"
|
|
48 |
#include "xndomdocument.h"
|
|
49 |
#include "xntype.h"
|
|
50 |
#include "xntext.h"
|
|
51 |
#include "xnpanic.h"
|
|
52 |
#include "xnmenu.h"
|
|
53 |
#include "xnmenuadapter.h"
|
|
54 |
#include "xncomponentnodeimpl.h"
|
|
55 |
#include "xnnodepluginif.h"
|
|
56 |
#include "xnoomsyshandler.h"
|
|
57 |
#include "xnbackgroundmanager.h"
|
|
58 |
#include "xneffectmanager.h"
|
|
59 |
#include "xnkeyeventdispatcher.h"
|
|
60 |
|
|
61 |
// Constants
|
|
62 |
_LIT8( KEmptyWidgetUid, "0x2001f47f" );
|
|
63 |
_LIT8( KTemplateViewUID, "0x20026f50" );
|
|
64 |
|
|
65 |
const TInt KPSCategoryUid( 0x200286E3 );
|
|
66 |
const TInt KPSCrashCountKey( 1 );
|
|
67 |
const TInt KStabilityInterval( 60000000 ); // 1 minute
|
|
68 |
const TInt KActivationCompleteInterval( 2000000 ); // 2s
|
|
69 |
const TInt KCrashRestoreDefaultTreshold( 3 );
|
|
70 |
const TInt KCrashRestoreAllTreshold( 4 );
|
|
71 |
const TInt KCrashRestoreRomTreshold( 5 );
|
|
72 |
const TInt KCrashRestoreViewsTreshold( 6 );
|
|
73 |
|
|
74 |
// ============================ LOCAL FUNCTIONS ===============================
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
// BuildTriggerL
|
|
77 |
// Builds a trigger node
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
static CXnNode* BuildTriggerL( CXnUiEngine& aUiEngine,
|
|
81 |
const TDesC8& aStringValue )
|
|
82 |
{
|
|
83 |
CXnNode* node = CXnNode::NewL();
|
|
84 |
CleanupStack::PushL( node );
|
|
85 |
|
|
86 |
CXnType* type = CXnType::NewL( XnPropertyNames::action::KTrigger );
|
|
87 |
CleanupStack::PushL( type );
|
|
88 |
|
|
89 |
CXnNodeImpl* impl = CXnNodeImpl::NewL( type );
|
|
90 |
CleanupStack::Pop( type );
|
|
91 |
|
|
92 |
node->SetImpl( impl );
|
|
93 |
node->SetUiEngine( aUiEngine );
|
|
94 |
|
|
95 |
CXnDomStringPool* sp( aUiEngine.ODT()->DomDocument().StringPool() );
|
|
96 |
|
|
97 |
CXnProperty* name = CXnProperty::NewL(
|
|
98 |
XnPropertyNames::action::trigger::KName, aStringValue,
|
|
99 |
CXnDomPropertyValue::EString, *sp );
|
|
100 |
|
|
101 |
CleanupStack::PushL( name );
|
|
102 |
node->SetPropertyL( name );
|
|
103 |
CleanupStack::Pop( name );
|
|
104 |
|
|
105 |
CXnProperty* value = CXnProperty::NewL(
|
|
106 |
XnPropertyNames::action::KValue,
|
|
107 |
KNullDesC8, CXnDomPropertyValue::EString, *sp );
|
|
108 |
|
|
109 |
CleanupStack::PushL( value );
|
|
110 |
node->SetPropertyL( value );
|
|
111 |
CleanupStack::Pop( value );
|
|
112 |
|
|
113 |
CleanupStack::Pop( node );
|
|
114 |
|
|
115 |
return node;
|
|
116 |
}
|
|
117 |
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
// resolveIconId
|
|
120 |
// -----------------------------------------------------------------------------
|
|
121 |
//
|
|
122 |
static TAknsItemID ResolveIconId( TInt aIndex )
|
|
123 |
{
|
|
124 |
TAknsItemID ret( KAknsIIDNone );
|
|
125 |
switch( aIndex )
|
|
126 |
{
|
|
127 |
case 0:
|
|
128 |
{
|
|
129 |
ret = KAknsIIDQgnHomePage11;
|
|
130 |
}
|
|
131 |
break;
|
|
132 |
case 1:
|
|
133 |
{
|
|
134 |
ret = KAknsIIDQgnHomePage21;
|
|
135 |
}
|
|
136 |
break;
|
|
137 |
case 2:
|
|
138 |
{
|
|
139 |
ret = KAknsIIDQgnHomePage22;
|
|
140 |
}
|
|
141 |
break;
|
|
142 |
case 3:
|
|
143 |
{
|
|
144 |
ret = KAknsIIDQgnHomePage31;
|
|
145 |
}
|
|
146 |
break;
|
|
147 |
case 4:
|
|
148 |
{
|
|
149 |
ret = KAknsIIDQgnHomePage32;
|
|
150 |
}
|
|
151 |
break;
|
|
152 |
case 5:
|
|
153 |
{
|
|
154 |
ret = KAknsIIDQgnHomePage33;
|
|
155 |
}
|
|
156 |
break;
|
|
157 |
case 6:
|
|
158 |
{
|
|
159 |
ret = KAknsIIDQgnHomePage41;
|
|
160 |
}
|
|
161 |
break;
|
|
162 |
case 7:
|
|
163 |
{
|
|
164 |
ret = KAknsIIDQgnHomePage42;
|
|
165 |
}
|
|
166 |
break;
|
|
167 |
case 8:
|
|
168 |
{
|
|
169 |
ret = KAknsIIDQgnHomePage43;
|
|
170 |
}
|
|
171 |
break;
|
|
172 |
case 9:
|
|
173 |
{
|
|
174 |
ret = KAknsIIDQgnHomePage44;
|
|
175 |
}
|
|
176 |
break;
|
|
177 |
case 10:
|
|
178 |
{
|
|
179 |
ret = KAknsIIDQgnHomePage51;
|
|
180 |
}
|
|
181 |
break;
|
|
182 |
case 11:
|
|
183 |
{
|
|
184 |
ret = KAknsIIDQgnHomePage52;
|
|
185 |
}
|
|
186 |
break;
|
|
187 |
case 12:
|
|
188 |
{
|
|
189 |
ret = KAknsIIDQgnHomePage53;
|
|
190 |
}
|
|
191 |
break;
|
|
192 |
case 13:
|
|
193 |
{
|
|
194 |
ret = KAknsIIDQgnHomePage54;
|
|
195 |
}
|
|
196 |
break;
|
|
197 |
case 14:
|
|
198 |
{
|
|
199 |
ret = KAknsIIDQgnHomePage55;
|
|
200 |
}
|
|
201 |
break;
|
|
202 |
case 15:
|
|
203 |
{
|
|
204 |
ret = KAknsIIDQgnHomePage61;
|
|
205 |
}
|
|
206 |
break;
|
|
207 |
case 16:
|
|
208 |
{
|
|
209 |
ret = KAknsIIDQgnHomePage62;
|
|
210 |
}
|
|
211 |
break;
|
|
212 |
case 17:
|
|
213 |
{
|
|
214 |
ret = KAknsIIDQgnHomePage63;
|
|
215 |
}
|
|
216 |
break;
|
|
217 |
case 18:
|
|
218 |
{
|
|
219 |
ret = KAknsIIDQgnHomePage64;
|
|
220 |
}
|
|
221 |
break;
|
|
222 |
case 19:
|
|
223 |
{
|
|
224 |
ret = KAknsIIDQgnHomePage65;
|
|
225 |
}
|
|
226 |
break;
|
|
227 |
case 20:
|
|
228 |
{
|
|
229 |
ret = KAknsIIDQgnHomePage66;
|
|
230 |
}
|
|
231 |
break;
|
|
232 |
default:
|
|
233 |
{
|
|
234 |
}
|
|
235 |
break;
|
|
236 |
}
|
|
237 |
|
|
238 |
return ret;
|
|
239 |
}
|
|
240 |
|
|
241 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
242 |
|
|
243 |
// -----------------------------------------------------------------------------
|
|
244 |
// CXnViewManager::NewL()
|
|
245 |
// Two-phased constructor.
|
|
246 |
// -----------------------------------------------------------------------------
|
|
247 |
//
|
|
248 |
CXnViewManager* CXnViewManager::NewL( CXnAppUiAdapter& aAdapter )
|
|
249 |
{
|
|
250 |
CXnViewManager* self = CXnViewManager::NewLC( aAdapter );
|
|
251 |
CleanupStack::Pop( self );
|
|
252 |
return self;
|
|
253 |
}
|
|
254 |
|
|
255 |
// -----------------------------------------------------------------------------
|
|
256 |
// CXnViewManager::NewLC()
|
|
257 |
// Two-phased constructor.
|
|
258 |
// -----------------------------------------------------------------------------
|
|
259 |
//
|
|
260 |
CXnViewManager* CXnViewManager::NewLC( CXnAppUiAdapter& aAdapter )
|
|
261 |
{
|
|
262 |
CXnViewManager* self = new( ELeave ) CXnViewManager( aAdapter );
|
|
263 |
CleanupStack::PushL( self );
|
|
264 |
self->ConstructL();
|
|
265 |
return self;
|
|
266 |
}
|
|
267 |
|
|
268 |
// -----------------------------------------------------------------------------
|
|
269 |
// CXnViewManager::CXnViewManager()
|
|
270 |
// C++ default constructor
|
|
271 |
// -----------------------------------------------------------------------------
|
|
272 |
//
|
|
273 |
CXnViewManager::CXnViewManager( CXnAppUiAdapter& aAdapter )
|
|
274 |
: iAppUiAdapter( aAdapter ),
|
|
275 |
iApplicationUid( iAppUiAdapter.Application()->AppDllUid() )
|
|
276 |
{
|
|
277 |
}
|
|
278 |
|
|
279 |
// -----------------------------------------------------------------------------
|
|
280 |
// CXnViewManager::~CXnViewManager()
|
|
281 |
// C++ default destructor.
|
|
282 |
// -----------------------------------------------------------------------------
|
|
283 |
//
|
|
284 |
CXnViewManager::~CXnViewManager()
|
|
285 |
{
|
|
286 |
delete iAsyncCb;
|
|
287 |
|
|
288 |
delete iStabilityTimer;
|
|
289 |
|
|
290 |
iObservers.Reset();
|
|
291 |
|
|
292 |
delete iRootData;
|
|
293 |
|
|
294 |
delete iWidgetAmountTrigger;
|
|
295 |
|
|
296 |
if ( iResources )
|
|
297 |
{
|
|
298 |
iResources->Reset();
|
|
299 |
}
|
|
300 |
|
|
301 |
delete iResources;
|
|
302 |
|
|
303 |
iControls.Reset();
|
|
304 |
iAppearanceNodes.Reset();
|
|
305 |
|
|
306 |
delete iComposer;
|
|
307 |
delete iEditor;
|
|
308 |
delete iOomSysHandler;
|
|
309 |
}
|
|
310 |
|
|
311 |
// -----------------------------------------------------------------------------
|
|
312 |
// CXnViewManager::ConstructL()
|
|
313 |
// 2nd phase constructor
|
|
314 |
// -----------------------------------------------------------------------------
|
|
315 |
//
|
|
316 |
void CXnViewManager::ConstructL()
|
|
317 |
{
|
|
318 |
iOomSysHandler = CXnOomSysHandler::NewL();
|
|
319 |
|
|
320 |
// Create resource list
|
|
321 |
iResources = new ( ELeave ) CArrayPtrSeg< CXnResource > ( 16 );
|
|
322 |
|
|
323 |
const TInt KMaxUidLength( 10 );
|
|
324 |
_LIT8( KUint, "%u" );
|
|
325 |
|
|
326 |
TBuf8< KMaxUidLength > uid;
|
|
327 |
uid.Format( KUint, iApplicationUid.iUid );
|
|
328 |
|
|
329 |
iEditor = CXnEditor::NewL( *this, uid );
|
|
330 |
|
|
331 |
iHspsWrapper = &iEditor->HspsWrapper();
|
|
332 |
|
|
333 |
iComposer = CXnComposer::NewL( *iHspsWrapper );
|
|
334 |
|
|
335 |
iAsyncCb = CPeriodic::NewL( CActive::EPriorityIdle );
|
|
336 |
|
|
337 |
DoRobustnessCheckL();
|
|
338 |
}
|
|
339 |
|
|
340 |
// -----------------------------------------------------------------------------
|
|
341 |
// CXnViewManager::LoadUiL()
|
|
342 |
// Loads the application UI and initial view
|
|
343 |
// -----------------------------------------------------------------------------
|
|
344 |
//
|
|
345 |
void CXnViewManager::LoadUiL()
|
|
346 |
{
|
|
347 |
iUiEngine->DisableRenderUiLC();
|
|
348 |
|
|
349 |
// Load application root configuration
|
|
350 |
iRootData = CXnRootData::NewL( *this, iApplicationUid );
|
|
351 |
|
|
352 |
// Load root configuration and initial view.
|
|
353 |
TInt err = iRootData->Load();
|
|
354 |
|
|
355 |
if( err == EXnInvalidConfiguration )
|
|
356 |
{
|
|
357 |
// Configuration loading failed totally
|
|
358 |
Panic( EXnInvalidConfiguration );
|
|
359 |
}
|
|
360 |
|
|
361 |
// Show the error note only once, if there are more views
|
|
362 |
// the note should be shown from CXnRootData::RunLoadL()
|
|
363 |
if( iRootData->PluginData().Count() == 1 )
|
|
364 |
{
|
|
365 |
HandleErrorNotes( err );
|
|
366 |
}
|
|
367 |
|
|
368 |
CleanupStack::PopAndDestroy(); // DisableRenderUiLC();
|
|
369 |
|
|
370 |
// Load initial view publishers
|
|
371 |
ActiveViewData().SetActive( ETrue );
|
|
372 |
}
|
|
373 |
|
|
374 |
// -----------------------------------------------------------------------------
|
|
375 |
// CXnViewManager::ReloadUiL()
|
|
376 |
// Reloads the application UI and initial ivew
|
|
377 |
// -----------------------------------------------------------------------------
|
|
378 |
void CXnViewManager::ReloadUiL()
|
|
379 |
{
|
|
380 |
#ifdef _XN_PERFORMANCE_TEST_
|
|
381 |
RDebug::Print( _L( "CXnViewManager::ReloadUiL() - start" ) );
|
|
382 |
#endif //_XN_PERFORMANCE_TEST_
|
|
383 |
|
|
384 |
NotifyViewDeactivatedL( ActiveViewData() );
|
|
385 |
|
|
386 |
if ( iAsyncCb->IsActive() )
|
|
387 |
{
|
|
388 |
iAsyncCb->Cancel();
|
|
389 |
|
|
390 |
ContainerActivated( this );
|
|
391 |
}
|
|
392 |
|
|
393 |
delete iWidgetAmountTrigger;
|
|
394 |
iWidgetAmountTrigger = NULL;
|
|
395 |
|
|
396 |
// Destroy all publishers
|
|
397 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
398 |
|
|
399 |
for ( TInt i = 0; i < views.Count(); i++ )
|
|
400 |
{
|
|
401 |
CXnViewData* view = static_cast< CXnViewData* >( views[i] );
|
|
402 |
|
|
403 |
view->DestroyPublishers( EAiFwSystemShutdown );
|
|
404 |
}
|
|
405 |
|
|
406 |
// Destroy active view data
|
|
407 |
ActiveViewData().Destroy();
|
|
408 |
|
|
409 |
// Schedule application configuration destroyal
|
|
410 |
iRootData->Destroy();
|
|
411 |
iRootData = NULL;
|
|
412 |
|
|
413 |
User::Heap().Compress();
|
|
414 |
|
|
415 |
iUiReady = EFalse;
|
|
416 |
|
|
417 |
LoadUiL();
|
|
418 |
|
|
419 |
// Activate first view from the new configuration
|
|
420 |
iAppUiAdapter.ViewAdapter().ActivateContainerL( ActiveViewData() );
|
|
421 |
|
|
422 |
#ifdef _XN_PERFORMANCE_TEST_
|
|
423 |
RDebug::Print( _L( "CXnViewManager::ReloadUiL() - end" ) );
|
|
424 |
#endif //_XN_PERFORMANCE_TEST_
|
|
425 |
}
|
|
426 |
|
|
427 |
// -----------------------------------------------------------------------------
|
|
428 |
// CXnViewManager::LoadWidgetToPluginL()
|
|
429 |
//
|
|
430 |
// -----------------------------------------------------------------------------
|
|
431 |
//
|
|
432 |
TInt CXnViewManager::LoadWidgetToPluginL( const CHsContentInfo& aContentInfo,
|
|
433 |
CXnPluginData& aPluginData )
|
|
434 |
{
|
|
435 |
// Plugin must not have widget when about to add
|
|
436 |
if ( aPluginData.Occupied() )
|
|
437 |
{
|
|
438 |
return KErrAlreadyExists;
|
|
439 |
}
|
|
440 |
|
|
441 |
CXnViewData& viewData(
|
|
442 |
static_cast< CXnViewData& >( *aPluginData.Parent() ) );
|
|
443 |
|
|
444 |
TBool emptyInUse( viewData.UseEmptyWidget() );
|
|
445 |
|
|
446 |
// By default widget is added to active view configuration
|
|
447 |
const TDesC8& configurationId( viewData.ConfigurationId() );
|
|
448 |
|
|
449 |
TInt retval( KErrGeneral );
|
|
450 |
|
|
451 |
if ( emptyInUse && aPluginData.Empty() )
|
|
452 |
{
|
|
453 |
retval = iHspsWrapper->ReplacePluginL(
|
|
454 |
aPluginData.PluginId(), aContentInfo.Uid() );
|
|
455 |
|
|
456 |
if( retval == KErrDiskFull )
|
|
457 |
{
|
|
458 |
TRAP_IGNORE( ShowErrorL( R_QTN_HS_OPERATION_FAILED_NO_DISK ) );
|
|
459 |
}
|
|
460 |
}
|
|
461 |
else
|
|
462 |
{
|
|
463 |
TInt index( viewData.PluginData().Find( &aPluginData ) );
|
|
464 |
|
|
465 |
CAddPluginResult* result = iHspsWrapper->AddPluginL(
|
|
466 |
configurationId, aContentInfo.Uid(), index );
|
|
467 |
|
|
468 |
CleanupStack::PushL( result );
|
|
469 |
|
|
470 |
retval = result->Status();
|
|
471 |
if ( retval == KErrNone )
|
|
472 |
{
|
|
473 |
aPluginData.SetPluginIdL( result->PluginId() );
|
|
474 |
}
|
|
475 |
else if( retval == KErrDiskFull )
|
|
476 |
{
|
|
477 |
TRAP_IGNORE( ShowErrorL( R_QTN_HS_OPERATION_FAILED_NO_DISK ) );
|
|
478 |
}
|
|
479 |
|
|
480 |
CleanupStack::PopAndDestroy( result );
|
|
481 |
}
|
|
482 |
|
|
483 |
if ( retval == KErrNone )
|
|
484 |
{
|
|
485 |
iUiEngine->DisableRenderUiLC();
|
|
486 |
|
|
487 |
NotifyConfigureWidgetL( aContentInfo, aPluginData );
|
|
488 |
|
|
489 |
retval = aPluginData.Load();
|
|
490 |
|
|
491 |
if ( retval == KErrNone )
|
|
492 |
{
|
|
493 |
UpdateCachesL();
|
|
494 |
|
|
495 |
NotifyWidgetAdditionL( aPluginData );
|
|
496 |
|
|
497 |
// Report widget amount in the view
|
|
498 |
ReportWidgetAmountL( viewData );
|
|
499 |
}
|
|
500 |
|
|
501 |
// Handle the errors
|
|
502 |
HandleErrorNotes( retval );
|
|
503 |
|
|
504 |
CleanupStack::PopAndDestroy(); // DisableRenderUiLC
|
|
505 |
}
|
|
506 |
|
|
507 |
return retval;
|
|
508 |
}
|
|
509 |
|
|
510 |
// -----------------------------------------------------------------------------
|
|
511 |
// CXnViewManager::UnloadWidgetFromPluginL()
|
|
512 |
//
|
|
513 |
// -----------------------------------------------------------------------------
|
|
514 |
//
|
|
515 |
TInt CXnViewManager::UnloadWidgetFromPluginL( CXnPluginData& aPluginData,
|
|
516 |
TBool aForce )
|
|
517 |
{
|
|
518 |
if ( !aForce )
|
|
519 |
{
|
|
520 |
if( !aPluginData.Occupied() )
|
|
521 |
{
|
|
522 |
// Plugin must have widget when about to remove
|
|
523 |
return KErrNotFound;
|
|
524 |
}
|
|
525 |
if ( !aPluginData.Removable() )
|
|
526 |
{
|
|
527 |
// Not allowed to remove locked
|
|
528 |
return KErrArgument;
|
|
529 |
}
|
|
530 |
}
|
|
531 |
|
|
532 |
CXnViewData& viewData(
|
|
533 |
static_cast< CXnViewData& >( *aPluginData.Parent() ) );
|
|
534 |
|
|
535 |
TBool emptyInUse( viewData.UseEmptyWidget() );
|
|
536 |
|
|
537 |
TInt retval( KErrGeneral );
|
|
538 |
|
|
539 |
// Save temporary
|
|
540 |
TBuf8< 32 > id( aPluginData.PluginId() );
|
|
541 |
|
|
542 |
if ( emptyInUse )
|
|
543 |
{
|
|
544 |
retval = iHspsWrapper->ReplacePluginL(
|
|
545 |
aPluginData.PluginId(), KEmptyWidgetUid );
|
|
546 |
}
|
|
547 |
else
|
|
548 |
{
|
|
549 |
retval = iHspsWrapper->RemovePluginL( aPluginData.PluginId() );
|
|
550 |
}
|
|
551 |
|
|
552 |
if ( retval == KErrNone )
|
|
553 |
{
|
|
554 |
TBool active( aPluginData.Active() );
|
|
555 |
|
|
556 |
iUiEngine->DisableRenderUiLC();
|
|
557 |
|
|
558 |
NotifyWidgetRemovalL( aPluginData );
|
|
559 |
|
|
560 |
aPluginData.Destroy();
|
|
561 |
|
|
562 |
if ( emptyInUse )
|
|
563 |
{
|
|
564 |
// Write id back for for later usage
|
|
565 |
aPluginData.SetEmptyL( id );
|
|
566 |
}
|
|
567 |
else
|
|
568 |
{
|
|
569 |
// Reorder plugindata array
|
|
570 |
RPointerArray< CXnPluginData >& plugins( viewData.PluginData() );
|
|
571 |
|
|
572 |
TInt index( plugins.Find( &aPluginData ) );
|
|
573 |
|
|
574 |
plugins.Remove( index );
|
|
575 |
plugins.Insert( &aPluginData, plugins.Count() - 1 );
|
|
576 |
}
|
|
577 |
|
|
578 |
UpdateCachesL();
|
|
579 |
|
|
580 |
// Report widget amount in the view
|
|
581 |
ReportWidgetAmountL( viewData );
|
|
582 |
|
|
583 |
if ( active )
|
|
584 |
{
|
|
585 |
iUiEngine->RenderUIL();
|
|
586 |
}
|
|
587 |
|
|
588 |
CleanupStack::PopAndDestroy(); // DisableRenderUiLC
|
|
589 |
}
|
|
590 |
|
|
591 |
return retval;
|
|
592 |
}
|
|
593 |
|
|
594 |
// -----------------------------------------------------------------------------
|
|
595 |
// CXnViewManager::ReplaceWidgetToPluginL
|
|
596 |
//
|
|
597 |
// -----------------------------------------------------------------------------
|
|
598 |
//
|
|
599 |
TInt CXnViewManager::ReplaceWidgetToPluginL( const CHsContentInfo& aContentInfo,
|
|
600 |
CXnPluginData& aPluginData )
|
|
601 |
{
|
|
602 |
TInt retval( KErrNone );
|
|
603 |
|
|
604 |
retval = iHspsWrapper->ReplacePluginL( aPluginData.PluginId(),
|
|
605 |
aContentInfo.Uid() );
|
|
606 |
|
|
607 |
if ( retval == KErrNone )
|
|
608 |
{
|
|
609 |
iUiEngine->DisableRenderUiLC();
|
|
610 |
|
|
611 |
NotifyWidgetRemovalL( aPluginData );
|
|
612 |
|
|
613 |
TBuf8< 32 > id( aPluginData.PluginId() );
|
|
614 |
TBuf8< 32 > uid( aContentInfo.Uid() );
|
|
615 |
|
|
616 |
aPluginData.Destroy();
|
|
617 |
|
|
618 |
UpdateCachesL();
|
|
619 |
aPluginData.SetPluginIdL( id );
|
|
620 |
|
|
621 |
NotifyConfigureWidgetL( aContentInfo, aPluginData );
|
|
622 |
|
|
623 |
retval = aPluginData.Load();
|
|
624 |
|
|
625 |
if ( retval == KErrNone )
|
|
626 |
{
|
|
627 |
UpdateCachesL();
|
|
628 |
|
|
629 |
// notify addition if not replaced with empty widget
|
|
630 |
// NotifyWidgetAdditionL will call RenderUIL()
|
|
631 |
if( uid != KEmptyWidgetUid )
|
|
632 |
{
|
|
633 |
NotifyWidgetAdditionL( aPluginData );
|
|
634 |
}
|
|
635 |
else
|
|
636 |
{
|
|
637 |
if( aPluginData.Active() )
|
|
638 |
{
|
|
639 |
iUiEngine->RenderUIL();
|
|
640 |
}
|
|
641 |
}
|
|
642 |
}
|
|
643 |
|
|
644 |
// Handle the errors
|
|
645 |
HandleErrorNotes( retval );
|
|
646 |
|
|
647 |
CleanupStack::PopAndDestroy(); // DisableRenderUiLC
|
|
648 |
}
|
|
649 |
|
|
650 |
return retval;
|
|
651 |
}
|
|
652 |
|
|
653 |
// -----------------------------------------------------------------------------
|
|
654 |
// CXnViewManager::ODT()
|
|
655 |
// Get the ODT
|
|
656 |
// -----------------------------------------------------------------------------
|
|
657 |
//
|
|
658 |
CXnODT* CXnViewManager::ODT() const
|
|
659 |
{
|
|
660 |
return iRootData->ODT();
|
|
661 |
}
|
|
662 |
|
|
663 |
// -----------------------------------------------------------------------------
|
|
664 |
// CXnViewManager::RootNode()
|
|
665 |
// Finds the root node
|
|
666 |
// -----------------------------------------------------------------------------
|
|
667 |
//
|
|
668 |
CXnNode* CXnViewManager::RootNode() const
|
|
669 |
{
|
|
670 |
return iRootData->RootNode();
|
|
671 |
}
|
|
672 |
|
|
673 |
// -----------------------------------------------------------------------------
|
|
674 |
// CXnViewManager::ViewNode()
|
|
675 |
// Finds the view node from active view data
|
|
676 |
// -----------------------------------------------------------------------------
|
|
677 |
//
|
|
678 |
CXnNode* CXnViewManager::ViewNode() const
|
|
679 |
{
|
|
680 |
return ActiveViewData().ViewNode();
|
|
681 |
}
|
|
682 |
|
|
683 |
// -----------------------------------------------------------------------------
|
|
684 |
// CXnViewManager::Parser()
|
|
685 |
// Gets ODT parser
|
|
686 |
// -----------------------------------------------------------------------------
|
|
687 |
//
|
|
688 |
CXnODTParser& CXnViewManager::Parser() const
|
|
689 |
{
|
|
690 |
return iRootData->Parser();
|
|
691 |
}
|
|
692 |
|
|
693 |
// -----------------------------------------------------------------------------
|
|
694 |
// CXnViewManager::EcomHandler()
|
|
695 |
// Gets Ecom handler
|
|
696 |
// -----------------------------------------------------------------------------
|
|
697 |
//
|
|
698 |
CXnEcomHandler& CXnViewManager::EcomHandler() const
|
|
699 |
{
|
|
700 |
return iRootData->EcomHandler();
|
|
701 |
}
|
|
702 |
|
|
703 |
// -----------------------------------------------------------------------------
|
|
704 |
// CXnViewManager::Controls()
|
|
705 |
// Finds the controls from active view data
|
|
706 |
// -----------------------------------------------------------------------------
|
|
707 |
//
|
|
708 |
const RPointerArray< CXnControlAdapter >& CXnViewManager::Controls() const
|
|
709 |
{
|
|
710 |
return iControls;
|
|
711 |
}
|
|
712 |
|
|
713 |
// -----------------------------------------------------------------------------
|
|
714 |
// CXnViewManager::PluginNodes()
|
|
715 |
// Finds the plugin nodes from active view data
|
|
716 |
// -----------------------------------------------------------------------------
|
|
717 |
//
|
|
718 |
RPointerArray< CXnNode >& CXnViewManager::PluginNodes() const
|
|
719 |
{
|
|
720 |
// These must be fetched from layout tree to get correct order of plugins
|
|
721 |
CXnViewData& activeViewData( ActiveViewData() );
|
|
722 |
|
|
723 |
// Get first plugin data
|
|
724 |
CXnPluginData* pluginData( activeViewData.PluginData()[0] );
|
|
725 |
CXnNode* parent( pluginData->Owner()->LayoutNode()->Parent() );
|
|
726 |
|
|
727 |
// This assumes that the parent has only "plugin" nodes as its children
|
|
728 |
RPointerArray< CXnNode >& children( parent->Children() );
|
|
729 |
|
|
730 |
return children;
|
|
731 |
}
|
|
732 |
|
|
733 |
// -----------------------------------------------------------------------------
|
|
734 |
// CXnViewManager::PluginDataL()
|
|
735 |
//
|
|
736 |
// -----------------------------------------------------------------------------
|
|
737 |
//
|
|
738 |
void CXnViewManager::PluginDataL( RPointerArray< CXnPluginData >& aList,
|
|
739 |
TBool aGlobal ) const
|
|
740 |
{
|
|
741 |
if ( aGlobal )
|
|
742 |
{
|
|
743 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
744 |
|
|
745 |
for ( TInt i = 0; i < views.Count(); i++ )
|
|
746 |
{
|
|
747 |
RPointerArray< CXnPluginData >& plugins( views[i]->PluginData() );
|
|
748 |
|
|
749 |
for ( TInt j = 0; j < plugins.Count(); j++ )
|
|
750 |
{
|
|
751 |
aList.AppendL( plugins[ j ] );
|
|
752 |
}
|
|
753 |
}
|
|
754 |
}
|
|
755 |
else
|
|
756 |
{
|
|
757 |
RPointerArray< CXnPluginData >&
|
|
758 |
plugins( ActiveViewData().PluginData() );
|
|
759 |
|
|
760 |
for ( TInt j = 0; j < plugins.Count(); j++ )
|
|
761 |
{
|
|
762 |
aList.AppendL( plugins[ j ] );
|
|
763 |
}
|
|
764 |
}
|
|
765 |
}
|
|
766 |
|
|
767 |
// -----------------------------------------------------------------------------
|
|
768 |
// CXnViewManager::PluginDataL()
|
|
769 |
// Returns list of plugins from all views or from the defined view
|
|
770 |
// -----------------------------------------------------------------------------
|
|
771 |
//
|
|
772 |
TInt CXnViewManager::PluginDataL( const TDesC8& aViewId,
|
|
773 |
RPointerArray< CXnPluginData >& aList ) const
|
|
774 |
{
|
|
775 |
TInt err( KErrNone );
|
|
776 |
TBool found( EFalse );
|
|
777 |
|
|
778 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
779 |
|
|
780 |
for ( TInt i = 0; i < views.Count(); i++ )
|
|
781 |
{
|
|
782 |
if ( !aViewId.Length() || views[i]->PluginId().Compare( aViewId ) == 0 )
|
|
783 |
{
|
|
784 |
found = ETrue;
|
|
785 |
RPointerArray< CXnPluginData >& plugins( views[i]->PluginData() );
|
|
786 |
|
|
787 |
for ( TInt j = 0; j < plugins.Count(); j++ )
|
|
788 |
{
|
|
789 |
aList.AppendL( plugins[ j ] );
|
|
790 |
}
|
|
791 |
}
|
|
792 |
}
|
|
793 |
if ( !found )
|
|
794 |
{
|
|
795 |
// View not found
|
|
796 |
err = KErrArgument;
|
|
797 |
}
|
|
798 |
|
|
799 |
return err;
|
|
800 |
}
|
|
801 |
|
|
802 |
// -----------------------------------------------------------------------------
|
|
803 |
// CXnViewManager::Resources()
|
|
804 |
// Finds the resources from the active view data
|
|
805 |
// -----------------------------------------------------------------------------
|
|
806 |
//
|
|
807 |
CArrayPtrSeg< CXnResource >& CXnViewManager::Resources() const
|
|
808 |
{
|
|
809 |
return *iResources;
|
|
810 |
}
|
|
811 |
|
|
812 |
// -----------------------------------------------------------------------------
|
|
813 |
// CXnViewManager::AppearanceNodes()
|
|
814 |
//
|
|
815 |
// -----------------------------------------------------------------------------
|
|
816 |
//
|
|
817 |
RPointerArray< CXnNode >& CXnViewManager::AppearanceNodes() const
|
|
818 |
{
|
|
819 |
return iAppearanceNodes;
|
|
820 |
}
|
|
821 |
|
|
822 |
// -----------------------------------------------------------------------------
|
|
823 |
// CXnViewManager::ViewData()
|
|
824 |
// Finds a view data based on a view node
|
|
825 |
// -----------------------------------------------------------------------------
|
|
826 |
//
|
|
827 |
CXnViewData* CXnViewManager::ViewData( CXnNode& aNode ) const
|
|
828 |
{
|
|
829 |
if ( !aNode.ViewNodeImpl() )
|
|
830 |
{
|
|
831 |
return NULL;
|
|
832 |
}
|
|
833 |
|
|
834 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
835 |
|
|
836 |
for ( TInt i = 0; i < views.Count(); i++ )
|
|
837 |
{
|
|
838 |
if ( views[i]->Occupied() )
|
|
839 |
{
|
|
840 |
if ( views[i]->Node()->LayoutNode() == &aNode )
|
|
841 |
{
|
|
842 |
return static_cast< CXnViewData* >( views[ i ] );
|
|
843 |
}
|
|
844 |
}
|
|
845 |
}
|
|
846 |
|
|
847 |
return NULL;
|
|
848 |
}
|
|
849 |
|
|
850 |
// -----------------------------------------------------------------------------
|
|
851 |
// CXnViewManager::ActiveAppData()
|
|
852 |
// Gets the active app data
|
|
853 |
// -----------------------------------------------------------------------------
|
|
854 |
//
|
|
855 |
CXnRootData& CXnViewManager::ActiveAppData() const
|
|
856 |
{
|
|
857 |
return *iRootData;
|
|
858 |
}
|
|
859 |
|
|
860 |
// -----------------------------------------------------------------------------
|
|
861 |
// CXnViewManager::ActiveViewData()
|
|
862 |
// Gets the active view data
|
|
863 |
// -----------------------------------------------------------------------------
|
|
864 |
//
|
|
865 |
CXnViewData& CXnViewManager::ActiveViewData() const
|
|
866 |
{
|
|
867 |
return iRootData->ActiveViewData();
|
|
868 |
}
|
|
869 |
|
|
870 |
// -----------------------------------------------------------------------------
|
|
871 |
// CXnViewManager::PreviousViewData()
|
|
872 |
// Gets the previous view data
|
|
873 |
// -----------------------------------------------------------------------------
|
|
874 |
//
|
|
875 |
CXnViewData& CXnViewManager::PreviousViewData() const
|
|
876 |
{
|
|
877 |
return iRootData->PreviousViewData();
|
|
878 |
}
|
|
879 |
|
|
880 |
// -----------------------------------------------------------------------------
|
|
881 |
// CXnViewManager::NextViewData()
|
|
882 |
// Gets the next view data
|
|
883 |
// -----------------------------------------------------------------------------
|
|
884 |
//
|
|
885 |
CXnViewData& CXnViewManager::NextViewData() const
|
|
886 |
{
|
|
887 |
return iRootData->NextViewData();
|
|
888 |
}
|
|
889 |
|
|
890 |
// -----------------------------------------------------------------------------
|
|
891 |
// CXnViewManager::ActivateNextViewL()
|
|
892 |
// Activates the next view
|
|
893 |
// -----------------------------------------------------------------------------
|
|
894 |
//
|
|
895 |
void CXnViewManager::ActivateNextViewL( TInt /*aEffectId*/ )
|
|
896 |
{
|
|
897 |
CXnViewData& next( NextViewData() );
|
|
898 |
|
|
899 |
if ( !next.Occupied() )
|
|
900 |
{
|
|
901 |
TInt err( next.Load() );
|
|
902 |
|
|
903 |
if ( err )
|
|
904 |
{
|
|
905 |
HandleErrorNotes( err );
|
|
906 |
return;
|
|
907 |
}
|
|
908 |
}
|
|
909 |
|
|
910 |
// Activate view
|
|
911 |
if ( next.Occupied() && !next.Active() )
|
|
912 |
{
|
|
913 |
iAppUiAdapter.ViewAdapter().ActivateContainerL(
|
|
914 |
next, EFalse, KGfxContextActivateNextView );
|
|
915 |
}
|
|
916 |
}
|
|
917 |
|
|
918 |
// -----------------------------------------------------------------------------
|
|
919 |
// CXnViewManager::ActivatePreviousViewL()
|
|
920 |
// Activates the previous view
|
|
921 |
// -----------------------------------------------------------------------------
|
|
922 |
//
|
|
923 |
void CXnViewManager::ActivatePreviousViewL( TInt /*aEffectId*/ )
|
|
924 |
{
|
|
925 |
CXnViewData& prev( PreviousViewData() );
|
|
926 |
|
|
927 |
if ( !prev.Occupied() )
|
|
928 |
{
|
|
929 |
TInt err( prev.Load() );
|
|
930 |
|
|
931 |
if ( err )
|
|
932 |
{
|
|
933 |
HandleErrorNotes( err );
|
|
934 |
return;
|
|
935 |
}
|
|
936 |
}
|
|
937 |
|
|
938 |
// Activate view
|
|
939 |
if ( prev.Occupied() && !prev.Active() )
|
|
940 |
{
|
|
941 |
iAppUiAdapter.ViewAdapter().ActivateContainerL(
|
|
942 |
prev, EFalse, KGfxContextActivatePrevView );
|
|
943 |
}
|
|
944 |
}
|
|
945 |
|
|
946 |
// -----------------------------------------------------------------------------
|
|
947 |
// CXnViewManager::AddViewL()
|
|
948 |
// Adds a new view based on info
|
|
949 |
// -----------------------------------------------------------------------------
|
|
950 |
//
|
|
951 |
TInt CXnViewManager::AddViewL( const CHsContentInfo& aInfo )
|
|
952 |
{
|
|
953 |
if ( iRootData->PluginData().Count() >= iRootData->MaxPages() )
|
|
954 |
{
|
|
955 |
return KErrGeneral;
|
|
956 |
}
|
|
957 |
|
|
958 |
// Add new view (template view) to hsps
|
|
959 |
CAddPluginResult* result = iHspsWrapper->AddPluginL(
|
|
960 |
iRootData->ConfigurationId(), aInfo.Uid(),
|
|
961 |
ViewIndex() + 1 );
|
|
962 |
CleanupStack::PushL( result );
|
|
963 |
|
|
964 |
TInt retval( result->Status() );
|
|
965 |
|
|
966 |
if( retval == KErrDiskFull )
|
|
967 |
{
|
|
968 |
TRAP_IGNORE( ShowErrorL( R_QTN_HS_OPERATION_FAILED_NO_DISK ) );
|
|
969 |
}
|
|
970 |
else if ( retval == KErrNone )
|
|
971 |
{
|
|
972 |
// Create new view
|
|
973 |
CXnViewData* newView = CXnViewData::NewLC( *iRootData );
|
|
974 |
|
|
975 |
newView->SetPluginIdL( result->PluginId() );
|
|
976 |
|
|
977 |
newView->SetOwner( iRootData->Node() );
|
|
978 |
|
|
979 |
retval = newView->Load();
|
|
980 |
|
|
981 |
HandleErrorNotes( retval );
|
|
982 |
|
|
983 |
if ( newView->Occupied() )
|
|
984 |
{
|
|
985 |
// Load succeed, add the new view behind the current view
|
|
986 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
987 |
|
|
988 |
TInt index( views.Find( &ActiveViewData() ) );
|
|
989 |
|
|
990 |
views.InsertL( newView, index + 1 );
|
|
991 |
|
|
992 |
// Root data owns the new view now
|
|
993 |
CleanupStack::Pop( newView );
|
|
994 |
|
|
995 |
// Inform observers about added view
|
|
996 |
NotifyViewAdditionL( *newView );
|
|
997 |
|
|
998 |
UpdatePageManagementInformationL();
|
|
999 |
|
|
1000 |
iUiEngine->RenderUIL();
|
|
1001 |
}
|
|
1002 |
else
|
|
1003 |
{
|
|
1004 |
// creation failed, remove it from hsps
|
|
1005 |
iHspsWrapper->RemovePluginL( result->PluginId() );
|
|
1006 |
|
|
1007 |
// ... and destroy it
|
|
1008 |
CleanupStack::PopAndDestroy( newView );
|
|
1009 |
|
|
1010 |
retval = KErrGeneral;
|
|
1011 |
|
|
1012 |
}
|
|
1013 |
}
|
|
1014 |
|
|
1015 |
CleanupStack::PopAndDestroy( result );
|
|
1016 |
|
|
1017 |
return retval;
|
|
1018 |
}
|
|
1019 |
|
|
1020 |
// -----------------------------------------------------------------------------
|
|
1021 |
// CXnViewManager::AddViewL()
|
|
1022 |
// Adds a new view
|
|
1023 |
// -----------------------------------------------------------------------------
|
|
1024 |
//
|
|
1025 |
void CXnViewManager::AddViewL( TInt aEffectId )
|
|
1026 |
{
|
|
1027 |
if ( iRootData->PluginData().Count() >= iRootData->MaxPages() )
|
|
1028 |
{
|
|
1029 |
TRAP_IGNORE( ShowErrorL( R_QTN_HS_MAX_AMOUNT_OF_PAGES_NOTE ) );
|
|
1030 |
|
|
1031 |
return;
|
|
1032 |
}
|
|
1033 |
|
|
1034 |
// Add new view (template view) to hsps
|
|
1035 |
CAddPluginResult* result = iHspsWrapper->AddPluginL(
|
|
1036 |
iRootData->ConfigurationId(), KTemplateViewUID,
|
|
1037 |
ViewIndex() + 1 );
|
|
1038 |
CleanupStack::PushL( result );
|
|
1039 |
|
|
1040 |
TInt status( result->Status() );
|
|
1041 |
|
|
1042 |
if( status == KErrDiskFull )
|
|
1043 |
{
|
|
1044 |
TRAP_IGNORE( ShowErrorL( R_QTN_HS_OPERATION_FAILED_NO_DISK ) );
|
|
1045 |
}
|
|
1046 |
else if ( status == KErrNone )
|
|
1047 |
{
|
|
1048 |
// Create new view
|
|
1049 |
CXnViewData* newView = CXnViewData::NewLC( *iRootData );
|
|
1050 |
|
|
1051 |
newView->SetPluginIdL( result->PluginId() );
|
|
1052 |
|
|
1053 |
newView->SetOwner( iRootData->Node() );
|
|
1054 |
|
|
1055 |
status = newView->Load();
|
|
1056 |
|
|
1057 |
HandleErrorNotes( status );
|
|
1058 |
|
|
1059 |
if ( newView->Occupied() )
|
|
1060 |
{
|
|
1061 |
// Start transition effect
|
|
1062 |
if( aEffectId )
|
|
1063 |
{
|
|
1064 |
iAppUiAdapter.EffectManager()->BeginFullscreenEffectL(
|
|
1065 |
aEffectId, ActiveViewData() );
|
|
1066 |
}
|
|
1067 |
|
|
1068 |
// Load succeed, add the new view behind the current view
|
|
1069 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
1070 |
|
|
1071 |
TInt index( views.Find( &ActiveViewData() ) );
|
|
1072 |
|
|
1073 |
views.InsertL( newView, index + 1 );
|
|
1074 |
|
|
1075 |
// Root data owns the new view now
|
|
1076 |
CleanupStack::Pop( newView );
|
|
1077 |
|
|
1078 |
// Activate view
|
|
1079 |
iAppUiAdapter.ViewAdapter().ActivateContainerL( *newView, ETrue );
|
|
1080 |
|
|
1081 |
// Inform observers about added view
|
|
1082 |
NotifyViewAdditionL( *newView );
|
|
1083 |
}
|
|
1084 |
else
|
|
1085 |
{
|
|
1086 |
// creation failed, remove it from hsps
|
|
1087 |
iHspsWrapper->RemovePluginL( result->PluginId() );
|
|
1088 |
|
|
1089 |
// ... and destroy it
|
|
1090 |
CleanupStack::PopAndDestroy( newView );
|
|
1091 |
}
|
|
1092 |
}
|
|
1093 |
|
|
1094 |
CleanupStack::PopAndDestroy( result );
|
|
1095 |
}
|
|
1096 |
|
|
1097 |
// -----------------------------------------------------------------------------
|
|
1098 |
// CXnViewManager::RemoveFaultyView()
|
|
1099 |
// Removes a view which has failed to load
|
|
1100 |
// -----------------------------------------------------------------------------
|
|
1101 |
//
|
|
1102 |
TInt CXnViewManager::RemoveFaultyView( CXnViewData* aViewData )
|
|
1103 |
{
|
|
1104 |
TInt retval( KErrGeneral );
|
|
1105 |
|
|
1106 |
if( aViewData )
|
|
1107 |
{
|
|
1108 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
1109 |
|
|
1110 |
TInt index( views.Find( aViewData ) );
|
|
1111 |
|
|
1112 |
if ( index != KErrNotFound )
|
|
1113 |
{
|
|
1114 |
// Remove instance from the views array
|
|
1115 |
views.Remove( index );
|
|
1116 |
|
|
1117 |
// Remove the faulty view configuration from the root configuration in HSPS
|
|
1118 |
TRAP_IGNORE( iHspsWrapper->RemovePluginL( aViewData->PluginId() ) );
|
|
1119 |
|
|
1120 |
// Update MSK from the remaining views
|
|
1121 |
TRAP_IGNORE( UpdatePageManagementInformationL() );
|
|
1122 |
|
|
1123 |
TRAP_IGNORE( iUiEngine->RenderUIL() );
|
|
1124 |
|
|
1125 |
retval = KErrNone;
|
|
1126 |
}
|
|
1127 |
}
|
|
1128 |
|
|
1129 |
return retval;
|
|
1130 |
}
|
|
1131 |
|
|
1132 |
// -----------------------------------------------------------------------------
|
|
1133 |
// CXnViewManager::RemoveViewL()
|
|
1134 |
// Removes view based info
|
|
1135 |
// -----------------------------------------------------------------------------
|
|
1136 |
//
|
|
1137 |
TInt CXnViewManager::RemoveViewL( const CHsContentInfo& aInfo )
|
|
1138 |
{
|
|
1139 |
TInt retval( KErrGeneral );
|
|
1140 |
|
|
1141 |
if ( iRootData->PluginData().Count() <= 1 )
|
|
1142 |
{
|
|
1143 |
// Only one page left, not allowed to remove
|
|
1144 |
return retval;
|
|
1145 |
}
|
|
1146 |
|
|
1147 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
1148 |
|
|
1149 |
for ( TInt i = 0; i < views.Count(); i++ )
|
|
1150 |
{
|
|
1151 |
CXnViewData* view( static_cast< CXnViewData* >( views[i] ) );
|
|
1152 |
|
|
1153 |
if ( view->PluginId() == aInfo.PluginId() )
|
|
1154 |
{
|
|
1155 |
if ( !view->Removable() )
|
|
1156 |
{
|
|
1157 |
return KErrArgument;
|
|
1158 |
}
|
|
1159 |
|
|
1160 |
if ( view->Active() )
|
|
1161 |
{
|
|
1162 |
// Destroy publishers here, must be plugin shutdown
|
|
1163 |
view->DestroyPublishers( EAiFwPluginShutdown );
|
|
1164 |
|
|
1165 |
// Activate the next view, or first if in the last view
|
|
1166 |
CXnViewData& next( NextViewData() );
|
|
1167 |
|
|
1168 |
iAppUiAdapter.ViewAdapter().ActivateContainerL( next );
|
|
1169 |
}
|
|
1170 |
|
|
1171 |
// Remove wallpaper from cache
|
|
1172 |
iAppUiAdapter.ViewAdapter().BgManager().DeleteWallpaper( *view );
|
|
1173 |
|
|
1174 |
retval = iHspsWrapper->RemovePluginL( view->PluginId() );
|
|
1175 |
|
|
1176 |
// Notify observers of view list change
|
|
1177 |
TRAP_IGNORE( NotifyViewRemovalL( *view ) );
|
|
1178 |
|
|
1179 |
iRootData->DestroyViewData( view );
|
|
1180 |
|
|
1181 |
// Need to update after view is removed
|
|
1182 |
UpdatePageManagementInformationL();
|
|
1183 |
|
|
1184 |
break;
|
|
1185 |
}
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
return retval;
|
|
1189 |
}
|
|
1190 |
|
|
1191 |
// -----------------------------------------------------------------------------
|
|
1192 |
// CXnViewManager::RemoveViewL()
|
|
1193 |
// Removes active view if more than one view.
|
|
1194 |
// -----------------------------------------------------------------------------
|
|
1195 |
//
|
|
1196 |
void CXnViewManager::RemoveViewL( TInt aEffectId )
|
|
1197 |
{
|
|
1198 |
if ( iRootData->PluginData().Count() <= 1 ||
|
|
1199 |
!ActiveViewData().Removable() )
|
|
1200 |
{
|
|
1201 |
// Only one page left, this should not happen,
|
|
1202 |
// or active view is not removable
|
|
1203 |
return;
|
|
1204 |
}
|
|
1205 |
|
|
1206 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
1207 |
|
|
1208 |
TInt index( views.Find( &ActiveViewData() ) );
|
|
1209 |
|
|
1210 |
CAknQueryDialog* query = CAknQueryDialog::NewL();
|
|
1211 |
query->PrepareLC( R_YES_NO_HS_REMOVE_VIEW );
|
|
1212 |
|
|
1213 |
HBufC* queryText( StringLoader::LoadLC( R_QTN_HS_DELETE_PAGE ) );
|
|
1214 |
|
|
1215 |
query->SetPromptL( queryText->Des() );
|
|
1216 |
|
|
1217 |
CleanupStack::PopAndDestroy( queryText );
|
|
1218 |
|
|
1219 |
if ( query->RunLD() )
|
|
1220 |
{
|
|
1221 |
// Start transition effect
|
|
1222 |
if( aEffectId )
|
|
1223 |
{
|
|
1224 |
iAppUiAdapter.EffectManager()->BeginFullscreenEffectL(
|
|
1225 |
aEffectId, ActiveViewData() );
|
|
1226 |
}
|
|
1227 |
|
|
1228 |
// Activate the next view, or first if in the last view
|
|
1229 |
CXnViewData& next( NextViewData() );
|
|
1230 |
|
|
1231 |
if ( !next.Occupied() )
|
|
1232 |
{
|
|
1233 |
next.Load();
|
|
1234 |
}
|
|
1235 |
|
|
1236 |
CXnViewData* view( static_cast< CXnViewData* >( views[ index ] ) );
|
|
1237 |
|
|
1238 |
// Destroy publishers here, must be plugin shutdown
|
|
1239 |
view->DestroyPublishers( EAiFwPluginShutdown );
|
|
1240 |
|
|
1241 |
iAppUiAdapter.ViewAdapter().ActivateContainerL( next );
|
|
1242 |
|
|
1243 |
// Remove wallpaper from cache
|
|
1244 |
iAppUiAdapter.ViewAdapter().BgManager().DeleteWallpaper( *view );
|
|
1245 |
|
|
1246 |
// Remove plugin from HSPS
|
|
1247 |
iHspsWrapper->RemovePluginL( view->PluginId() );
|
|
1248 |
|
|
1249 |
// Notify observers of view list change
|
|
1250 |
TRAP_IGNORE( NotifyViewRemovalL( *view ) );
|
|
1251 |
|
|
1252 |
|
|
1253 |
iRootData->DestroyViewData( view );
|
|
1254 |
|
|
1255 |
// Need to update after view is removed
|
|
1256 |
UpdatePageManagementInformationL();
|
|
1257 |
}
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
// -----------------------------------------------------------------------------
|
|
1261 |
// CXnViewManager::AddObserver()
|
|
1262 |
//
|
|
1263 |
// -----------------------------------------------------------------------------
|
|
1264 |
//
|
|
1265 |
void CXnViewManager::AddObserver( const MXnViewObserver& aObserver )
|
|
1266 |
{
|
|
1267 |
TInt index( iObservers.Find( &aObserver ) );
|
|
1268 |
|
|
1269 |
if ( index == KErrNotFound )
|
|
1270 |
{
|
|
1271 |
iObservers.Append( &aObserver );
|
|
1272 |
}
|
|
1273 |
}
|
|
1274 |
|
|
1275 |
// -----------------------------------------------------------------------------
|
|
1276 |
// CXnViewManager::RemoveObserver()
|
|
1277 |
//
|
|
1278 |
// -----------------------------------------------------------------------------
|
|
1279 |
//
|
|
1280 |
void CXnViewManager::RemoveObserver( const MXnViewObserver& aObserver )
|
|
1281 |
{
|
|
1282 |
TInt index( iObservers.Find( &aObserver ) );
|
|
1283 |
|
|
1284 |
if ( index != KErrNotFound )
|
|
1285 |
{
|
|
1286 |
iObservers.Remove( index );
|
|
1287 |
}
|
|
1288 |
}
|
|
1289 |
|
|
1290 |
// -----------------------------------------------------------------------------
|
|
1291 |
// CXnViewManager::ActivateAppL()
|
|
1292 |
// Activates application configuration
|
|
1293 |
// -----------------------------------------------------------------------------
|
|
1294 |
TInt CXnViewManager::ActivateAppL( const TDesC8& aPluginUid )
|
|
1295 |
{
|
|
1296 |
if ( aPluginUid == KNullDesC8 )
|
|
1297 |
{
|
|
1298 |
return KErrArgument;
|
|
1299 |
}
|
|
1300 |
|
|
1301 |
if ( iRootData->PluginUid().CompareF( aPluginUid ) == 0 )
|
|
1302 |
{
|
|
1303 |
// Nothing to do
|
|
1304 |
return KErrNone;
|
|
1305 |
}
|
|
1306 |
|
|
1307 |
return iHspsWrapper->SetAppConfigurationL( aPluginUid );
|
|
1308 |
}
|
|
1309 |
|
|
1310 |
// -----------------------------------------------------------------------------
|
|
1311 |
// CXnViewManager::ActivateViewL()
|
|
1312 |
// Activates view
|
|
1313 |
// -----------------------------------------------------------------------------
|
|
1314 |
TInt CXnViewManager::ActivateViewL( const TDesC8& aPluginId )
|
|
1315 |
{
|
|
1316 |
if ( aPluginId == KNullDesC8 )
|
|
1317 |
{
|
|
1318 |
return KErrArgument;
|
|
1319 |
}
|
|
1320 |
|
|
1321 |
CXnViewData& current( ActiveViewData() );
|
|
1322 |
|
|
1323 |
if ( current.PluginId() == aPluginId )
|
|
1324 |
{
|
|
1325 |
// Nothing to do
|
|
1326 |
return KErrNone;
|
|
1327 |
}
|
|
1328 |
|
|
1329 |
TInt retval( KErrNotFound );
|
|
1330 |
|
|
1331 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
1332 |
|
|
1333 |
for ( TInt i = 0; i < views.Count(); i++ )
|
|
1334 |
{
|
|
1335 |
CXnViewData* view( static_cast< CXnViewData* >( views[ i ] ) );
|
|
1336 |
|
|
1337 |
if( view->Occupied() && view->PluginId() == aPluginId )
|
|
1338 |
{
|
|
1339 |
iAppUiAdapter.ViewAdapter().ActivateContainerL( *view );
|
|
1340 |
|
|
1341 |
retval = KErrNone;
|
|
1342 |
|
|
1343 |
break;
|
|
1344 |
}
|
|
1345 |
}
|
|
1346 |
|
|
1347 |
return retval;
|
|
1348 |
}
|
|
1349 |
|
|
1350 |
// -----------------------------------------------------------------------------
|
|
1351 |
// CXnViewManager::ViewAmount()
|
|
1352 |
// Gets current view amount
|
|
1353 |
// -----------------------------------------------------------------------------
|
|
1354 |
TInt CXnViewManager::ViewAmount() const
|
|
1355 |
{
|
|
1356 |
return iRootData->PluginData().Count();
|
|
1357 |
}
|
|
1358 |
|
|
1359 |
// -----------------------------------------------------------------------------
|
|
1360 |
// CXnViewManager::ViewIndex()
|
|
1361 |
// Gets index of current view
|
|
1362 |
// -----------------------------------------------------------------------------
|
|
1363 |
TInt CXnViewManager::ViewIndex() const
|
|
1364 |
{
|
|
1365 |
TInt index( KErrNotFound );
|
|
1366 |
CXnViewData* view = &( ActiveViewData() );
|
|
1367 |
RPointerArray< CXnPluginData >& views( iRootData->PluginData() );
|
|
1368 |
index = views.Find( view );
|
|
1369 |
return index;
|
|
1370 |
}
|
|
1371 |
|
|
1372 |
// -----------------------------------------------------------------------------
|
|
1373 |
// CXnViewManager::MaxPages()
|
|
1374 |
// Gets the maximum allowed page count for this app configuration
|
|
1375 |
// -----------------------------------------------------------------------------
|
|
1376 |
//
|
|
1377 |
TInt CXnViewManager::MaxPages() const
|
|
1378 |
{
|
|
1379 |
return iRootData->MaxPages();
|
|
1380 |
}
|
|
1381 |
|
|
1382 |
// -----------------------------------------------------------------------------
|
|
1383 |
// CXnViewManager::NotifyContainerChangedL()
|
|
1384 |
// Notifies container is changed, this is called always by CXnViewAdapter
|
|
1385 |
// -----------------------------------------------------------------------------
|
|
1386 |
//
|
|
1387 |
void CXnViewManager::NotifyContainerChangedL( CXnViewData& aViewToActivate )
|
|
1388 |
{
|
|
1389 |
iAsyncCb->Cancel();
|
|
1390 |
|
|
1391 |
CXnViewData& viewToDeactivate( ActiveViewData() );
|
|
1392 |
|
|
1393 |
TInt err( KErrNone );
|
|
1394 |
|
|
1395 |
if ( &aViewToActivate != &viewToDeactivate )
|
|
1396 |
{
|
|
1397 |
NotifyViewDeactivatedL( viewToDeactivate );
|
|
1398 |
|
|
1399 |
err = viewToDeactivate.SetActive( EFalse );
|
|
1400 |
aViewToActivate.SetActive( ETrue );
|
|
1401 |
|
|
1402 |
// Cache update is needed after view activation
|
|
1403 |
UpdateCachesL();
|
|
1404 |
}
|
|
1405 |
else
|
|
1406 |
{
|
|
1407 |
// Activate first view
|
|
1408 |
err = aViewToActivate.SetActive( ETrue );
|
|
1409 |
|
|
1410 |
// Cache update is needed after view activation
|
|
1411 |
UpdateCachesL();
|
|
1412 |
|
|
1413 |
// Schedule remaining views loading
|
|
1414 |
iRootData->LoadRemainingViews();
|
|
1415 |
}
|
|
1416 |
|
|
1417 |
HandleErrorNotes( err );
|
|
1418 |
|
|
1419 |
NotifyViewActivatedL( aViewToActivate );
|
|
1420 |
}
|
|
1421 |
|
|
1422 |
// -----------------------------------------------------------------------------
|
|
1423 |
// CXnViewManager::NotifyAllViewsLoadedL()
|
|
1424 |
// Notifies that all views included in root configuration are loaded
|
|
1425 |
// -----------------------------------------------------------------------------
|
|
1426 |
//
|
|
1427 |
void CXnViewManager::NotifyAllViewsLoadedL()
|
|
1428 |
{
|
|
1429 |
for ( TInt i = 0; i < iObservers.Count(); i++ )
|
|
1430 |
{
|
|
1431 |
iObservers[i]->NotifyAllViewsLoadedL();
|
|
1432 |
}
|
|
1433 |
}
|
|
1434 |
|
|
1435 |
// -----------------------------------------------------------------------------
|
|
1436 |
// CXnViewManager::PublishersReadyL()
|
|
1437 |
// Notifies that aViewData activation is complete
|
|
1438 |
// -----------------------------------------------------------------------------
|
|
1439 |
//
|
|
1440 |
void CXnViewManager::PublishersReadyL( CXnViewData& aViewData, TInt aResult )
|
|
1441 |
{
|
|
1442 |
if ( !aViewData.Active() )
|
|
1443 |
{
|
|
1444 |
return;
|
|
1445 |
}
|
|
1446 |
|
|
1447 |
iAsyncCb->Cancel();
|
|
1448 |
|
|
1449 |
TCallBack cb( ContainerActivated, this ) ;
|
|
1450 |
|
|
1451 |
iAsyncCb->Start( KActivationCompleteInterval, 0, cb );
|
|
1452 |
|
|
1453 |
if ( !iUiReady )
|
|
1454 |
{
|
|
1455 |
iAppUiAdapter.HandleUiReadyEventL();
|
|
1456 |
iUiReady = ETrue;
|
|
1457 |
}
|
|
1458 |
|
|
1459 |
if ( aResult == KErrNoMemory )
|
|
1460 |
{
|
|
1461 |
ShowErrorL( R_QTN_HS_HS_MEMORY_FULL );
|
|
1462 |
}
|
|
1463 |
else if ( aResult == KXnErrWidgetPluginFailure )
|
|
1464 |
{
|
|
1465 |
ShowErrorL( R_QTN_HS_ERROR_WIDGETS_REMOVED );
|
|
1466 |
}
|
|
1467 |
}
|
|
1468 |
|
|
1469 |
// -----------------------------------------------------------------------------
|
|
1470 |
// CXnViewManager::ContainerActivated()
|
|
1471 |
// Notifies that a container activation is complete
|
|
1472 |
// -----------------------------------------------------------------------------
|
|
1473 |
//
|
|
1474 |
/* static */ TInt CXnViewManager::ContainerActivated( TAny* aAny )
|
|
1475 |
{
|
|
1476 |
CXnViewManager* self = static_cast< CXnViewManager* >( aAny );
|
|
1477 |
|
|
1478 |
self->iAsyncCb->Cancel();
|
|
1479 |
|
|
1480 |
CXnViewData& active( self->ActiveViewData() );
|
|
1481 |
|
|
1482 |
TRAP_IGNORE( self->iHspsWrapper->SetActivePluginL( active.PluginId() ) );
|
|
1483 |
|
|
1484 |
CXnBackgroundManager& bg( self->iAppUiAdapter.ViewAdapter().BgManager() );
|
|
1485 |
|
|
1486 |
TRAP_IGNORE( bg.StoreWallpaperL() );
|
|
1487 |
|
|
1488 |
self->NotifyContainerActivatedL( active );
|
|
1489 |
|
|
1490 |
return KErrNone;
|
|
1491 |
}
|
|
1492 |
|
|
1493 |
// -----------------------------------------------------------------------------
|
|
1494 |
// CXnViewManager::NotifyViewActivatedL()
|
|
1495 |
// Notifies view is activated
|
|
1496 |
// -----------------------------------------------------------------------------
|
|
1497 |
//
|
|
1498 |
void CXnViewManager::NotifyViewActivatedL( const CXnViewData& aViewData )
|
|
1499 |
{
|
|
1500 |
// Report widget amount in the view
|
|
1501 |
ReportWidgetAmountL( aViewData );
|
|
1502 |
|
|
1503 |
for ( TInt i = 0; i < iObservers.Count(); i++ )
|
|
1504 |
{
|
|
1505 |
iObservers[i]->NotifyViewActivatedL( aViewData );
|
|
1506 |
}
|
|
1507 |
}
|
|
1508 |
|
|
1509 |
// -----------------------------------------------------------------------------
|
|
1510 |
// CXnViewManager::NotifyViewDeactivatedL()
|
|
1511 |
// Notifies view is deactivated
|
|
1512 |
// -----------------------------------------------------------------------------
|
|
1513 |
//
|
|
1514 |
void CXnViewManager::NotifyViewDeactivatedL( const CXnViewData& aViewData )
|
|
1515 |
{
|
|
1516 |
for ( TInt i = 0; i < iObservers.Count(); i++ )
|
|
1517 |
{
|
|
1518 |
iObservers[i]->NotifyViewDeactivatedL( aViewData );
|
|
1519 |
}
|
|
1520 |
}
|
|
1521 |
|
|
1522 |
// -----------------------------------------------------------------------------
|
|
1523 |
// CXnViewManager::NotifyViewAdditionL()
|
|
1524 |
// Notifies view is added
|
|
1525 |
// -----------------------------------------------------------------------------
|
|
1526 |
//
|
|
1527 |
void CXnViewManager::NotifyViewAdditionL( const CXnViewData& aViewData )
|
|
1528 |
{
|
|
1529 |
for ( TInt i = 0; i < iObservers.Count(); i++ )
|
|
1530 |
{
|
|
1531 |
iObservers[i]->NotifyViewAdditionL( aViewData );
|
|
1532 |
}
|
|
1533 |
}
|
|
1534 |
|
|
1535 |
// -----------------------------------------------------------------------------
|
|
1536 |
// CXnViewManager::NotifyViewRemovalL()
|
|
1537 |
// Notifies view is removed
|
|
1538 |
// -----------------------------------------------------------------------------
|
|
1539 |
//
|
|
1540 |
void CXnViewManager::NotifyViewRemovalL( const CXnViewData& aViewData )
|
|
1541 |
{
|
|
1542 |
for ( TInt i = 0; i < iObservers.Count(); i++ )
|
|
1543 |
{
|
|
1544 |
iObservers[i]->NotifyViewRemovalL( aViewData );
|
|
1545 |
}
|
|
1546 |
}
|
|
1547 |
|
|
1548 |
// -----------------------------------------------------------------------------
|
|
1549 |
// CXnViewManager::NotifyConfigureWidgetL()
|
|
1550 |
// Notifies to configure widget
|
|
1551 |
// -----------------------------------------------------------------------------
|
|
1552 |
//
|
|
1553 |
void CXnViewManager::NotifyConfigureWidgetL( const CHsContentInfo& aContentInfo,
|
|
1554 |
CXnPluginData& aPluginData )
|
|
1555 |
{
|
|
1556 |
for ( TInt i = 0; i < iObservers.Count(); i++ )
|
|
1557 |
{
|
|
1558 |
iObservers[i]->NotifyConfigureWidgetL( aContentInfo, aPluginData );
|
|
1559 |
}
|
|
1560 |
}
|
|
1561 |
|
|
1562 |
// -----------------------------------------------------------------------------
|
|
1563 |
// CXnViewManager::NotifyWidgetAdditionL()
|
|
1564 |
// Notifys widget is added
|
|
1565 |
// -----------------------------------------------------------------------------
|
|
1566 |
//
|
|
1567 |
void CXnViewManager::NotifyWidgetAdditionL( const CXnPluginData& aPluginData )
|
|
1568 |
{
|
|
1569 |
for ( TInt i = 0; i < iObservers.Count(); i++ )
|
|
1570 |
{
|
|
1571 |
iObservers[i]->NotifyWidgetAdditionL( aPluginData );
|
|
1572 |
}
|
|
1573 |
|
|
1574 |
if ( aPluginData.Active() )
|
|
1575 |
{
|
|
1576 |
// Update UI appearance after active view configuration is changed
|
|
1577 |
iUiEngine->RenderUIL();
|
|
1578 |
}
|
|
1579 |
}
|
|
1580 |
|
|
1581 |
// -----------------------------------------------------------------------------
|
|
1582 |
// CXnViewManager::NotifyWidgetRemovalL()
|
|
1583 |
// Notifys widget is removed
|
|
1584 |
// -----------------------------------------------------------------------------
|
|
1585 |
//
|
|
1586 |
void CXnViewManager::NotifyWidgetRemovalL( const CXnPluginData& aPluginData )
|
|
1587 |
{
|
|
1588 |
// This loop is intend to go from "count - 1 to 0", because CXnEditor is
|
|
1589 |
// the first registered observer and it must be notified as the last one
|
|
1590 |
for ( TInt i = iObservers.Count() - 1; i >= 0 ; i-- )
|
|
1591 |
{
|
|
1592 |
iObservers[i]->NotifyWidgetRemovalL( aPluginData );
|
|
1593 |
}
|
|
1594 |
}
|
|
1595 |
|
|
1596 |
// -----------------------------------------------------------------------------
|
|
1597 |
// CXnViewManager::NotifyContainerActivatedL()
|
|
1598 |
// Notifies view container is activated
|
|
1599 |
// -----------------------------------------------------------------------------
|
|
1600 |
//
|
|
1601 |
void CXnViewManager::NotifyContainerActivatedL( const CXnViewData& aViewData )
|
|
1602 |
{
|
|
1603 |
for ( TInt i = 0; i < iObservers.Count(); i++ )
|
|
1604 |
{
|
|
1605 |
iObservers[i]->NotifyContainerActivatedL( aViewData );
|
|
1606 |
}
|
|
1607 |
}
|
|
1608 |
|
|
1609 |
// -----------------------------------------------------------------------------
|
|
1610 |
// CXnViewManager::UpdateCachesL()
|
|
1611 |
//
|
|
1612 |
// -----------------------------------------------------------------------------
|
|
1613 |
//
|
|
1614 |
void CXnViewManager::UpdateCachesL()
|
|
1615 |
{
|
|
1616 |
CXnViewData& activeViewData( ActiveViewData() );
|
|
1617 |
iControls.Reset();
|
|
1618 |
activeViewData.ControlsL( iControls );
|
|
1619 |
iAppearanceNodes.Reset();
|
|
1620 |
activeViewData.AppearanceNodesL( iAppearanceNodes );
|
|
1621 |
iResources->Reset();
|
|
1622 |
activeViewData.ResourcesL( *iResources );
|
|
1623 |
}
|
|
1624 |
|
|
1625 |
// -----------------------------------------------------------------------------
|
|
1626 |
// CXnViewManager::ReportWidgetAmountL()
|
|
1627 |
//
|
|
1628 |
// -----------------------------------------------------------------------------
|
|
1629 |
//
|
|
1630 |
void CXnViewManager::ReportWidgetAmountL( const CXnViewData& aViewData )
|
|
1631 |
{
|
|
1632 |
CXnNode* node( aViewData.ViewNode() );
|
|
1633 |
|
|
1634 |
if ( !iWidgetAmountTrigger )
|
|
1635 |
{
|
|
1636 |
iWidgetAmountTrigger = BuildTriggerL( *iUiEngine,
|
|
1637 |
XnPropertyNames::action::trigger::name::KWidgetAmount );
|
|
1638 |
}
|
|
1639 |
|
|
1640 |
RPointerArray< CXnPluginData >& plugins( aViewData.PluginData() );
|
|
1641 |
TInt max( plugins.Count() );
|
|
1642 |
TInt count( 0 );
|
|
1643 |
|
|
1644 |
for ( TInt i = 0; i < plugins.Count(); i++ )
|
|
1645 |
{
|
|
1646 |
CXnPluginData* plugin( plugins[i] );
|
|
1647 |
|
|
1648 |
if ( plugin->Occupied() )
|
|
1649 |
{
|
|
1650 |
if( plugin->Removable() )
|
|
1651 |
{
|
|
1652 |
count++;
|
|
1653 |
}
|
|
1654 |
else
|
|
1655 |
{
|
|
1656 |
// non-removable widget consumes max amount
|
|
1657 |
max--;
|
|
1658 |
}
|
|
1659 |
}
|
|
1660 |
}
|
|
1661 |
|
|
1662 |
CXnProperty* prop(
|
|
1663 |
iWidgetAmountTrigger->GetPropertyL( XnPropertyNames::action::KValue ) );
|
|
1664 |
|
|
1665 |
if ( prop )
|
|
1666 |
{
|
|
1667 |
if ( count == max )
|
|
1668 |
{
|
|
1669 |
// All plugins occupied, report max widget amount reached
|
|
1670 |
_LIT8( KMax, "max" );
|
|
1671 |
|
|
1672 |
static_cast< CXnDomPropertyValue* >(
|
|
1673 |
prop->Property()->PropertyValueList().Item( 0 ) )
|
|
1674 |
->SetStringValueL( CXnDomPropertyValue::EString, KMax() );
|
|
1675 |
}
|
|
1676 |
else
|
|
1677 |
{
|
|
1678 |
// Report number of widgets
|
|
1679 |
TBuf8< 8 > value;
|
|
1680 |
|
|
1681 |
value.AppendNum( count );
|
|
1682 |
|
|
1683 |
static_cast< CXnDomPropertyValue* >(
|
|
1684 |
prop->Property()->PropertyValueList().Item( 0 ) )
|
|
1685 |
->SetStringValueL( CXnDomPropertyValue::EString, value );
|
|
1686 |
}
|
|
1687 |
}
|
|
1688 |
|
|
1689 |
node->ReportXuikonEventL( *iWidgetAmountTrigger );
|
|
1690 |
}
|
|
1691 |
|
|
1692 |
// -----------------------------------------------------------------------------
|
|
1693 |
// CXnViewManager::ShowErrorL
|
|
1694 |
//
|
|
1695 |
// -----------------------------------------------------------------------------
|
|
1696 |
//
|
|
1697 |
void CXnViewManager::ShowErrorL( TInt aResource ) const
|
|
1698 |
{
|
|
1699 |
if ( aResource == R_QTN_HS_HS_MEMORY_FULL )
|
|
1700 |
{
|
|
1701 |
iOomSysHandler->HandlePotentialOomL();
|
|
1702 |
}
|
|
1703 |
else
|
|
1704 |
{
|
|
1705 |
HBufC* msg( StringLoader::LoadLC( aResource ) );
|
|
1706 |
|
|
1707 |
CAknErrorNote* note = new ( ELeave ) CAknErrorNote;
|
|
1708 |
note->ExecuteLD( *msg );
|
|
1709 |
|
|
1710 |
CleanupStack::PopAndDestroy( msg );
|
|
1711 |
}
|
|
1712 |
}
|
|
1713 |
|
|
1714 |
// -----------------------------------------------------------------------------
|
|
1715 |
// CXnViewManager::HandleErrorNotes
|
|
1716 |
//
|
|
1717 |
// -----------------------------------------------------------------------------
|
|
1718 |
//
|
|
1719 |
void CXnViewManager::HandleErrorNotes( const TInt aError ) const
|
|
1720 |
{
|
|
1721 |
switch( aError )
|
|
1722 |
{
|
|
1723 |
case KErrNoMemory:
|
|
1724 |
TRAP_IGNORE( ShowErrorL( R_QTN_HS_HS_MEMORY_FULL ) );
|
|
1725 |
break;
|
|
1726 |
|
|
1727 |
case KXnErrViewPluginFailure:
|
|
1728 |
case KXnErrWidgetPluginFailure:
|
|
1729 |
TRAP_IGNORE( ShowErrorL( R_QTN_HS_ERROR_WIDGETS_REMOVED ) );
|
|
1730 |
break;
|
|
1731 |
|
|
1732 |
default:
|
|
1733 |
break;
|
|
1734 |
}
|
|
1735 |
}
|
|
1736 |
|
|
1737 |
// -----------------------------------------------------------------------------
|
|
1738 |
// CXnViewManager::OOMSysHandler
|
|
1739 |
//
|
|
1740 |
// -----------------------------------------------------------------------------
|
|
1741 |
//
|
|
1742 |
CXnOomSysHandler& CXnViewManager::OomSysHandler() const
|
|
1743 |
{
|
|
1744 |
return *iOomSysHandler;
|
|
1745 |
}
|
|
1746 |
|
|
1747 |
// -----------------------------------------------------------------------------
|
|
1748 |
// CXnViewManager::UpdatePageManagementInformationL()
|
|
1749 |
// -----------------------------------------------------------------------------
|
|
1750 |
//
|
|
1751 |
void CXnViewManager::UpdatePageManagementInformationL()
|
|
1752 |
{
|
|
1753 |
// Update MSK info
|
|
1754 |
// Obtain menu bar
|
|
1755 |
CXnNode* menuBar( iUiEngine->MenuBarNode() );
|
|
1756 |
|
|
1757 |
if ( menuBar )
|
|
1758 |
{
|
|
1759 |
// Get object implementing MXnMenuInterface
|
|
1760 |
XnMenuInterface::MXnMenuInterface* menuIf( NULL );
|
|
1761 |
XnComponentInterface::MakeInterfaceL( menuIf, menuBar->AppIfL() );
|
|
1762 |
|
|
1763 |
if ( menuIf )
|
|
1764 |
{
|
|
1765 |
// Get count of views in array and index of actual view
|
|
1766 |
TInt count( ViewAmount() );
|
|
1767 |
TInt current( ViewIndex() + 1 );
|
|
1768 |
|
|
1769 |
// Update MSK icon
|
|
1770 |
/*
|
|
1771 |
TInt index = ResolveIconIndex( count, current );
|
|
1772 |
menuIf->SetSoftKeyImageL( KSkinIds[index],
|
|
1773 |
KNullDesC,
|
|
1774 |
0,
|
|
1775 |
0,
|
|
1776 |
XnMenuInterface::MXnMenuInterface::ECenter,
|
|
1777 |
ETrue );
|
|
1778 |
*/
|
|
1779 |
TInt index = ResolveIconIndex( count, current );
|
|
1780 |
TAknsItemID iconId = ResolveIconId( index );
|
|
1781 |
menuIf->SetSoftKeyImageL( iconId,
|
|
1782 |
KNullDesC,
|
|
1783 |
0,
|
|
1784 |
0,
|
|
1785 |
XnMenuInterface::MXnMenuInterface::ECenter,
|
|
1786 |
ETrue );
|
|
1787 |
}
|
|
1788 |
}
|
|
1789 |
}
|
|
1790 |
|
|
1791 |
// -----------------------------------------------------------------------------
|
|
1792 |
// CXnViewManager::ResolveIconIndex
|
|
1793 |
//
|
|
1794 |
// -----------------------------------------------------------------------------
|
|
1795 |
TInt CXnViewManager::ResolveIconIndex( TInt aPageCount, TInt aPageNum ) const
|
|
1796 |
{
|
|
1797 |
TInt iconCount( 0 );
|
|
1798 |
|
|
1799 |
// Calculate total amount of icons. Each page has a aPage amount of icons.
|
|
1800 |
for ( TInt i( aPageCount ); 0 < i; i-- )
|
|
1801 |
{
|
|
1802 |
iconCount += i;
|
|
1803 |
}
|
|
1804 |
|
|
1805 |
TInt index( iconCount - aPageCount + aPageNum - 1 );
|
|
1806 |
|
|
1807 |
return index;
|
|
1808 |
}
|
|
1809 |
|
|
1810 |
// -----------------------------------------------------------------------------
|
|
1811 |
// CXnViewManager::SystemStabileTimerCallback
|
|
1812 |
// -----------------------------------------------------------------------------
|
|
1813 |
TInt CXnViewManager::SystemStabileTimerCallback( TAny* aAny )
|
|
1814 |
{
|
|
1815 |
CXnViewManager* self = static_cast<CXnViewManager*>( aAny );
|
|
1816 |
|
|
1817 |
self->ResetCrashCount();
|
|
1818 |
|
|
1819 |
if( self->iStabilityTimer )
|
|
1820 |
{
|
|
1821 |
self->iStabilityTimer->Cancel();
|
|
1822 |
}
|
|
1823 |
|
|
1824 |
return KErrNone;
|
|
1825 |
}
|
|
1826 |
|
|
1827 |
// -----------------------------------------------------------------------------
|
|
1828 |
// CXnViewManager::ResetCrashCount
|
|
1829 |
//
|
|
1830 |
// -----------------------------------------------------------------------------
|
|
1831 |
void CXnViewManager::ResetCrashCount()
|
|
1832 |
{
|
|
1833 |
RProperty::Set( TUid::Uid( KPSCategoryUid ), KPSCrashCountKey, 0 );
|
|
1834 |
}
|
|
1835 |
|
|
1836 |
// -----------------------------------------------------------------------------
|
|
1837 |
// CXnViewManager::DoRobustnessCheckL
|
|
1838 |
//
|
|
1839 |
// -----------------------------------------------------------------------------
|
|
1840 |
void CXnViewManager::DoRobustnessCheckL()
|
|
1841 |
{
|
|
1842 |
TInt crashCount = 0;
|
|
1843 |
|
|
1844 |
RProperty::Get( TUid::Uid( KPSCategoryUid ),
|
|
1845 |
KPSCrashCountKey,
|
|
1846 |
crashCount );
|
|
1847 |
if( crashCount == KCrashRestoreDefaultTreshold )
|
|
1848 |
{
|
|
1849 |
// Try to activate another root configuration with a licensee default status
|
|
1850 |
iHspsWrapper->RestoreDefaultConfL();
|
|
1851 |
|
|
1852 |
CAknQueryDialog* query = CAknQueryDialog::NewL();
|
|
1853 |
query->PrepareLC( R_HS_CONTENT_REMOVED_VIEW );
|
|
1854 |
|
|
1855 |
HBufC* queryText( StringLoader::LoadLC( R_HS_ERROR_CONTENT_REMOVED ) );
|
|
1856 |
query->SetPromptL( queryText->Des() );
|
|
1857 |
CleanupStack::PopAndDestroy( queryText );
|
|
1858 |
|
|
1859 |
query->RunLD();
|
|
1860 |
}
|
|
1861 |
else if( crashCount == KCrashRestoreAllTreshold )
|
|
1862 |
{
|
|
1863 |
// Reinstall all plugins from the ROM, UDA and eMMC drives
|
|
1864 |
iHspsWrapper->RestoreAllConfL();
|
|
1865 |
}
|
|
1866 |
else if( crashCount == KCrashRestoreRomTreshold )
|
|
1867 |
{
|
|
1868 |
// Reinstall from the ROM drive only
|
|
1869 |
iHspsWrapper->RestoreRomConfL();
|
|
1870 |
}
|
|
1871 |
else if( crashCount >= KCrashRestoreViewsTreshold )
|
|
1872 |
{
|
|
1873 |
// Remove all the Homescreen pages and widgets
|
|
1874 |
iHspsWrapper->RestoreViewsL();
|
|
1875 |
|
|
1876 |
ResetCrashCount();
|
|
1877 |
return;
|
|
1878 |
}
|
|
1879 |
|
|
1880 |
if( crashCount > 0 )
|
|
1881 |
{
|
|
1882 |
// Start stability timer to ensure that
|
|
1883 |
// if system is stabile at least KStabilityInterval
|
|
1884 |
// then crash count is reset to 0.
|
|
1885 |
iStabilityTimer = CPeriodic::NewL( CActive::EPriorityStandard );
|
|
1886 |
iStabilityTimer->Start( KStabilityInterval,
|
|
1887 |
KStabilityInterval,
|
|
1888 |
TCallBack( SystemStabileTimerCallback, this ) );
|
|
1889 |
}
|
|
1890 |
}
|
|
1891 |
|
|
1892 |
// End of file
|