60 TDefId aNamespaceDefId, TUint32 aType, |
60 TDefId aNamespaceDefId, TUint32 aType, |
61 CMdCSerializationBuffer& aSerializedCondition, |
61 CMdCSerializationBuffer& aSerializedCondition, |
62 CMdCSerializationBuffer& aSerializedItems, |
62 CMdCSerializationBuffer& aSerializedItems, |
63 CMdCSerializationBuffer& aSerializedItemIds, |
63 CMdCSerializationBuffer& aSerializedItemIds, |
64 RArray<TItemId>& aMatchingItemIdArray, |
64 RArray<TItemId>& aMatchingItemIdArray, |
65 TBool aAllowConfidential) |
65 RArray<TItemId>& aAllItemsIdArray, |
|
66 RPointerArray<HBufC>& aMatchingItemUriArray, |
|
67 RPointerArray<HBufC>& aAllItemsUriArray, |
|
68 TBool aAllowConfidential, |
|
69 TBool uriNotify, |
|
70 TBool& aAllMatched, |
|
71 TBool& aAllItemsFetched ) |
66 { |
72 { |
67 const TMdCItems& items = TMdCItems::GetFromBufferL( aSerializedItems ); |
73 const TMdCItems& items = TMdCItems::GetFromBufferL( aSerializedItems ); |
68 |
74 |
69 const TMdCItemIds& itemIds = TMdCItemIds::GetFromBufferL( aSerializedItemIds ); |
75 const TMdCItemIds& itemIds = TMdCItemIds::GetFromBufferL( aSerializedItemIds ); |
70 |
76 |
72 if( itemIds.iNamespaceDefId != aNamespaceDefId ) |
78 if( itemIds.iNamespaceDefId != aNamespaceDefId ) |
73 { |
79 { |
74 return EFalse; |
80 return EFalse; |
75 } |
81 } |
76 |
82 |
|
83 aAllMatched = EFalse; |
|
84 |
77 if( ( items.iObjects.iPtr.iCount > 0 ) && |
85 if( ( items.iObjects.iPtr.iCount > 0 ) && |
78 ( itemIds.iObjectIds.iPtr.iCount > 0 ) && |
86 ( itemIds.iObjectIds.iPtr.iCount > 0 ) && |
79 ( aType & ( EObjectNotifyAdd | EObjectNotifyModify ) ) ) |
87 ( aType & ( EObjectNotifyAdd | EObjectNotifyModify | EObjectNotifyAddWithUri | EObjectNotifyModifyWithUri ) ) ) |
80 { |
88 { |
81 // object ID count and object item count should match |
89 // object ID count and object item count should match |
82 __ASSERT_DEBUG( items.iObjects.iPtr.iCount == itemIds.iObjectIds.iPtr.iCount, MMdCCommon::Panic( KErrCorrupt ) ); |
90 __ASSERT_DEBUG( items.iObjects.iPtr.iCount == itemIds.iObjectIds.iPtr.iCount, MMdCCommon::Panic( KErrCorrupt ) ); |
83 |
91 |
84 aSerializedItemIds.PositionL( itemIds.iObjectIds.iPtr.iOffset ); |
92 aSerializedItemIds.PositionL( itemIds.iObjectIds.iPtr.iOffset ); |
|
93 TBool allItemsFetched( aAllItemsFetched ); |
85 for( TUint32 i = 0; i < itemIds.iObjectIds.iPtr.iCount; i++ ) |
94 for( TUint32 i = 0; i < itemIds.iObjectIds.iPtr.iCount; i++ ) |
86 { |
95 { |
87 TItemId objectId; |
96 TItemId objectId; |
88 aSerializedItemIds.ReceiveL( objectId ); |
97 aSerializedItemIds.ReceiveL( objectId ); |
89 |
98 |
138 succeed = !( succeed ); |
147 succeed = !( succeed ); |
139 } |
148 } |
140 |
149 |
141 if ( succeed ) |
150 if ( succeed ) |
142 { |
151 { |
|
152 if( uriNotify ) |
|
153 { |
|
154 // set correct position to item buffer |
|
155 aSerializedItems.PositionL( items.iObjects.iPtr.iOffset + |
|
156 i * sizeof(TMdCObject) ); |
|
157 |
|
158 const TMdCObject& object = TMdCObject::GetFromBufferL( aSerializedItems ); |
|
159 |
|
160 aSerializedItems.PositionL( object.iUri.iPtr.iOffset ); |
|
161 HBufC* uriBuf = aSerializedItems.ReceiveDes16L(); |
|
162 aMatchingItemUriArray.AppendL( uriBuf ); |
|
163 } |
143 aMatchingItemIdArray.AppendL( objectId ); |
164 aMatchingItemIdArray.AppendL( objectId ); |
144 } |
165 } |
145 } |
166 } |
146 else |
167 else |
147 { |
168 { |
148 aMatchingItemIdArray.AppendL( objectId ); |
169 aAllMatched = ETrue; |
149 } |
170 if( uriNotify && (!aAllItemsFetched || !allItemsFetched) ) |
|
171 { |
|
172 // set correct position to item buffer |
|
173 aSerializedItems.PositionL( items.iObjects.iPtr.iOffset + |
|
174 i * sizeof(TMdCObject) ); |
|
175 |
|
176 const TMdCObject& object = TMdCObject::GetFromBufferL( aSerializedItems ); |
|
177 |
|
178 aSerializedItems.PositionL( object.iUri.iPtr.iOffset ); |
|
179 HBufC* uriBuf = aSerializedItems.ReceiveDes16L(); |
|
180 aAllItemsUriArray.AppendL( uriBuf ); |
|
181 aAllItemsIdArray.AppendL( objectId ); |
|
182 allItemsFetched = ETrue; |
|
183 } |
|
184 else if( !aAllItemsFetched || !allItemsFetched ) |
|
185 { |
|
186 aAllItemsIdArray.AppendL( objectId ); |
|
187 allItemsFetched = ETrue; |
|
188 } |
|
189 } |
|
190 } |
|
191 if( allItemsFetched ) |
|
192 { |
|
193 aAllItemsFetched = ETrue; |
150 } |
194 } |
151 } |
195 } |
152 else if( ( items.iEvents.iPtr.iCount > 0 ) && |
196 else if( ( items.iEvents.iPtr.iCount > 0 ) && |
153 ( itemIds.iEventIds.iPtr.iCount > 0 ) && |
197 ( itemIds.iEventIds.iPtr.iCount > 0 ) && |
154 ( aType & ( EEventNotifyAdd ) ) ) |
198 ( aType & ( EEventNotifyAdd ) ) ) |