88 |
88 |
89 // ---------------------------------------------------------------------------- |
89 // ---------------------------------------------------------------------------- |
90 // Add Additional attributes |
90 // Add Additional attributes |
91 // ---------------------------------------------------------------------------- |
91 // ---------------------------------------------------------------------------- |
92 |
92 |
93 void CGlxCollectionPluginTags::CpiAttributeAdditionalAttributes( |
93 void CGlxCollectionPluginTags::CpiAttributeAdditionalAttributesL( |
94 const TMPXAttribute& aCpiAttribute, RArray<TMPXAttribute>& aAttributeArray) |
94 const TMPXAttribute& aCpiAttribute, RArray<TMPXAttribute>& aAttributeArray) |
95 { |
95 { |
96 TRACER("CGlxCollectionPluginTags::CpiAttributeAdditionalAttributes"); |
96 TRACER("CGlxCollectionPluginTags::CpiAttributeAdditionalAttributesL"); |
97 // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all |
97 // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all |
98 // the others are reading straight from resource files |
98 // the others are reading straight from resource files |
99 // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count |
99 // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count |
100 if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) |
100 if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) |
101 { |
101 { |
114 } |
114 } |
115 } |
115 } |
116 |
116 |
117 if (!found) |
117 if (!found) |
118 { |
118 { |
119 aAttributeArray.Append(KMPXMediaGeneralCount); |
119 aAttributeArray.AppendL(KMPXMediaGeneralCount); |
120 } |
120 } |
121 } |
121 } |
122 } |
122 } |
123 |
123 |
124 |
124 |
125 // ---------------------------------------------------------------------------- |
125 // ---------------------------------------------------------------------------- |
126 // Modify the response |
126 // Modify the response |
127 // ---------------------------------------------------------------------------- |
127 // ---------------------------------------------------------------------------- |
128 |
128 |
129 void CGlxCollectionPluginTags::HandleCpiAttributeResponseL(CMPXMedia* aResponse, |
129 void CGlxCollectionPluginTags::HandleCpiAttributeResponseL( |
130 TArray<TMPXAttribute> aCpiAttributes, TArray<TGlxMediaId> aMediaIds) |
130 CMPXMedia* aResponse, TArray<TMPXAttribute> aCpiAttributes, TArray< |
131 { |
131 TGlxMediaId> aMediaIds) |
132 TRACER("CGlxCollectionPluginTags::HandleCpiAttributeResponseL"); |
132 { |
|
133 TRACER("CGlxCollectionPluginTags::HandleCpiAttributeResponseL"); |
133 const TInt mediaIdCount = aMediaIds.Count(); |
134 const TInt mediaIdCount = aMediaIds.Count(); |
134 |
135 |
135 switch (mediaIdCount) |
136 switch (mediaIdCount) |
136 { |
137 { |
137 case 0: |
138 case 0: |
138 User::Leave(KErrNotSupported); |
139 User::Leave(KErrNotSupported); |
139 break; |
140 break; |
140 |
141 |
141 case 1: |
142 case 1: |
142 GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-MediaID"); |
143 GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-MediaID"); |
143 |
144 |
144 HandleCpiAttributeResponseL(aResponse, aCpiAttributes, aMediaIds[0]); |
145 HandleCpiAttributeResponseL(aResponse, aCpiAttributes, |
145 break; |
146 aMediaIds[0]); |
146 |
147 break; |
147 |
148 |
148 default: |
149 default: |
149 { |
150 { |
150 // We have an array of CMPXMedia items |
151 // We have an array of CMPXMedia items |
151 |
152 |
152 if (TGlxMediaId(KGlxCollectionRootId) == aMediaIds[0]) |
153 if (TGlxMediaId(KGlxCollectionRootId) == aMediaIds[0]) |
153 { |
154 { |
154 User::Leave(KErrNotSupported); |
155 User::Leave(KErrNotSupported); |
155 } |
156 } |
156 |
157 |
157 CMPXMediaArray* mediaArray = aResponse->ValueCObjectL<CMPXMediaArray>(KMPXMediaArrayContents); |
158 CMPXMediaArray* mediaArray = aResponse->ValueCObjectL< |
|
159 CMPXMediaArray> (KMPXMediaArrayContents); |
158 CleanupStack::PushL(mediaArray); |
160 CleanupStack::PushL(mediaArray); |
159 |
161 |
160 const TInt arrayCount = mediaArray->Count(); |
162 const TInt arrayCount = mediaArray->Count(); |
161 |
163 |
162 // Sanity check |
164 // Sanity check |
163 if (arrayCount != mediaIdCount) |
165 if (arrayCount != mediaIdCount) |
164 { |
166 { |
165 User::Leave(KErrArgument); |
167 User::Leave(KErrArgument); |
166 } |
168 } |
167 |
169 |
168 for (TInt index = 0; index < arrayCount; index++) |
170 for (TInt index = 0; index < arrayCount; index++) |
169 { |
171 { |
170 HandleCpiAttributeResponseL((*mediaArray)[index], aCpiAttributes, |
172 HandleCpiAttributeResponseL((*mediaArray)[index], |
171 aMediaIds[index]); |
173 aCpiAttributes, aMediaIds[index]); |
172 } |
174 } |
173 aResponse->SetCObjectValueL(KMPXMediaArrayContents, mediaArray); |
175 aResponse->SetCObjectValueL(KMPXMediaArrayContents, mediaArray); |
174 CleanupStack::PopAndDestroy(mediaArray); |
176 CleanupStack::PopAndDestroy(mediaArray); |
175 } |
177 } |
176 break; |
178 break; |
177 } |
179 } |
178 } |
180 } |
179 |
181 |
180 |
182 |
181 // ---------------------------------------------------------------------------- |
183 // ---------------------------------------------------------------------------- |
182 // Modify the response |
184 // Modify the response |
183 // ---------------------------------------------------------------------------- |
185 // ---------------------------------------------------------------------------- |
184 |
186 |
185 void CGlxCollectionPluginTags::HandleCpiAttributeResponseL(CMPXMedia* aResponse, |
187 void CGlxCollectionPluginTags::HandleCpiAttributeResponseL(CMPXMedia* aResponse, |
186 TArray<TMPXAttribute> aCpiAttributes, TGlxMediaId aMediaId) |
188 TArray<TMPXAttribute> aCpiAttributes, TGlxMediaId aMediaId) |
187 { |
189 { |
188 |
190 |
189 TRACER("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Enter"); |
191 TRACER("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Enter"); |
|
192 const TInt KDateBufferPadding = 10; |
190 |
193 |
191 const TInt attribCount = aCpiAttributes.Count(); |
194 const TInt attribCount = aCpiAttributes.Count(); |
192 |
195 |
193 GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Attributes created"); |
196 GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Attributes created"); |
194 |
197 |
259 R_TAG_ITEM_SUB_TITLE_MULTI); |
262 R_TAG_ITEM_SUB_TITLE_MULTI); |
260 } |
263 } |
261 } |
264 } |
262 TPtr formatString = tempTitle->Des(); |
265 TPtr formatString = tempTitle->Des(); |
263 |
266 |
264 // Now create a buffer that will contain the result. needs to be length |
267 // Now create a buffer that will contain the result. |
265 //of format string plus a few extra for the number |
268 // needs to be length of format string plus a few |
266 HBufC* title = HBufC::NewLC(formatString.Length() + 10); |
269 // extra for the number |
|
270 HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPadding); |
267 TPtr ptr = title->Des(); |
271 TPtr ptr = title->Des(); |
268 StringLoader::Format(ptr, formatString, -1, usageCount); |
272 StringLoader::Format(ptr, formatString, -1, usageCount); |
269 |
273 |
270 // Set the title in the response. |
274 // Set the title in the response. |
271 aResponse->SetTextValueL(attr, *title); |
275 aResponse->SetTextValueL(attr, *title); |
327 // Set the filter Properties |
331 // Set the filter Properties |
328 // ---------------------------------------------------------------------------- |
332 // ---------------------------------------------------------------------------- |
329 |
333 |
330 TGlxFilterProperties CGlxCollectionPluginTags::DefaultFilter(TInt aLevel) |
334 TGlxFilterProperties CGlxCollectionPluginTags::DefaultFilter(TInt aLevel) |
331 { |
335 { |
332 TRACER("CGlxCollectionPluginTags::DefaultFilter"); |
336 TRACER("CGlxCollectionPluginTags::DefaultFilter"); |
333 __ASSERT_DEBUG(( (aLevel == KGlxCollectionRootLevel) || (aLevel == KGlxCollectionTagLevel) |
337 __ASSERT_DEBUG(( (aLevel == KGlxCollectionRootLevel) |
334 || (aLevel == KGlxCollectionTagContentsLevel) || (aLevel == KGlxCollectionTagFSContentsLevel)), |
338 || (aLevel == KGlxCollectionTagLevel) |
335 Panic(EGlxPanicInvalidPathLevel)); |
339 || (aLevel == KGlxCollectionTagContentsLevel) |
|
340 || (aLevel == KGlxCollectionTagFSContentsLevel)), |
|
341 Panic(EGlxPanicInvalidPathLevel)); |
336 TGlxFilterProperties filterProperties; |
342 TGlxFilterProperties filterProperties; |
337 filterProperties.iSortDirection = EGlxFilterSortDirectionAscending; |
343 filterProperties.iSortDirection = EGlxFilterSortDirectionAscending; |
338 switch(aLevel) |
344 switch(aLevel) |
339 { |
345 { |
340 case KGlxCollectionRootLevel: |
346 case KGlxCollectionRootLevel: |