|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Content renderer implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <e32hashtab.h> |
|
20 #include <utf.h> |
|
21 #include <gulicon.h> |
|
22 |
|
23 // User includes |
|
24 #include <hscontentpublisher.h> |
|
25 #include <hspublisherinfo.h> |
|
26 #include "contentrenderer.h" |
|
27 #include "appui.h" |
|
28 #include "activetransactionstack.h" |
|
29 #include "transactionfactoryimpl.h" |
|
30 #include "mtransaction.h" |
|
31 #include "mtransactionelement.h" |
|
32 #include "aixmluiutils.h" |
|
33 #include "xmluicontroller.h" |
|
34 #include "xmlnodeidgenerator.h" |
|
35 #include "aixmluiconstants.h" |
|
36 #include "aifweventhandler.h" |
|
37 #include "databuffertransactionelement.h" |
|
38 #include "newstickertransactionelement.h" |
|
39 #include "csspropertymap.h" |
|
40 #include "policyevaluator.h" |
|
41 #include "debug.h" |
|
42 #include "xnuiengineappif.h" |
|
43 #include "xnnodeappif.h" |
|
44 #include "xnproperty.h" |
|
45 #include "mxncomponentinterface.h" |
|
46 #include "xntext.h" |
|
47 #include "xnbitmap.h" |
|
48 #include "xntype.h" |
|
49 #include "xnmenuadapter.h" |
|
50 #include "xnlistquerydialogadapter.h" |
|
51 #include "xnnewsticker.h" |
|
52 #include "mxncomponentinterface.h" |
|
53 #include "aistrcnv.h" |
|
54 #include "contentprioritymap.h" |
|
55 #include "ainativeuiplugins.h" |
|
56 |
|
57 using namespace AiXmlUiController; |
|
58 using namespace AiUiDef::xml; |
|
59 using namespace XnTextInterface; |
|
60 using namespace XnImageInterface; |
|
61 |
|
62 /** |
|
63 * Cleanup item for cleanup of TPtrHashMapIter |
|
64 */ |
|
65 class TMapCleanupItem |
|
66 { |
|
67 public: |
|
68 /** |
|
69 * C++ consturctor |
|
70 */ |
|
71 TMapCleanupItem( TPtrHashMapIter< TDesC, TInt >& aIterator ); |
|
72 |
|
73 /** |
|
74 * Removes the pointers in the map and deletes the objects |
|
75 * referenced by the pointers. |
|
76 */ |
|
77 void Release(); |
|
78 |
|
79 private: |
|
80 TPtrHashMapIter< TDesC, TInt > iIterator; |
|
81 }; |
|
82 |
|
83 // ---------------------------------------------------------------------------- |
|
84 // TMapCleanupItem::TMapCleanupItem |
|
85 // |
|
86 // ---------------------------------------------------------------------------- |
|
87 // |
|
88 TMapCleanupItem::TMapCleanupItem( TPtrHashMapIter< TDesC, TInt >& aIterator ) |
|
89 : iIterator( aIterator ) |
|
90 { |
|
91 } |
|
92 |
|
93 // ---------------------------------------------------------------------------- |
|
94 // TMapCleanupItem::Release |
|
95 // |
|
96 // ---------------------------------------------------------------------------- |
|
97 // |
|
98 void TMapCleanupItem::Release() |
|
99 { |
|
100 // Delete current key and value |
|
101 const TDesC* key( iIterator.CurrentKey() ); |
|
102 const TInt* value( iIterator.CurrentValue() ); |
|
103 |
|
104 delete key; |
|
105 delete value; |
|
106 |
|
107 // Remove mapping from the map. |
|
108 iIterator.RemoveCurrent(); |
|
109 } |
|
110 |
|
111 // ============================ LOCAL FUNCTIONS =============================== |
|
112 |
|
113 // ---------------------------------------------------------------------------- |
|
114 // ContentItemIterator |
|
115 // Gets content item iterator |
|
116 // ---------------------------------------------------------------------------- |
|
117 // |
|
118 static MAiContentItemIterator* ContentItemIterator( CHsContentPublisher& aPlugin, |
|
119 CHsContentPublisher::TProperty aType ) |
|
120 { |
|
121 return static_cast< |
|
122 MAiContentItemIterator* >( aPlugin.GetProperty( aType ) ); |
|
123 } |
|
124 |
|
125 // ---------------------------------------------------------------------------- |
|
126 // ContentPriority |
|
127 // Gets the content priority associated in the property element |
|
128 // ---------------------------------------------------------------------------- |
|
129 // |
|
130 static TInt ContentPriority( CXnNodeAppIf& aPropertyElement ) |
|
131 { |
|
132 TInt32 priority( KErrNotFound ); |
|
133 |
|
134 const TDesC8* name( |
|
135 PropertyValue( aPropertyElement, property::KName ) ); |
|
136 |
|
137 if ( name && *name == name::KPriority ) |
|
138 { |
|
139 const TDesC8* value( |
|
140 PropertyValue( aPropertyElement, property::KValue ) ); |
|
141 |
|
142 if ( value ) |
|
143 { |
|
144 AiUtility::ParseInt( priority, *value ); |
|
145 } |
|
146 } |
|
147 |
|
148 return priority; |
|
149 } |
|
150 |
|
151 // ---------------------------------------------------------------------------- |
|
152 // RemoveNonPriorityElements |
|
153 // Remove elements from array which do not contain priority or priority is |
|
154 // not lower than the given value. |
|
155 // ---------------------------------------------------------------------------- |
|
156 // |
|
157 static void RemoveNonPriorityElements( RPointerArray< CXnNodeAppIf>& aElements, |
|
158 TInt aLastPriority ) |
|
159 { |
|
160 // Remove non priority elements and higher priority elements |
|
161 TInt elementCount( aElements.Count() ); |
|
162 |
|
163 for ( TInt i = 0; i < elementCount; ) |
|
164 { |
|
165 CXnNodeAppIf* current( aElements[i] ); |
|
166 |
|
167 // Check name attribute |
|
168 const TDesC8* name( PropertyValue( *current, property::KName ) ); |
|
169 |
|
170 if ( !name || *name != name::KPriority ) |
|
171 { |
|
172 // Remove current |
|
173 aElements.Remove( i ); |
|
174 --elementCount; |
|
175 } |
|
176 else |
|
177 { |
|
178 // Check current priority |
|
179 const TDesC8* value( |
|
180 PropertyValue( *current, property::KValue ) ); |
|
181 |
|
182 if ( !value ) // value not present |
|
183 { |
|
184 aElements.Remove( i ); |
|
185 --elementCount; |
|
186 continue; |
|
187 } |
|
188 |
|
189 TInt32 currentPriority( KErrNotFound ); |
|
190 |
|
191 if ( AiUtility::ParseInt( currentPriority, *value ) != KErrNone ) |
|
192 { |
|
193 // value is not integer |
|
194 aElements.Remove( i ); |
|
195 --elementCount; |
|
196 continue; |
|
197 } |
|
198 |
|
199 if ( currentPriority < aLastPriority ) |
|
200 { |
|
201 // Keep element and iterate further |
|
202 ++i; |
|
203 } |
|
204 else |
|
205 { |
|
206 // priority is too high |
|
207 aElements.Remove( i ); |
|
208 --elementCount; |
|
209 } |
|
210 } |
|
211 } |
|
212 } |
|
213 |
|
214 // ---------------------------------------------------------------------------- |
|
215 // DescendingPriorityOrder |
|
216 // Descending priority order for prioritized content selectors. |
|
217 // ---------------------------------------------------------------------------- |
|
218 // |
|
219 static TInt DescendingPriorityOrder( const CXnNodeAppIf& aNode1, |
|
220 const CXnNodeAppIf& aNode2 ) |
|
221 { |
|
222 /* |
|
223 * @param aNode1 First node to compare |
|
224 * @param aNode2 Second node to compare |
|
225 * @return 0 nodes have equal priority |
|
226 * @return >0 aNode1 has lower priority |
|
227 * @return <0 aNode2 has lower priority |
|
228 */ |
|
229 // Array content has been validated, so no checks are needed |
|
230 const TDesC8* value1( |
|
231 PropertyValue( aNode1, property::KValue ) ); |
|
232 |
|
233 const TDesC8* value2( |
|
234 PropertyValue( aNode2, property::KValue ) ); |
|
235 |
|
236 TInt32 priority1( KErrNotFound ); |
|
237 AiUtility::ParseInt( priority1, *value1 ); |
|
238 |
|
239 TInt32 priority2( KErrNotFound ); |
|
240 AiUtility::ParseInt( priority2, *value2 ); |
|
241 |
|
242 if ( priority1 == priority2 ) |
|
243 { |
|
244 return 0; |
|
245 } |
|
246 |
|
247 return ( priority1 < priority2 ) ? 1 : -1; |
|
248 } |
|
249 |
|
250 // ---------------------------------------------------------------------------- |
|
251 // RemoveDuplicateContentChangesL |
|
252 // Removes duplicate entries in content change array |
|
253 // ---------------------------------------------------------------------------- |
|
254 // |
|
255 static void RemoveDuplicateContentChangesL( RAiPolicyElementArray& aArray ) |
|
256 { |
|
257 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
258 { |
|
259 HBufC* id( PropertyValueL( aArray[i].Target(), |
|
260 AiUiDef::xml::property::KId ) ); |
|
261 |
|
262 if ( id ) |
|
263 { |
|
264 CleanupStack::PushL( id ); |
|
265 |
|
266 for ( TInt j = i; j < aArray.Count(); ++j ) |
|
267 { |
|
268 HBufC* id2( PropertyValueL( aArray[j].Target(), |
|
269 AiUiDef::xml::property::KId ) ); |
|
270 CleanupStack::PushL( id2 ); |
|
271 |
|
272 if ( id2 ) |
|
273 { |
|
274 // Same id and same policy |
|
275 if ( i != j && id->Compare( *id2 ) == 0 && |
|
276 ( aArray[i].Policy().Compare( aArray[j].Policy()) == 0 ) ) |
|
277 |
|
278 { |
|
279 aArray.Remove( j ); |
|
280 --j; |
|
281 } |
|
282 } |
|
283 |
|
284 CleanupStack::PopAndDestroy( id2 ); |
|
285 } |
|
286 |
|
287 CleanupStack::PopAndDestroy( id ); |
|
288 } |
|
289 } |
|
290 } |
|
291 |
|
292 // ---------------------------------------------------------------------------- |
|
293 // CleanupReleaseMapItem |
|
294 // Helper to handle cleanup of map iterator |
|
295 // ---------------------------------------------------------------------------- |
|
296 // |
|
297 static void CleanupReleaseMapItem( TAny* aMapCleanupItem ) |
|
298 { |
|
299 if ( aMapCleanupItem ) |
|
300 { |
|
301 static_cast< TMapCleanupItem* >( aMapCleanupItem )->Release(); |
|
302 } |
|
303 } |
|
304 |
|
305 // ---------------------------------------------------------------------------- |
|
306 // CleanupReleasePushL |
|
307 // Helper to push map iterator into cleanup stack. |
|
308 // ---------------------------------------------------------------------------- |
|
309 // |
|
310 static void CleanupReleasePushL( TMapCleanupItem& aCleanupItem ) |
|
311 { |
|
312 CleanupStack::PushL( TCleanupItem( CleanupReleaseMapItem, &aCleanupItem ) ); |
|
313 } |
|
314 |
|
315 // ============================ MEMBER FUNCTIONS =============================== |
|
316 |
|
317 // ---------------------------------------------------------------------------- |
|
318 // CContentRenderer::CContentRenderer |
|
319 // |
|
320 // ---------------------------------------------------------------------------- |
|
321 // |
|
322 CContentRenderer::CContentRenderer( CAppUi& aAppUi ) |
|
323 : iAppUi( aAppUi ) |
|
324 { |
|
325 } |
|
326 |
|
327 // ---------------------------------------------------------------------------- |
|
328 // CContentRenderer::ConstructL |
|
329 // |
|
330 // ---------------------------------------------------------------------------- |
|
331 // |
|
332 void CContentRenderer::ConstructL() |
|
333 { |
|
334 iContentPriorityMap = AiUtility::CContentPriorityMap::NewL(); |
|
335 iPropertyMap = CCssPropertyMap::NewL(); |
|
336 iFactory = CTransactionFactoryImpl::NewL(*iContentPriorityMap, |
|
337 *iPropertyMap); |
|
338 iStack = CActiveTransactionStack::NewL(); |
|
339 iNodeIdGenerator = CXmlNodeIdGenerator::NewL(); |
|
340 iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
341 iPolicyEvaluator = CPolicyEvaluator::NewL(); |
|
342 } |
|
343 |
|
344 // ---------------------------------------------------------------------------- |
|
345 // CContentRenderer::NewL |
|
346 // |
|
347 // ---------------------------------------------------------------------------- |
|
348 // |
|
349 CContentRenderer* CContentRenderer::NewL( CAppUi& aAppUi ) |
|
350 { |
|
351 CContentRenderer* self = new( ELeave ) CContentRenderer( aAppUi ); |
|
352 |
|
353 CleanupStack::PushL( self ); |
|
354 self->ConstructL(); |
|
355 CleanupStack::Pop( self ); |
|
356 |
|
357 return self; |
|
358 } |
|
359 |
|
360 // ---------------------------------------------------------------------------- |
|
361 // CContentRenderer::~CContentRenderer |
|
362 // |
|
363 // ---------------------------------------------------------------------------- |
|
364 // |
|
365 CContentRenderer::~CContentRenderer() |
|
366 { |
|
367 delete iPolicyEvaluator; |
|
368 |
|
369 if ( iTimer ) |
|
370 { |
|
371 iTimer->Cancel(); |
|
372 delete iTimer; |
|
373 } |
|
374 |
|
375 delete iNodeIdGenerator; |
|
376 |
|
377 if ( iStack ) |
|
378 { |
|
379 while ( !iStack->IsEmpty() ) |
|
380 { |
|
381 MTransaction* tr = iStack->Pop(); |
|
382 iFactory->ReleaseTransaction( tr ); |
|
383 } |
|
384 |
|
385 delete iStack; |
|
386 } |
|
387 |
|
388 delete iFactory; |
|
389 |
|
390 iRefreshableUiElements.ResetAndDestroy(); |
|
391 |
|
392 delete iPropertyMap; |
|
393 |
|
394 delete iContentPriorityMap; |
|
395 } |
|
396 |
|
397 // ---------------------------------------------------------------------------- |
|
398 // CContentRenderer::SetEventHandler |
|
399 // |
|
400 // ---------------------------------------------------------------------------- |
|
401 // |
|
402 void CContentRenderer::SetEventHandler( MAiFwEventHandler& aFwEventHandler ) |
|
403 { |
|
404 iFwEventHandler = &aFwEventHandler; |
|
405 } |
|
406 |
|
407 // ---------------------------------------------------------------------------- |
|
408 // CContentRenderer::StartTransaction |
|
409 // |
|
410 // ---------------------------------------------------------------------------- |
|
411 // |
|
412 TInt CContentRenderer::StartTransaction( TInt aTxId ) |
|
413 { |
|
414 __PRINT(__DBG_FORMAT("\t[I]\tXML UI: Start transaction id=%d"), aTxId); |
|
415 __HEAP("XML UI: Start transaction"); |
|
416 __TICK("XML UI: Start transaction"); |
|
417 |
|
418 TRAPD( error, DoStartTransactionL( aTxId ) ); |
|
419 |
|
420 if ( error ) |
|
421 { |
|
422 SetImmediateMode( ETrue ); |
|
423 } |
|
424 |
|
425 return error; |
|
426 } |
|
427 |
|
428 // ---------------------------------------------------------------------------- |
|
429 // CContentRenderer::Commit |
|
430 // |
|
431 // ---------------------------------------------------------------------------- |
|
432 // |
|
433 TInt CContentRenderer::Commit( TInt aTxId ) |
|
434 { |
|
435 // Remove transaction with aTxId from stack |
|
436 MTransaction* tr( iStack->Remove( aTxId ) ); |
|
437 |
|
438 if ( tr ) |
|
439 { |
|
440 // Commit transaction |
|
441 RPropertyHashMap propertyHashMap; |
|
442 |
|
443 TBool layoutChanged( EFalse ); |
|
444 |
|
445 TRAPD( error, tr->CommitL( layoutChanged, propertyHashMap ) ); |
|
446 |
|
447 if( error == KErrNone ) |
|
448 { |
|
449 TRAP_IGNORE( SetPropertyArraysL( propertyHashMap ) ); |
|
450 } |
|
451 |
|
452 propertyHashMap.Close(); |
|
453 |
|
454 __TICK("XML UI: Commit transaction"); |
|
455 __HEAP("XML UI: Commit transaction"); |
|
456 __PRINT(__DBG_FORMAT("\t[I]\tXML UI: Commit transaction id=%d"), aTxId); |
|
457 |
|
458 StartContentRefresh(); |
|
459 |
|
460 TRAP_IGNORE |
|
461 ( |
|
462 iAppUi.UiEngineL()->RenderUIL(); //jtm+++ |
|
463 ProcessContentChangesL( *tr ); |
|
464 ); |
|
465 |
|
466 |
|
467 iFactory->ReleaseTransaction( tr ); |
|
468 |
|
469 return error; |
|
470 } |
|
471 |
|
472 return KErrNotSupported; |
|
473 } |
|
474 |
|
475 // ---------------------------------------------------------------------------- |
|
476 // CContentRenderer::ProcessContentChangesL |
|
477 // |
|
478 // ---------------------------------------------------------------------------- |
|
479 // |
|
480 void CContentRenderer::ProcessContentChangesL( MTransaction& aTr ) |
|
481 { |
|
482 TDblQueIter<CTransactionElement> iter( aTr.ElementIter() ); |
|
483 RAiPolicyElementArray contentChangedArray; |
|
484 CleanupClosePushL( contentChangedArray ); |
|
485 |
|
486 while ( iter ) |
|
487 { |
|
488 CTransactionElement* element = iter++; |
|
489 CXnNodeAppIf& target = element->Target(); |
|
490 |
|
491 // Find own and parents policy/ContentChanged nodes |
|
492 iPolicyEvaluator->EvaluateContentChangedPolicyL( target, |
|
493 contentChangedArray); |
|
494 |
|
495 iPolicyEvaluator->EvaluateContentChangedPolicyL( *(target.ParentL() ), |
|
496 contentChangedArray); |
|
497 } |
|
498 |
|
499 ::RemoveDuplicateContentChangesL( contentChangedArray ); |
|
500 |
|
501 for ( TInt i = 0; i < contentChangedArray.Count(); ++i ) |
|
502 { |
|
503 ProcessContentChangeL( contentChangedArray[i] ); |
|
504 } |
|
505 |
|
506 CleanupStack::PopAndDestroy(); |
|
507 } |
|
508 |
|
509 // ---------------------------------------------------------------------------- |
|
510 // CContentRenderer::ProcessContentChangeL |
|
511 // |
|
512 // ---------------------------------------------------------------------------- |
|
513 // |
|
514 void CContentRenderer::ProcessContentChangeL( TAiPolicyElement& aElement ) |
|
515 { |
|
516 const TDesC8* id( PropertyValue( |
|
517 aElement.Target(), AiUiDef::xml::property::KId ) ); |
|
518 |
|
519 if ( id ) |
|
520 { |
|
521 CXnNodeAppIf* targetNode( |
|
522 FindNodeByIdL( *id, aElement.Target().Namespace() ) ); |
|
523 |
|
524 if ( targetNode ) |
|
525 { |
|
526 if ( aElement.Policy() == AiUiDef::xml::value::KShowTooltips ) |
|
527 { |
|
528 targetNode->ShowTooltipsL(); |
|
529 } |
|
530 } |
|
531 } |
|
532 } |
|
533 |
|
534 // ---------------------------------------------------------------------------- |
|
535 // CContentRenderer::CancelTransaction |
|
536 // |
|
537 // ---------------------------------------------------------------------------- |
|
538 // |
|
539 TInt CContentRenderer::CancelTransaction( TInt aTxId ) |
|
540 { |
|
541 // Remove transaction with aTxId from stack |
|
542 MTransaction* tr( iStack->Remove( aTxId ) ); |
|
543 |
|
544 if ( tr ) |
|
545 { |
|
546 // Release transaction to factory |
|
547 __TICK("XML UI: Cancel transaction"); |
|
548 __HEAP("XML UI: Cancel transaction"); |
|
549 __PRINT(__DBG_FORMAT("\t[I]\tXML UI: Cancel transaction id=%d"), aTxId); |
|
550 |
|
551 iFactory->ReleaseTransaction( tr ); |
|
552 |
|
553 return KErrNone; |
|
554 } |
|
555 |
|
556 return KErrNotSupported; |
|
557 } |
|
558 |
|
559 // ---------------------------------------------------------------------------- |
|
560 // CContentRenderer::CanPublish |
|
561 // |
|
562 // ---------------------------------------------------------------------------- |
|
563 // |
|
564 TBool CContentRenderer::CanPublish( CHsContentPublisher& aPlugin, |
|
565 TInt aContent, TInt aIndex ) |
|
566 { |
|
567 TInt error( KErrNone ); |
|
568 TInt retval( KErrNone ); |
|
569 |
|
570 __PRINTS("*** XML UI: CContentRenderer::CanPublish ***"); |
|
571 |
|
572 __PRINT( __DBG_FORMAT( "* Publisher name: %S, uid: 0x%x" ), |
|
573 &aPlugin.PublisherInfo().Name(), aPlugin.PublisherInfo().Uid().iUid ); |
|
574 |
|
575 __TIME("UC: Content Validation", |
|
576 TRAP( error, retval = CanPublishL( aPlugin, aContent, aIndex ) ) ); |
|
577 |
|
578 __HEAP("UC: Content Validation"); |
|
579 |
|
580 TBool ret( error == KErrNone && retval == KErrNone ); |
|
581 |
|
582 __PRINT( __DBG_FORMAT("*** XML UI: CContentRenderer::CanPublish - done, CanPublish: %d ***"), ret ); |
|
583 |
|
584 return ret; |
|
585 } |
|
586 |
|
587 // ---------------------------------------------------------------------------- |
|
588 // CContentRenderer::Publish |
|
589 // |
|
590 // ---------------------------------------------------------------------------- |
|
591 // |
|
592 TInt CContentRenderer::Publish( CHsContentPublisher& aPlugin, TInt aContent, |
|
593 TInt aResource, TInt aIndex ) |
|
594 { |
|
595 TInt error( KErrNone ); |
|
596 TInt retval( KErrNone ); |
|
597 |
|
598 __PRINTS("*** XML UI: CContentRenderer::Publish (Resource) ***"); |
|
599 |
|
600 __PRINT( __DBG_FORMAT( "* Publisher name: %S, uid: 0x%x" ), |
|
601 &aPlugin.PublisherInfo().Name(), aPlugin.PublisherInfo().Uid().iUid ); |
|
602 |
|
603 __TIME("UC: Content Publishing (Resource)", |
|
604 TRAP( error, retval = DoPublishL( aPlugin, aContent, aResource, aIndex ) ) ); |
|
605 |
|
606 __HEAP("UC: Content Publishing (Resource)"); |
|
607 |
|
608 if( !error && retval ) |
|
609 { |
|
610 error = retval; |
|
611 } |
|
612 |
|
613 __PRINT( __DBG_FORMAT("*** XML UI: CContentRenderer::Publish (Resource) - done, error: %d ***"), error ); |
|
614 |
|
615 return error; |
|
616 } |
|
617 |
|
618 // ---------------------------------------------------------------------------- |
|
619 // CContentRenderer::Publish |
|
620 // |
|
621 // ---------------------------------------------------------------------------- |
|
622 // |
|
623 TInt CContentRenderer::Publish( CHsContentPublisher& aPlugin, TInt aContent, |
|
624 const TDesC16& aText, TInt aIndex ) |
|
625 { |
|
626 TInt error( KErrNone ); |
|
627 TInt retval( KErrNone ); |
|
628 |
|
629 __PRINTS("*** XML UI: CContentRenderer::Publish (Value-Text) ***"); |
|
630 |
|
631 __PRINT( __DBG_FORMAT( "* Publisher name: %S, uid: 0x%x" ), |
|
632 &aPlugin.PublisherInfo().Name(), aPlugin.PublisherInfo().Uid().iUid ); |
|
633 |
|
634 __TIME("UC: Content Publishing (Value-Text)", |
|
635 TRAP( error, retval = DoPublishL( aPlugin, aContent, aText, aIndex ) ) ); |
|
636 |
|
637 __HEAP("UC: Content Publishing (Value-Text)"); |
|
638 |
|
639 if( !error && retval ) |
|
640 { |
|
641 error = retval; |
|
642 } |
|
643 |
|
644 __PRINT( __DBG_FORMAT("*** XML UI: CContentRenderer::Publish (Value-Text) - done, error: %d ***"), error ); |
|
645 |
|
646 return error; |
|
647 } |
|
648 |
|
649 // ---------------------------------------------------------------------------- |
|
650 // CContentRenderer::Publish |
|
651 // |
|
652 // ---------------------------------------------------------------------------- |
|
653 // |
|
654 TInt CContentRenderer::Publish( CHsContentPublisher& aPlugin, TInt aContent, |
|
655 const TDesC8& aBuf, TInt aIndex ) |
|
656 { |
|
657 TInt error( KErrNone ); |
|
658 TInt retval( KErrNone ); |
|
659 |
|
660 __PRINTS("*** XML UI: CContentRenderer::Publish (Value-Buf) ***"); |
|
661 |
|
662 __PRINT( __DBG_FORMAT( "* Publisher name: %S, uid: 0x%x" ), |
|
663 &aPlugin.PublisherInfo().Name(), aPlugin.PublisherInfo().Uid().iUid ); |
|
664 |
|
665 __TIME("UC: Content Publishing (Value-Buf)", |
|
666 TRAP( error, retval = DoPublishL( aPlugin, aContent, aBuf, aIndex ) ) ); |
|
667 |
|
668 __HEAP("UC: Content Publishing (Value-Buf)"); |
|
669 |
|
670 if( !error && retval ) |
|
671 { |
|
672 error = retval; |
|
673 } |
|
674 |
|
675 __PRINT( __DBG_FORMAT("*** XML UI: CContentRenderer::Publish (Value-Buf) - done, error: %d ***"), error ); |
|
676 |
|
677 return error; |
|
678 } |
|
679 |
|
680 // ---------------------------------------------------------------------------- |
|
681 // CContentRenderer::Publish |
|
682 // |
|
683 // ---------------------------------------------------------------------------- |
|
684 // |
|
685 TInt CContentRenderer::Publish( CHsContentPublisher& aPlugin, TInt aContent, |
|
686 RFile& aFile, TInt aIndex ) |
|
687 { |
|
688 TInt error( KErrNone ); |
|
689 TInt retval( KErrNone ); |
|
690 |
|
691 __PRINTS("*** XML UI: CContentRenderer::Publish (Value-RFile) ***"); |
|
692 |
|
693 __PRINT( __DBG_FORMAT( "* Publisher name: %S, uid: 0x%x" ), |
|
694 &aPlugin.PublisherInfo().Name(), aPlugin.PublisherInfo().Uid().iUid ); |
|
695 |
|
696 __TIME("UC: Content Publishing (Value-RFile)", |
|
697 TRAP( error, retval = DoPublishL( aPlugin, aContent, aFile, aIndex ) ) ); |
|
698 |
|
699 __HEAP("UC: Content Publishing (Value-RFile)"); |
|
700 |
|
701 if( !error && retval ) |
|
702 { |
|
703 error = retval; |
|
704 } |
|
705 |
|
706 __PRINT( __DBG_FORMAT("*** XML UI: CContentRenderer::Publish (Value-RFile) - done, error: %d ***"), error ); |
|
707 |
|
708 return error; |
|
709 } |
|
710 |
|
711 // ---------------------------------------------------------------------------- |
|
712 // CContentRenderer::Clean |
|
713 // |
|
714 // ---------------------------------------------------------------------------- |
|
715 // |
|
716 TInt CContentRenderer::Clean( CHsContentPublisher& aPlugin, TInt aContent, |
|
717 TInt aIndex ) |
|
718 { |
|
719 TInt error( KErrNone ); |
|
720 TInt retval( KErrNone ); |
|
721 |
|
722 __PRINTS("*** XML UI: CContentRenderer::Clean (Clean) ***"); |
|
723 |
|
724 __PRINT( __DBG_FORMAT( "* Publisher name: %S, uid: 0x%x" ), |
|
725 &aPlugin.PublisherInfo().Name(), aPlugin.PublisherInfo().Uid().iUid ); |
|
726 |
|
727 __TIME("UC: Content Publishing (Clean)", |
|
728 TRAP( error, retval = DoCleanL( aPlugin, aContent, aIndex ) ) ); |
|
729 |
|
730 __HEAP("UC: Content Publishing (Clean)"); |
|
731 |
|
732 if( !error && retval ) |
|
733 { |
|
734 error = retval; |
|
735 } |
|
736 |
|
737 __PRINT( __DBG_FORMAT("*** XML UI: CContentRenderer::Clean (Clean) - done, error: %d ***"), error ); |
|
738 |
|
739 return error; |
|
740 } |
|
741 |
|
742 // ---------------------------------------------------------------------------- |
|
743 // CContentRenderer::CContentRenderer |
|
744 // |
|
745 // ---------------------------------------------------------------------------- |
|
746 // |
|
747 TAny* CContentRenderer::Extension( TUid /*aUid*/ ) |
|
748 { |
|
749 // No extensions supported |
|
750 return NULL; |
|
751 } |
|
752 |
|
753 // ---------------------------------------------------------------------------- |
|
754 // CContentRenderer::RequiresSubscription |
|
755 // |
|
756 // ---------------------------------------------------------------------------- |
|
757 // |
|
758 TBool CContentRenderer::RequiresSubscription( |
|
759 const THsPublisherInfo& aPublisherInfo ) const |
|
760 { |
|
761 if ( aPublisherInfo.Namespace() == KNativeUiNamespace ) |
|
762 { |
|
763 // Not targeted to this content renderer |
|
764 return EFalse; |
|
765 } |
|
766 |
|
767 return ETrue; |
|
768 } |
|
769 |
|
770 // ---------------------------------------------------------------------------- |
|
771 // CContentRenderer::DoStartTransactionL |
|
772 // |
|
773 // ---------------------------------------------------------------------------- |
|
774 // |
|
775 void CContentRenderer::DoStartTransactionL( TInt aTxId ) |
|
776 { |
|
777 MTransaction* tr( iFactory->CreateTransactionL( aTxId ) ); |
|
778 iStack->Push( tr ); |
|
779 |
|
780 SetImmediateMode( EFalse ); |
|
781 } |
|
782 |
|
783 // ---------------------------------------------------------------------------- |
|
784 // CContentRenderer::CanPublishL |
|
785 // |
|
786 // ---------------------------------------------------------------------------- |
|
787 // |
|
788 TInt CContentRenderer::CanPublishL( CHsContentPublisher& aPlugin, |
|
789 TInt aContent, TInt aIndex ) |
|
790 { |
|
791 // Get content item for aContent |
|
792 MAiContentItemIterator* iter( ContentItemIterator( |
|
793 aPlugin, CHsContentPublisher::EPublisherContent ) ); |
|
794 |
|
795 if ( !iter ) |
|
796 { |
|
797 return KErrNotSupported; |
|
798 } |
|
799 |
|
800 const TAiContentItem& item( iter->ItemL( aContent ) ); |
|
801 |
|
802 // Lookup ui element |
|
803 const TDesC& nodeId( iNodeIdGenerator->ContentNodeIdL( aPlugin, item ) ); |
|
804 |
|
805 CXnNodeAppIf* property( FindNodeByClassL( nodeId, aIndex, |
|
806 aPlugin.PublisherInfo().Namespace() ) ); |
|
807 |
|
808 if( !property ) |
|
809 { |
|
810 return KErrNotFound; |
|
811 } |
|
812 |
|
813 // Check content priority |
|
814 TInt priority( ContentPriority( *property ) ); |
|
815 |
|
816 CXnNodeAppIf* target( property->ParentL() ); |
|
817 |
|
818 if( !target ) |
|
819 { |
|
820 return KErrNotSupported; |
|
821 } |
|
822 |
|
823 if ( !AllowPublishByPriority( *target, priority ) ) |
|
824 { |
|
825 return KErrAccessDenied; |
|
826 } |
|
827 |
|
828 // Check if content type is supported by target |
|
829 const TDesC8& contentType( ContentType( item ) ); |
|
830 |
|
831 if ( !iFactory->IsSupported( *target, contentType ) && |
|
832 target->Type()->Type() != XnPropertyNames::listquerydialog::KListQueryDialog ) |
|
833 { |
|
834 return KErrNotSupported; |
|
835 } |
|
836 |
|
837 return KErrNone; |
|
838 } |
|
839 |
|
840 // ---------------------------------------------------------------------------- |
|
841 // CContentRenderer::DoPublishL |
|
842 // |
|
843 // ---------------------------------------------------------------------------- |
|
844 // |
|
845 TInt CContentRenderer::DoPublishL( CHsContentPublisher& aPlugin, TInt aContent, |
|
846 TInt aResource, TInt aIndex ) |
|
847 { |
|
848 TInt retval( KErrNotSupported ); |
|
849 |
|
850 const THsPublisherInfo& info( aPlugin.PublisherInfo() ); |
|
851 |
|
852 // Read ref value. |
|
853 MAiContentItemIterator* resIter( ContentItemIterator( |
|
854 aPlugin, CHsContentPublisher::EPublisherResources ) ); |
|
855 |
|
856 if ( !resIter ) |
|
857 { |
|
858 return retval; |
|
859 } |
|
860 |
|
861 const TAiContentItem& ref( resIter->ItemL( aResource ) ); |
|
862 |
|
863 const TDesC8& refType( ContentType( ref ) ); |
|
864 |
|
865 // Resolve source node |
|
866 const TDesC& nodeId( iNodeIdGenerator->ResourceNodeIdL( aPlugin, ref ) ); |
|
867 |
|
868 HBufC8* nodeId8( CnvUtfConverter::ConvertFromUnicodeToUtf8L( nodeId ) ); |
|
869 CleanupStack::PushL( nodeId8 ); |
|
870 |
|
871 CXnNodeAppIf* source( NULL ); |
|
872 |
|
873 __TIME_MARK( xmlOverhead ); |
|
874 |
|
875 source = FindNodeByIdL( *nodeId8, info.Namespace() ); |
|
876 |
|
877 __TIME_ENDMARK("XML UI: Lookup node by id", xmlOverhead); |
|
878 __PRINT(__DBG_FORMAT("\t[I]\tXML UI: Lookup node by id=%S"), &nodeId); |
|
879 |
|
880 CleanupStack::PopAndDestroy( nodeId8 ); |
|
881 |
|
882 // Fetch content id |
|
883 MAiContentItemIterator* iter( ContentItemIterator( |
|
884 aPlugin, CHsContentPublisher::EPublisherContent ) ); |
|
885 |
|
886 if ( !iter ) |
|
887 { |
|
888 return retval; |
|
889 } |
|
890 |
|
891 const TAiContentItem& item( iter->ItemL( aContent ) ); |
|
892 |
|
893 const TDesC& targetId( iNodeIdGenerator->ContentNodeIdL( aPlugin, item ) ); |
|
894 |
|
895 // Check types |
|
896 if ( refType == KContentTypeText ) |
|
897 { |
|
898 // Fetch text |
|
899 const TDesC8& text( source->GetPCData() ); |
|
900 |
|
901 // Delegate to data publishing function |
|
902 retval = PublishDataL( aPlugin, |
|
903 targetId, |
|
904 text, |
|
905 refType, |
|
906 aIndex, |
|
907 source ); |
|
908 } |
|
909 else if ( refType.Find( KContentTypeImage ) != KErrNotFound ) |
|
910 { |
|
911 // Fetch icon |
|
912 CGulIcon* icon( LoadIconLC( *source ) ); |
|
913 |
|
914 // Delegate to icon publishing function |
|
915 retval = PublishIconL( aPlugin, |
|
916 targetId, |
|
917 icon, |
|
918 aIndex, |
|
919 source ); |
|
920 |
|
921 CleanupStack::Pop( icon ); |
|
922 } |
|
923 |
|
924 return retval; |
|
925 } |
|
926 |
|
927 // ---------------------------------------------------------------------------- |
|
928 // CContentRenderer::DoPublishL |
|
929 // |
|
930 // ---------------------------------------------------------------------------- |
|
931 // |
|
932 TInt CContentRenderer::DoPublishL( CHsContentPublisher& aPlugin, TInt aContent, |
|
933 const TDesC16& aText, TInt aIndex ) |
|
934 { |
|
935 const THsPublisherInfo& info( aPlugin.PublisherInfo() ); |
|
936 |
|
937 // Resolve content item |
|
938 MAiContentItemIterator* iter( ContentItemIterator( |
|
939 aPlugin, CHsContentPublisher::EPublisherContent ) ); |
|
940 |
|
941 if ( !iter ) |
|
942 { |
|
943 return KErrNotSupported; |
|
944 } |
|
945 |
|
946 const TAiContentItem& item( iter->ItemL( aContent ) ); |
|
947 |
|
948 const TDesC8& type( ContentType( item ) ); |
|
949 |
|
950 if ( type == KContentTypeText ) |
|
951 { |
|
952 // Find ui element |
|
953 const TDesC& nodeId( |
|
954 iNodeIdGenerator->ContentNodeIdL( aPlugin, item ) ); |
|
955 |
|
956 __TIME_MARK( xmlOverhead ); |
|
957 |
|
958 CXnNodeAppIf* property( FindNodeByClassL( |
|
959 nodeId, aIndex, info.Namespace() ) ); |
|
960 |
|
961 if( !property ) |
|
962 { |
|
963 return KErrNotFound; |
|
964 } |
|
965 |
|
966 TInt priority( ContentPriority( *property ) ); |
|
967 |
|
968 __TIME_ENDMARK("XML UI: Lookup node by class", xmlOverhead); |
|
969 __PRINT(__DBG_FORMAT("\t[I]\tXML UI: Lookup node by class=%S"), &nodeId); |
|
970 |
|
971 //Navigate to parent |
|
972 CXnNodeAppIf* target( property->ParentL() ); |
|
973 |
|
974 if( !target ) |
|
975 { |
|
976 return KErrNotSupported; |
|
977 } |
|
978 |
|
979 // Check priority |
|
980 if ( AllowPublishByPriority( *target, priority ) ) |
|
981 { |
|
982 // Check if target is newsticker |
|
983 MTransactionElement* element( NULL ); |
|
984 |
|
985 if ( IsParentNewsticker( *target ) ) |
|
986 { |
|
987 CXnNodeAppIf *parent( target->ParentL() ); |
|
988 |
|
989 if( !parent ) |
|
990 { |
|
991 return KErrNotFound; |
|
992 } |
|
993 |
|
994 element = iFactory->CreateNewsTickerTransactionElementL( |
|
995 *target, aText, priority, aIndex ); |
|
996 } |
|
997 else if( target->Type()->Type() == |
|
998 XnListQueryDialogInterface::MXnListQueryDialogInterface::Type()) |
|
999 { |
|
1000 // Get the data interface for dialog and publish data |
|
1001 XnListQueryDialogInterface::MXnListQueryDialogInterface* listQuery( NULL ); |
|
1002 XnComponentInterface::MakeInterfaceL( listQuery, *target ); |
|
1003 LeaveIfNull( listQuery, KErrNotSupported ); |
|
1004 listQuery->ReplaceItemL( aText, aIndex -1 );// plugins publish ordinals not indexes |
|
1005 return KErrNone; |
|
1006 } |
|
1007 else |
|
1008 { |
|
1009 // Create transaction element for text |
|
1010 // Not put to cleanupstack, because element is from our pool! |
|
1011 element = iFactory->CreateTextTransactionElementL( *target, |
|
1012 aText, |
|
1013 priority ); |
|
1014 } |
|
1015 |
|
1016 iPolicyEvaluator->EvaluateContentPolicyL( |
|
1017 *target, element->PolicyArray() ); |
|
1018 |
|
1019 iPolicyEvaluator->EvaluateVisibilityPolicyL( |
|
1020 *target, element->PolicyArray() ); |
|
1021 |
|
1022 ProcessTransactionElementL( element ); |
|
1023 } |
|
1024 else |
|
1025 { |
|
1026 return KErrAccessDenied; |
|
1027 } |
|
1028 } |
|
1029 else |
|
1030 { |
|
1031 return KErrNotSupported; |
|
1032 } |
|
1033 |
|
1034 return KErrNone; |
|
1035 } |
|
1036 |
|
1037 // ---------------------------------------------------------------------------- |
|
1038 // CContentRenderer::DoPublishL |
|
1039 // |
|
1040 // ---------------------------------------------------------------------------- |
|
1041 // |
|
1042 TInt CContentRenderer::DoPublishL( CHsContentPublisher& aPlugin, TInt aContent, |
|
1043 const TDesC8& aBuf, TInt aIndex ) |
|
1044 { |
|
1045 TInt retval( KErrNotSupported ); |
|
1046 |
|
1047 // resolve content item |
|
1048 MAiContentItemIterator* iter( ContentItemIterator( |
|
1049 aPlugin, CHsContentPublisher::EPublisherContent ) ); |
|
1050 |
|
1051 if ( !iter ) |
|
1052 { |
|
1053 return retval; |
|
1054 } |
|
1055 |
|
1056 const TAiContentItem& item( iter->ItemL( aContent ) ); |
|
1057 |
|
1058 const TDesC8& type( ContentType( item ) ); |
|
1059 |
|
1060 const TDesC& nodeId( iNodeIdGenerator->ContentNodeIdL( aPlugin, item ) ); |
|
1061 |
|
1062 if( type == KContentTypeBitmap ) |
|
1063 { |
|
1064 // Unpack icon from pointer |
|
1065 CGulIcon* icon( LeaveIfNull( UnpackPtr<CGulIcon>( aBuf ), KErrArgument ) ); |
|
1066 |
|
1067 // Publish icon |
|
1068 retval = PublishIconL( aPlugin, nodeId, icon, aIndex ); |
|
1069 } |
|
1070 else if ( type == KContentTypeImageSvg || type == KContentTypeData ) |
|
1071 { |
|
1072 // Publish data |
|
1073 retval = PublishDataL( aPlugin, nodeId, aBuf, type, aIndex ); |
|
1074 } |
|
1075 |
|
1076 return retval; |
|
1077 } |
|
1078 |
|
1079 // ---------------------------------------------------------------------------- |
|
1080 // CContentRenderer::DoPublishL |
|
1081 // |
|
1082 // ---------------------------------------------------------------------------- |
|
1083 // |
|
1084 TInt CContentRenderer::DoPublishL( CHsContentPublisher& aPlugin, TInt aContent, |
|
1085 RFile& aFile, TInt aIndex ) |
|
1086 { |
|
1087 const THsPublisherInfo& info( aPlugin.PublisherInfo() ); |
|
1088 |
|
1089 //Resolve content item |
|
1090 MAiContentItemIterator* iter( ContentItemIterator( |
|
1091 aPlugin, CHsContentPublisher::EPublisherContent ) ); |
|
1092 |
|
1093 if ( !iter ) |
|
1094 { |
|
1095 return KErrNotSupported; |
|
1096 } |
|
1097 |
|
1098 const TAiContentItem& item( iter->ItemL( aContent ) ); |
|
1099 |
|
1100 const TDesC8& type( ContentType( item ) ); |
|
1101 |
|
1102 // Image support |
|
1103 if ( type.Find( KContentTypeImage ) != KErrNotFound ) |
|
1104 { |
|
1105 // Find ui element |
|
1106 const TDesC& nodeId( iNodeIdGenerator->ContentNodeIdL( aPlugin, item ) ); |
|
1107 |
|
1108 CXnNodeAppIf* property( FindNodeByClassL( |
|
1109 nodeId, aIndex, info.Namespace() ) ); |
|
1110 |
|
1111 if( !property ) |
|
1112 { |
|
1113 return KErrNotFound; |
|
1114 } |
|
1115 |
|
1116 // Check priority |
|
1117 TInt priority( ContentPriority( *property ) ); |
|
1118 |
|
1119 CXnNodeAppIf* target( property->ParentL() ); |
|
1120 |
|
1121 if( !target ) |
|
1122 { |
|
1123 return KErrNotSupported; |
|
1124 } |
|
1125 |
|
1126 if ( AllowPublishByPriority( *target, priority ) ) |
|
1127 { |
|
1128 // Create transaction element for file |
|
1129 MTransactionElement* element = |
|
1130 iFactory->CreateImageTransactionElementL( |
|
1131 *target, aFile, priority ); |
|
1132 |
|
1133 iPolicyEvaluator->EvaluateContentPolicyL( |
|
1134 *target, element->PolicyArray() ); |
|
1135 |
|
1136 iPolicyEvaluator->EvaluateVisibilityPolicyL( |
|
1137 *target, element->PolicyArray() ); |
|
1138 |
|
1139 ProcessTransactionElementL( element ); |
|
1140 } |
|
1141 else |
|
1142 { |
|
1143 return KErrAccessDenied; |
|
1144 } |
|
1145 } |
|
1146 else |
|
1147 { |
|
1148 return KErrNotSupported; |
|
1149 } |
|
1150 |
|
1151 return KErrNone; |
|
1152 } |
|
1153 |
|
1154 // ---------------------------------------------------------------------------- |
|
1155 // CContentRenderer::DoCleanL |
|
1156 // |
|
1157 // ---------------------------------------------------------------------------- |
|
1158 // |
|
1159 TInt CContentRenderer::DoCleanL( CHsContentPublisher& aPlugin, TInt aContent, |
|
1160 TInt aIndex ) |
|
1161 { |
|
1162 const THsPublisherInfo& info( aPlugin.PublisherInfo() ); |
|
1163 |
|
1164 // Resolve content item |
|
1165 MAiContentItemIterator* iter( ContentItemIterator( |
|
1166 aPlugin, CHsContentPublisher::EPublisherContent ) ); |
|
1167 |
|
1168 if ( !iter ) |
|
1169 { |
|
1170 return KErrNotSupported; |
|
1171 } |
|
1172 |
|
1173 const TAiContentItem& item( iter->ItemL( aContent ) ); |
|
1174 |
|
1175 const TDesC& nodeId( iNodeIdGenerator->ContentNodeIdL( aPlugin, item ) ); |
|
1176 |
|
1177 CXnNodeAppIf* property( FindNodeByClassL( |
|
1178 nodeId, aIndex, info.Namespace() ) ); |
|
1179 |
|
1180 if( !property ) |
|
1181 { |
|
1182 return KErrNotFound; |
|
1183 } |
|
1184 |
|
1185 TInt priority( ContentPriority( *property ) ); |
|
1186 |
|
1187 // Navigate to parent |
|
1188 CXnNodeAppIf* target( property->ParentL() ); |
|
1189 |
|
1190 if( !target ) |
|
1191 { |
|
1192 return KErrNotSupported; |
|
1193 } |
|
1194 |
|
1195 if ( !AllowPublishByPriority( *target, priority ) ) |
|
1196 { |
|
1197 return KErrAccessDenied; |
|
1198 } |
|
1199 |
|
1200 if( target->Type()->Type() == |
|
1201 XnListQueryDialogInterface::MXnListQueryDialogInterface::Type()) |
|
1202 { |
|
1203 // Get the data interface for dialog and delete data |
|
1204 XnListQueryDialogInterface::MXnListQueryDialogInterface* listQuery( NULL ); |
|
1205 XnComponentInterface::MakeInterfaceL( listQuery, *target ); |
|
1206 LeaveIfNull( listQuery, KErrNotSupported ); |
|
1207 listQuery->DeleteItem( aIndex -1 );// plugins publish ordinals not indexes |
|
1208 return KErrNone; |
|
1209 } |
|
1210 |
|
1211 // Create transaction element for empty content |
|
1212 MTransactionElement* element = |
|
1213 iFactory->CreateEmptyContentTransactionElementL( |
|
1214 *target, aIndex ); |
|
1215 |
|
1216 iPolicyEvaluator->EvaluateEmptyContentPolicyL( |
|
1217 *target, element->PolicyArray() ); |
|
1218 |
|
1219 iPolicyEvaluator->EvaluateVisibilityPolicyL( |
|
1220 *target, element->PolicyArray() ); |
|
1221 |
|
1222 ProcessTransactionElementL( element ); |
|
1223 |
|
1224 if ( priority > KErrNotFound ) // Only for prioritized elements |
|
1225 { |
|
1226 // Add current ui element into content refresh map |
|
1227 HBufC* uiElementId( PropertyValueL( |
|
1228 *target, XnPropertyNames::common::KId ) ); |
|
1229 |
|
1230 return RefreshContentL( uiElementId, priority ); |
|
1231 } |
|
1232 |
|
1233 return KErrNone; |
|
1234 } |
|
1235 |
|
1236 // ---------------------------------------------------------------------------- |
|
1237 // CContentRenderer::SetImmediateMode |
|
1238 // |
|
1239 // ---------------------------------------------------------------------------- |
|
1240 // |
|
1241 void CContentRenderer::SetImmediateMode( TBool aImmediateMode ) |
|
1242 { |
|
1243 iImmediateMode = aImmediateMode; |
|
1244 } |
|
1245 |
|
1246 // ---------------------------------------------------------------------------- |
|
1247 // CContentRenderer::IsImmediateMode |
|
1248 // |
|
1249 // ---------------------------------------------------------------------------- |
|
1250 // |
|
1251 TBool CContentRenderer::IsImmediateMode() const |
|
1252 { |
|
1253 return iImmediateMode; |
|
1254 } |
|
1255 |
|
1256 // ---------------------------------------------------------------------------- |
|
1257 // CContentRenderer::ProcessTransactionElementL |
|
1258 // |
|
1259 // ---------------------------------------------------------------------------- |
|
1260 // |
|
1261 void CContentRenderer::ProcessTransactionElementL( |
|
1262 MTransactionElement* aElement ) |
|
1263 { |
|
1264 LeaveIfNull( aElement, KErrArgument ); |
|
1265 |
|
1266 __PRINTS("*** XML UI: CContentRenderer::ProcessTransactionElementL ***"); |
|
1267 |
|
1268 if ( IsImmediateMode() || iStack->IsEmpty() ) |
|
1269 { |
|
1270 __PRINTS("* Immediate transaction mode, or transaction stack is empty" ); |
|
1271 |
|
1272 // No transaction. Commit element immediately |
|
1273 TBool layoutChanged( EFalse ); |
|
1274 |
|
1275 RPropertyHashMap propertyHashMap; |
|
1276 CleanupClosePushL( propertyHashMap ); |
|
1277 |
|
1278 aElement->CommitL( layoutChanged, propertyHashMap ); |
|
1279 SetPropertyArraysL( propertyHashMap ); |
|
1280 |
|
1281 CleanupStack::PopAndDestroy( &propertyHashMap ); |
|
1282 |
|
1283 iFactory->ReleaseTransactionElement( aElement ); |
|
1284 StartContentRefresh(); |
|
1285 |
|
1286 // Re-layout |
|
1287 iAppUi.UiEngineL()->RenderUIL(); |
|
1288 } |
|
1289 else |
|
1290 { |
|
1291 // Append transaction element to transaction |
|
1292 __PRINTS("* Adding transaction element to stack"); |
|
1293 |
|
1294 MTransaction* tr( iStack->Top() ); |
|
1295 tr->Append( *aElement ); |
|
1296 } |
|
1297 |
|
1298 __PRINTS("*** XML UI: CContentRenderer::ProcessTransactionElementL - done ***"); |
|
1299 } |
|
1300 |
|
1301 // ---------------------------------------------------------------------------- |
|
1302 // CContentRenderer::FindNodeByClassL |
|
1303 // |
|
1304 // ---------------------------------------------------------------------------- |
|
1305 // |
|
1306 CXnNodeAppIf* CContentRenderer::FindNodeByClassL( const TDesC& aCid, |
|
1307 TInt aIndex, const TDesC8& aNs ) |
|
1308 { |
|
1309 // Find node |
|
1310 HBufC8* classId( CnvUtfConverter::ConvertFromUnicodeToUtf8L( aCid ) ); |
|
1311 CleanupStack::PushL( classId ); |
|
1312 |
|
1313 RPointerArray<CXnNodeAppIf> nodes( |
|
1314 iAppUi.UiEngineL()->FindNodeByClassL( *classId, aNs ) ); |
|
1315 |
|
1316 CleanupStack::PopAndDestroy( classId ); |
|
1317 |
|
1318 CleanupClosePushL( nodes ); |
|
1319 |
|
1320 for ( TInt i = 0; i < nodes.Count(); ++i ) |
|
1321 { |
|
1322 CXnNodeAppIf* node = nodes[i]; |
|
1323 |
|
1324 const TDesC8* name( |
|
1325 PropertyValue( *node, AiUiDef::xml::property::KName ) ); |
|
1326 |
|
1327 if ( name && ( *name == AiUiDef::xml::name::KOrdinal ) ) |
|
1328 { |
|
1329 const TDesC8* value( |
|
1330 PropertyValue( *node, AiUiDef::xml::property::KValue ) ); |
|
1331 |
|
1332 if ( value ) |
|
1333 { |
|
1334 // Try to parse index from string either |
|
1335 TInt32 index( 0 ); |
|
1336 |
|
1337 User::LeaveIfError( AiUtility::ParseInt( index, *value ) ); |
|
1338 |
|
1339 if ( index == aIndex ) |
|
1340 { |
|
1341 CleanupStack::PopAndDestroy( &nodes ); |
|
1342 |
|
1343 return node; |
|
1344 } |
|
1345 } |
|
1346 } |
|
1347 else if ( name && ( *name == AiUiDef::xml::name::KTarget ) ) |
|
1348 { |
|
1349 const TDesC8* target( |
|
1350 PropertyValue( *node, AiUiDef::xml::property::KValue ) ); |
|
1351 |
|
1352 CXnNodeAppIf* targetNode( |
|
1353 FindNodeByIdL( *target, node->Namespace() ) ); |
|
1354 |
|
1355 if ( targetNode ) |
|
1356 { |
|
1357 CleanupStack::PopAndDestroy( &nodes ); |
|
1358 |
|
1359 return targetNode; |
|
1360 } |
|
1361 } |
|
1362 else if ( nodes.Count() == 1 ) // Only one node in class |
|
1363 { |
|
1364 node = nodes[ 0 ]; |
|
1365 |
|
1366 // No ordinal specified |
|
1367 CleanupStack::PopAndDestroy( &nodes ); |
|
1368 |
|
1369 return node; |
|
1370 } |
|
1371 } |
|
1372 |
|
1373 CleanupStack::PopAndDestroy( &nodes ); |
|
1374 |
|
1375 return NULL; // Never reached. Needed to omit compiler warning |
|
1376 } |
|
1377 |
|
1378 // ---------------------------------------------------------------------------- |
|
1379 // CContentRenderer::FindNodeByIdL |
|
1380 // |
|
1381 // ---------------------------------------------------------------------------- |
|
1382 // |
|
1383 CXnNodeAppIf* CContentRenderer::FindNodeByIdL( const TDesC& aCid, |
|
1384 const TDesC& aNs ) |
|
1385 { |
|
1386 // Find node |
|
1387 return LeaveIfNull( |
|
1388 iAppUi.UiEngineL()->FindNodeByIdL( aCid, aNs ), KErrNotFound ); |
|
1389 } |
|
1390 |
|
1391 // ---------------------------------------------------------------------------- |
|
1392 // CContentRenderer::FindNodeByIdL |
|
1393 // |
|
1394 // ---------------------------------------------------------------------------- |
|
1395 // |
|
1396 CXnNodeAppIf* CContentRenderer::FindNodeByIdL( const TDesC8& aCid, |
|
1397 const TDesC8& aNs ) |
|
1398 { |
|
1399 // Find node |
|
1400 return LeaveIfNull( |
|
1401 iAppUi.UiEngineL()->FindNodeByIdL( aCid, aNs ), KErrNotFound ); |
|
1402 } |
|
1403 |
|
1404 // ---------------------------------------------------------------------------- |
|
1405 // CContentRenderer::PublishIconL |
|
1406 // |
|
1407 // ---------------------------------------------------------------------------- |
|
1408 // |
|
1409 TInt CContentRenderer::PublishIconL( CHsContentPublisher& aPlugin, |
|
1410 const TDesC& aCid, CGulIcon* aIcon, TInt aIndex, CXnNodeAppIf* aResource ) |
|
1411 { |
|
1412 const THsPublisherInfo& info( aPlugin.PublisherInfo() ); |
|
1413 |
|
1414 // Find proiperty element by class |
|
1415 CXnNodeAppIf* property( |
|
1416 FindNodeByClassL( aCid, aIndex, info.Namespace() ) ); |
|
1417 |
|
1418 if( !property ) |
|
1419 { |
|
1420 return KErrNotFound; |
|
1421 } |
|
1422 |
|
1423 // Get priority information |
|
1424 TInt priority( ContentPriority( *property ) ); |
|
1425 |
|
1426 // Navigate to parent |
|
1427 CXnNodeAppIf* target( property->ParentL() ); |
|
1428 |
|
1429 if( !target ) |
|
1430 { |
|
1431 return KErrNotFound; |
|
1432 } |
|
1433 |
|
1434 // Check priority |
|
1435 if ( !AllowPublishByPriority( *target, priority ) ) |
|
1436 { |
|
1437 return KErrAccessDenied; |
|
1438 } |
|
1439 |
|
1440 MTransactionElement* element = |
|
1441 iFactory->CreateImageTransactionElementL( |
|
1442 *target, aIcon, priority ); |
|
1443 |
|
1444 if ( aResource ) |
|
1445 { |
|
1446 iPolicyEvaluator->EvaluateResourcePolicyL( |
|
1447 *target, *aResource, element->PolicyArray() ); |
|
1448 |
|
1449 iPolicyEvaluator->EvaluateContentPolicyL( |
|
1450 *target, element->PolicyArray() ); |
|
1451 |
|
1452 iPolicyEvaluator->EvaluateVisibilityPolicyL( |
|
1453 *target, element->PolicyArray() ); |
|
1454 } |
|
1455 |
|
1456 else |
|
1457 { |
|
1458 iPolicyEvaluator->EvaluateContentPolicyL( |
|
1459 *target, element->PolicyArray() ); |
|
1460 |
|
1461 iPolicyEvaluator->EvaluateVisibilityPolicyL( |
|
1462 *target, element->PolicyArray() ); |
|
1463 } |
|
1464 |
|
1465 ProcessTransactionElementL( element ); |
|
1466 |
|
1467 return KErrNone; |
|
1468 } |
|
1469 |
|
1470 // ---------------------------------------------------------------------------- |
|
1471 // CContentRenderer::PublishDataL |
|
1472 // |
|
1473 // ---------------------------------------------------------------------------- |
|
1474 // |
|
1475 TInt CContentRenderer::PublishDataL( CHsContentPublisher& aPlugin, |
|
1476 const TDesC& aCid, const TDesC8& aData, const TDesC8& aContentType, |
|
1477 TInt aIndex, CXnNodeAppIf* aResource ) |
|
1478 { |
|
1479 const THsPublisherInfo& info( aPlugin.PublisherInfo() ); |
|
1480 |
|
1481 CXnNodeAppIf* property( |
|
1482 FindNodeByClassL( aCid, aIndex, info.Namespace() ) ); |
|
1483 |
|
1484 if( !property ) |
|
1485 { |
|
1486 return KErrNotFound; |
|
1487 } |
|
1488 |
|
1489 TInt priority( ContentPriority( *property ) ); |
|
1490 |
|
1491 // Navigate to parent |
|
1492 CXnNodeAppIf* target( property->ParentL() ); |
|
1493 |
|
1494 if( !target ) |
|
1495 { |
|
1496 return KErrNotFound; |
|
1497 } |
|
1498 |
|
1499 if ( !AllowPublishByPriority( *target, priority ) ) |
|
1500 { |
|
1501 return KErrAccessDenied; |
|
1502 } |
|
1503 |
|
1504 if ( !CDataBufferTransactionElement::IsSupported( *target, aContentType ) ) |
|
1505 { |
|
1506 return KErrNotSupported; |
|
1507 } |
|
1508 |
|
1509 MTransactionElement* element( NULL ); |
|
1510 |
|
1511 if ( aContentType == KContentTypeData ) |
|
1512 { |
|
1513 element = iFactory->CreateDataBufferTransactionElementL( |
|
1514 *target, aData, priority, aCid, aIndex ); |
|
1515 } |
|
1516 else |
|
1517 { |
|
1518 element = iFactory->CreateDataBufferTransactionElementL( |
|
1519 *target, aData, priority ); |
|
1520 } |
|
1521 |
|
1522 if ( aResource ) |
|
1523 { |
|
1524 iPolicyEvaluator->EvaluateResourcePolicyL( |
|
1525 *target, *aResource, element->PolicyArray() ); |
|
1526 |
|
1527 iPolicyEvaluator->EvaluateContentPolicyL( |
|
1528 *target, element->PolicyArray() ); |
|
1529 |
|
1530 iPolicyEvaluator->EvaluateVisibilityPolicyL( |
|
1531 *target, element->PolicyArray() ); |
|
1532 } |
|
1533 else |
|
1534 { |
|
1535 iPolicyEvaluator->EvaluateContentPolicyL( |
|
1536 *target, element->PolicyArray() ); |
|
1537 |
|
1538 iPolicyEvaluator->EvaluateVisibilityPolicyL( |
|
1539 *target, element->PolicyArray() ); |
|
1540 } |
|
1541 |
|
1542 ProcessTransactionElementL( element ); |
|
1543 |
|
1544 return KErrNone; |
|
1545 } |
|
1546 |
|
1547 // ---------------------------------------------------------------------------- |
|
1548 // CContentRenderer::SetProperty |
|
1549 // |
|
1550 // ---------------------------------------------------------------------------- |
|
1551 // |
|
1552 TInt CContentRenderer::SetProperty( CHsContentPublisher& aPlugin, |
|
1553 const TDesC8& aElementId, const TDesC8& aPropertyName, |
|
1554 const TDesC8& aPropertyValue ) |
|
1555 { |
|
1556 return ( SetProperty( aPlugin, aElementId, |
|
1557 aPropertyName, aPropertyValue, |
|
1558 MAiContentObserver::EValueString ) ); |
|
1559 } |
|
1560 |
|
1561 // ---------------------------------------------------------------------------- |
|
1562 // CContentRenderer::SetProperty |
|
1563 // |
|
1564 // ---------------------------------------------------------------------------- |
|
1565 // |
|
1566 TInt CContentRenderer::SetProperty( CHsContentPublisher& aPlugin, |
|
1567 const TDesC8& aElementId, const TDesC8& aPropertyName, |
|
1568 const TDesC8& aPropertyValue, MAiContentObserver::TValueType aValueType ) |
|
1569 { |
|
1570 TInt error( KErrNone ); |
|
1571 TInt retval( KErrNone ); |
|
1572 |
|
1573 TRAP( error, retval = SetPropertyL( aPlugin, aElementId, aPropertyName, |
|
1574 aPropertyValue, aValueType ) ); |
|
1575 |
|
1576 if( !error && retval ) |
|
1577 { |
|
1578 error = retval; |
|
1579 } |
|
1580 |
|
1581 return error; |
|
1582 } |
|
1583 |
|
1584 // ---------------------------------------------------------------------------- |
|
1585 // CContentRenderer::SetPropertyL |
|
1586 // |
|
1587 // ---------------------------------------------------------------------------- |
|
1588 // |
|
1589 TInt CContentRenderer::SetPropertyL( CHsContentPublisher& aPlugin, |
|
1590 const TDesC8& aElementId, const TDesC8& aPropertyName, |
|
1591 const TDesC8& aPropertyValue, MAiContentObserver::TValueType aValueType ) |
|
1592 { |
|
1593 TInt err( KErrNone ); |
|
1594 // Find node |
|
1595 |
|
1596 CXnNodeAppIf* targetNode( |
|
1597 FindNodeByIdL( aElementId, aPlugin.PublisherInfo().Namespace() ) ); |
|
1598 |
|
1599 if ( targetNode ) |
|
1600 { |
|
1601 CXnDomStringPool& sp( targetNode->UiEngineL()->StringPool() ); |
|
1602 |
|
1603 CXnProperty* prop = CXnProperty::NewL( |
|
1604 aPropertyName, |
|
1605 aPropertyValue, |
|
1606 DomPropertyValueType(aValueType), sp ); |
|
1607 |
|
1608 CleanupStack::PushL( prop ); |
|
1609 |
|
1610 targetNode->SetPropertyL( prop ); |
|
1611 |
|
1612 CleanupStack::Pop( prop ); |
|
1613 } |
|
1614 else |
|
1615 { |
|
1616 err = KErrNotFound; |
|
1617 } |
|
1618 |
|
1619 return err; |
|
1620 } |
|
1621 |
|
1622 // ---------------------------------------------------------------------------- |
|
1623 // CContentRenderer::DomPropertyValueType |
|
1624 // |
|
1625 // ---------------------------------------------------------------------------- |
|
1626 // |
|
1627 CXnDomPropertyValue::TPrimitiveValueType CContentRenderer::DomPropertyValueType( |
|
1628 MAiContentObserver::TValueType aValueType ) |
|
1629 { |
|
1630 CXnDomPropertyValue::TPrimitiveValueType type( |
|
1631 CXnDomPropertyValue::EUnknown ); |
|
1632 |
|
1633 switch ( aValueType ) |
|
1634 { |
|
1635 case MAiContentObserver::EValueNumber : |
|
1636 { |
|
1637 type = CXnDomPropertyValue::ENumber; |
|
1638 } |
|
1639 break; |
|
1640 case MAiContentObserver::EValuePercentage : |
|
1641 { |
|
1642 type = CXnDomPropertyValue::EPercentage; |
|
1643 } |
|
1644 break; |
|
1645 case MAiContentObserver::EValuePx : |
|
1646 { |
|
1647 type = CXnDomPropertyValue::EPx; |
|
1648 } |
|
1649 break; |
|
1650 case MAiContentObserver::EValueString : |
|
1651 { |
|
1652 type = CXnDomPropertyValue::EString; |
|
1653 } |
|
1654 break; |
|
1655 case MAiContentObserver::EValueRgbColor : |
|
1656 { |
|
1657 type = CXnDomPropertyValue::ERgbColor; |
|
1658 } |
|
1659 break; |
|
1660 case MAiContentObserver::EValueUnitValue : |
|
1661 { |
|
1662 type = CXnDomPropertyValue::EUnitValue; |
|
1663 } |
|
1664 break; |
|
1665 default: |
|
1666 { |
|
1667 type = CXnDomPropertyValue::EUnknown; |
|
1668 } |
|
1669 } |
|
1670 |
|
1671 return type; |
|
1672 } |
|
1673 |
|
1674 // ---------------------------------------------------------------------------- |
|
1675 // CContentRenderer::AllowPublishByPriority |
|
1676 // |
|
1677 // ---------------------------------------------------------------------------- |
|
1678 // |
|
1679 TBool CContentRenderer::AllowPublishByPriority( CXnNodeAppIf& aUiElement, |
|
1680 TInt aPriority ) const |
|
1681 { |
|
1682 // Get ui element id |
|
1683 const TDesC8* uiElementId( |
|
1684 PropertyValue( aUiElement, XnPropertyNames::common::KId ) ); |
|
1685 |
|
1686 if ( uiElementId ) |
|
1687 { |
|
1688 // compare given priority with the current value of ui element |
|
1689 return iContentPriorityMap->OverrideContent( *uiElementId, aPriority ); |
|
1690 } |
|
1691 |
|
1692 // priority cannot be used, because ui element does not have id |
|
1693 return EFalse; |
|
1694 } |
|
1695 |
|
1696 // ---------------------------------------------------------------------------- |
|
1697 // CContentRenderer::StartContentRefresh |
|
1698 // |
|
1699 // ---------------------------------------------------------------------------- |
|
1700 // |
|
1701 void CContentRenderer::StartContentRefresh() |
|
1702 { |
|
1703 // Cancel ongoing refresh |
|
1704 iTimer->Cancel(); |
|
1705 |
|
1706 if ( iRefreshableUiElements.Count() > 0 ) |
|
1707 { |
|
1708 // Refreshable elements exist. Start timer to make refresh asynchronous |
|
1709 iTimer->Start( TTimeIntervalMicroSeconds32( 0 ), |
|
1710 TTimeIntervalMicroSeconds32( 0 ), |
|
1711 TCallBack( RefreshContentCallback, this ) ); |
|
1712 } |
|
1713 } |
|
1714 |
|
1715 // ---------------------------------------------------------------------------- |
|
1716 // CContentRenderer::RefreshContentL |
|
1717 // |
|
1718 // ---------------------------------------------------------------------------- |
|
1719 // |
|
1720 TInt CContentRenderer::RefreshContentL( HBufC* aUiElementId, |
|
1721 TInt aOldPriority ) |
|
1722 { |
|
1723 if( !aUiElementId ) |
|
1724 { |
|
1725 return KErrArgument; |
|
1726 } |
|
1727 |
|
1728 // Take ownership of aUiElementId |
|
1729 CleanupStack::PushL( aUiElementId ); |
|
1730 |
|
1731 if ( !iFwEventHandler ) |
|
1732 { |
|
1733 // Content refresh event cannot be sent |
|
1734 CleanupStack::PopAndDestroy( aUiElementId ); |
|
1735 |
|
1736 return KErrNotReady; |
|
1737 } |
|
1738 |
|
1739 // Find current mapping |
|
1740 TInt* oldPriority( iRefreshableUiElements.Find( *aUiElementId ) ); |
|
1741 |
|
1742 if ( oldPriority ) |
|
1743 { |
|
1744 // Update mapping |
|
1745 *oldPriority = aOldPriority; |
|
1746 CleanupStack::PopAndDestroy( aUiElementId ); |
|
1747 } |
|
1748 else |
|
1749 { |
|
1750 // Create new mapping |
|
1751 oldPriority = new( ELeave ) TInt( aOldPriority ); |
|
1752 CleanupStack::PushL( oldPriority ); |
|
1753 |
|
1754 User::LeaveIfError( iRefreshableUiElements.Insert( aUiElementId, |
|
1755 oldPriority ) ); |
|
1756 |
|
1757 CleanupStack::Pop( 2, aUiElementId ); |
|
1758 } |
|
1759 |
|
1760 return KErrNone; |
|
1761 } |
|
1762 |
|
1763 // ---------------------------------------------------------------------------- |
|
1764 // CContentRenderer::RefreshContentCallback |
|
1765 // |
|
1766 // ---------------------------------------------------------------------------- |
|
1767 // |
|
1768 TInt CContentRenderer::RefreshContentCallback( TAny* aContentRenderer ) |
|
1769 { |
|
1770 if ( !aContentRenderer ) |
|
1771 { |
|
1772 return KErrArgument; |
|
1773 } |
|
1774 |
|
1775 CContentRenderer* self = |
|
1776 static_cast< CContentRenderer* >( aContentRenderer ); |
|
1777 |
|
1778 TRAP_IGNORE( self->SendRefreshContentEventL() ); |
|
1779 |
|
1780 return KErrNone; |
|
1781 } |
|
1782 |
|
1783 // ---------------------------------------------------------------------------- |
|
1784 // CContentRenderer::SendRefreshContentEventL |
|
1785 // |
|
1786 // ---------------------------------------------------------------------------- |
|
1787 // |
|
1788 void CContentRenderer::SendRefreshContentEventL() |
|
1789 { |
|
1790 /** |
|
1791 * Sends Refresh content event to framework. |
|
1792 * Event is sent for content selectors with lower priority than the |
|
1793 * last content which has been cleaned from ui element. |
|
1794 */ |
|
1795 |
|
1796 // Cancel periodic timer. |
|
1797 iTimer->Cancel(); |
|
1798 |
|
1799 // Get ui element id and old content priority |
|
1800 TPtrHashMapIter< TDesC, TInt> iter( iRefreshableUiElements ); |
|
1801 iter.Reset(); |
|
1802 |
|
1803 const TDesC* uiElementId( iter.NextKey() ); // Never NULL |
|
1804 TInt priority( *( iter.CurrentValue() ) ); |
|
1805 |
|
1806 // Cleanup item for iterator |
|
1807 TMapCleanupItem cleanup( iter ); |
|
1808 CleanupReleasePushL( cleanup ); |
|
1809 |
|
1810 // Lookup ui element |
|
1811 CXnNodeAppIf* uiElement( FindNodeByIdL( *uiElementId ) ); |
|
1812 |
|
1813 // Remove current ui element from the map |
|
1814 CleanupStack::PopAndDestroy( &cleanup ); |
|
1815 |
|
1816 // Find lower priority content elements associated to this ui element |
|
1817 RPointerArray< CXnNodeAppIf > children( uiElement->ChildrenL() ); |
|
1818 |
|
1819 // Remove higher priority content elements |
|
1820 RemoveNonPriorityElements( children, priority ); |
|
1821 |
|
1822 // Sort array to descending order |
|
1823 children.Sort( TLinearOrder< CXnNodeAppIf >( DescendingPriorityOrder ) ); |
|
1824 |
|
1825 // Send event for content selectors in descending priority order. |
|
1826 // Continue until first content gets published or array exhausts. |
|
1827 for ( TInt i = 0; i < children.Count(); ++i ) |
|
1828 { |
|
1829 CXnNodeAppIf* current( children[ i ] ); |
|
1830 |
|
1831 // Get content selector |
|
1832 const HBufC* contentSelector( |
|
1833 PropertyValueL( *current, XnPropertyNames::common::KClass ) ); |
|
1834 |
|
1835 if ( contentSelector && |
|
1836 iFwEventHandler->RefreshContent( *contentSelector ) ) |
|
1837 { |
|
1838 break; |
|
1839 } |
|
1840 } |
|
1841 |
|
1842 // Free content selector array |
|
1843 children.Reset(); |
|
1844 |
|
1845 // Continue content refresh for next ui element. |
|
1846 StartContentRefresh(); |
|
1847 } |
|
1848 |
|
1849 // ---------------------------------------------------------------------------- |
|
1850 // CContentRenderer::IsParentNewsticker |
|
1851 // |
|
1852 // ---------------------------------------------------------------------------- |
|
1853 // |
|
1854 TBool CContentRenderer::IsParentNewsticker( CXnNodeAppIf& aTarget ) |
|
1855 { |
|
1856 CXnNodeAppIf* parent( NULL ); |
|
1857 |
|
1858 TRAP_IGNORE( parent = aTarget.ParentL() ); |
|
1859 |
|
1860 if ( !parent ) |
|
1861 { |
|
1862 return EFalse; |
|
1863 } |
|
1864 |
|
1865 const TDesC8& type( parent->Type()->Type() ) ; |
|
1866 |
|
1867 return ( type == XnNewstickerInterface::MXnNewstickerInterface::Type() ); |
|
1868 } |
|
1869 |
|
1870 |
|
1871 // End of File |