idlehomescreen/xmluicontroller/src/transactionelement.cpp
branchRCL_3
changeset 35 3321d3e205b6
parent 0 f72a12da539e
equal deleted inserted replaced
34:5456b4e8b3a8 35:3321d3e205b6
    22 
    22 
    23 #include    "transactionelement.h"
    23 #include    "transactionelement.h"
    24 #include    "xmluicontrollerpanic.h"
    24 #include    "xmluicontrollerpanic.h"
    25 #include    "aixmluiutils.h"
    25 #include    "aixmluiutils.h"
    26 #include    "aixmluiconstants.h"
    26 #include    "aixmluiconstants.h"
       
    27 #include    "aipolicyelement.h"
    27 
    28 
    28 #include    "contentprioritymap.h"
    29 #include    "contentprioritymap.h"
    29 
    30 
    30 // ============================ MEMBER FUNCTIONS ===============================
    31 // ============================ MEMBER FUNCTIONS ===============================
    31 
    32 
    33 using namespace AiUiDef::xml;
    34 using namespace AiUiDef::xml;
    34 
    35 
    35 /**
    36 /**
    36  * Template method implementation
    37  * Template method implementation
    37  */
    38  */
    38 void MTransactionElement::CommitL( TBool& aLayoutChanged, RPropertyHashMap& aPropertyHashMap )
    39 void MTransactionElement::CommitL( RAiPolicyElementArray& aPolicyArray, 
       
    40                                    RPropertyHashMap& aPropertyHashMap )
    39     {
    41     {
    40     // Update UI element data
    42     // Update UI element data
    41     UpdateDataL();
    43     UpdateDataL();
    42     
    44     
    43     // Update CSS properties
    45     // Update CSS properties
    44     ApplyPublishingPolicy( aLayoutChanged, aPropertyHashMap );
    46     ApplyPublishingPolicy( aPolicyArray, aPropertyHashMap );
    45     }
    47     }
    46 
    48 
    47 CTransactionElement::CTransactionElement( AiUtility::CContentPriorityMap& aContentPriorityMap )
    49 CTransactionElement::CTransactionElement( AiUtility::CContentPriorityMap& aContentPriorityMap )
    48     : iContentPriorityMap( aContentPriorityMap ),
    50     : iContentPriorityMap( aContentPriorityMap ),
    49       iContentPriority( KErrNotFound )
    51       iContentPriority( KErrNotFound )
    59     iTarget = NULL;
    61     iTarget = NULL;
    60     
    62     
    61     iContentPriority = KErrNotFound;
    63     iContentPriority = KErrNotFound;
    62     
    64     
    63     iElementLink.Deque();
    65     iElementLink.Deque();
    64     
       
    65     iPolicyArray.Reset();
       
    66     }
       
    67     
       
    68 RAiPolicyElementArray& CTransactionElement::PolicyArray()
       
    69     {
       
    70     return iPolicyArray;
       
    71     }
    66     }
    72 
    67 
    73 void CTransactionElement::SetContentPriority( TInt aPriority )
    68 void CTransactionElement::SetContentPriority( TInt aPriority )
    74     {
    69     {
    75     iContentPriority = aPriority;
    70     iContentPriority = aPriority;
    84     {
    79     {
    85     __ASSERT_DEBUG( !iTarget, Panic( ETargetNodeNotNull ) );
    80     __ASSERT_DEBUG( !iTarget, Panic( ETargetNodeNotNull ) );
    86     iTarget = &aTarget;
    81     iTarget = &aTarget;
    87     }
    82     }
    88 
    83 
    89 void CTransactionElement::ApplyPublishingPolicy( TBool& aLayoutChanged, RPropertyHashMap& aPropertyHashMap )
    84 void CTransactionElement::ApplyPublishingPolicy( RAiPolicyElementArray& aPolicyArray, 
       
    85                                                  RPropertyHashMap& aPropertyHashMap )
    90     {
    86     {
    91     // Ignore errors if CSS property could not be modified
    87     // Ignore errors if CSS property could not be modified
    92     TRAP_IGNORE( DoApplyPublishingPolicyL( aLayoutChanged, aPropertyHashMap ) );
    88     TRAP_IGNORE( DoApplyPublishingPolicyL( aPolicyArray, aPropertyHashMap ) );
    93     }
    89     }
    94             
    90             
    95 void CTransactionElement::DoApplyPublishingPolicyL( TBool& aLayoutChanged, RPropertyHashMap& aPropertyHashMap )
    91 void CTransactionElement::DoApplyPublishingPolicyL( RAiPolicyElementArray& aPolicyArray, 
       
    92                                                     RPropertyHashMap& aPropertyHashMap )
    96     {
    93     {
    97     RArray<CXnNodeAppIf*> targetArray;
    94     RArray<CXnNodeAppIf*> targetArray;
    98     CleanupClosePushL( targetArray );
    95     CleanupClosePushL( targetArray );
    99     
    96     
   100     for ( TInt i = 0; i < iPolicyArray.Count() && iPropertyMap; ++i )
    97     for ( TInt i = 0; i < aPolicyArray.Count() && iPropertyMap; ++i )
   101         {
    98         {
   102         TAiPolicyElement& element = iPolicyArray[ i ];
    99         TAiPolicyElement& element = aPolicyArray[ i ];
   103         
   100         
   104         RArray<TAiPolicyElement> elementArray;
   101         RArray<TAiPolicyElement> elementArray;
   105         CleanupClosePushL( elementArray );
   102         CleanupClosePushL( elementArray );
   106         
   103         
   107         TBool found = EFalse;
   104         TBool found = EFalse;
   116             }
   113             }
   117             
   114             
   118         if( !found )
   115         if( !found )
   119             {
   116             {
   120             // Mark this target to be processed
   117             // Mark this target to be processed
   121             targetArray.Append( &(element.Target()) );
   118             targetArray.AppendL( &(element.Target()) );
   122             
   119             
   123             for( TInt i3 = 0; i3 < iPolicyArray.Count(); ++i3 )
   120             for( TInt i3 = 0; i3 < aPolicyArray.Count(); ++i3 )
   124                 {
   121                 {
   125                 TAiPolicyElement& element2 = iPolicyArray[ i3 ];
   122                 TAiPolicyElement& element2 = aPolicyArray[ i3 ];
   126                 // find form target array
   123                 // find form target array
   127                 if( &(element.Target()) == &(element2.Target()) )
   124                 if( &(element.Target()) == &(element2.Target()) )
   128                     {
   125                     {
   129                     elementArray.Append( element2 );
   126                     elementArray.AppendL( element2 );
   130                     }
   127                     }
   131                 }
   128                 }
   132                 
   129                 
   133             SetPropertiesToHashMapL( elementArray, *iPropertyMap, aPropertyHashMap );
   130             SetPropertiesToHashMapL( elementArray, *iPropertyMap, aPropertyHashMap );
   134             
   131             
   142                       *iPropertyMap );*/
   139                       *iPropertyMap );*/
   143         }
   140         }
   144     
   141     
   145     CleanupStack::PopAndDestroy(); // targetArray
   142     CleanupStack::PopAndDestroy(); // targetArray
   146     
   143     
   147     if ( iPolicyArray.Count() > 0 )
       
   148         {
       
   149         aLayoutChanged |= ETrue;
       
   150         }
       
   151     }
   144     }
   152     
   145     
   153 CXnNodeAppIf& CTransactionElement::Target() const
   146 CXnNodeAppIf& CTransactionElement::Target() const
   154     {
   147     {
   155     __ASSERT_DEBUG( iTarget, Panic( ETargetNodeNull ) );
   148     __ASSERT_DEBUG( iTarget, Panic( ETargetNodeNull ) );