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