95 } |
101 } |
96 // ---------------------------------------------------------------------------- |
102 // ---------------------------------------------------------------------------- |
97 // CpiAttributeAdditionalAttributes |
103 // CpiAttributeAdditionalAttributes |
98 // ---------------------------------------------------------------------------- |
104 // ---------------------------------------------------------------------------- |
99 // |
105 // |
100 void CGlxCollectionPluginDownloads::CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray<TMPXAttribute>& aAttributeArray) |
106 void CGlxCollectionPluginDownloads::CpiAttributeAdditionalAttributesL( |
101 { |
107 const TMPXAttribute& aCpiAttribute, |
102 TRACER("CGlxCollectionPluginDownloads::CpiAttributeAdditionalAttributes"); |
108 RArray<TMPXAttribute>& aAttributeArray) |
103 // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all the others are reading straight from resource files |
109 { |
|
110 TRACER("CGlxCollectionPluginDownloads::CpiAttributeAdditionalAttributesL"); |
|
111 // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all |
|
112 // the others are reading straight from resource files |
104 // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count |
113 // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count |
105 if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) |
114 if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) |
106 { |
115 { |
107 // need to add the usage count. but check first if it is already present |
116 // need to add the usage count. but check first if it is already present |
108 TInt attrCount = aAttributeArray.Count(); |
117 TInt attrCount = aAttributeArray.Count(); |
117 } |
126 } |
118 } |
127 } |
119 |
128 |
120 if (!found) |
129 if (!found) |
121 { |
130 { |
122 aAttributeArray.Append(KMPXMediaGeneralCount); |
131 aAttributeArray.AppendL(KMPXMediaGeneralCount); |
123 } |
132 } |
124 } |
133 } |
125 } |
134 } |
126 |
135 |
127 // ---------------------------------------------------------------------------- |
136 // ---------------------------------------------------------------------------- |
128 // HandleCpiAttributeResponseL |
137 // HandleCpiAttributeResponseL |
129 // ---------------------------------------------------------------------------- |
138 // ---------------------------------------------------------------------------- |
130 // |
139 // |
131 void CGlxCollectionPluginDownloads::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray<TMPXAttribute> aCpiAttributes, TArray<TGlxMediaId> /* aMediaIds */) |
140 void CGlxCollectionPluginDownloads::HandleCpiAttributeResponseL( |
132 { |
141 CMPXMedia* aResponse, TArray<TMPXAttribute> aCpiAttributes, TArray< |
|
142 TGlxMediaId> /* aMediaIds */) |
|
143 { |
133 TRACER("CGlxCollectionPluginDownloads::HandleCpiAttributeResponseL"); |
144 TRACER("CGlxCollectionPluginDownloads::HandleCpiAttributeResponseL"); |
134 |
145 |
135 _LIT(KResourceFile, "z:glxplugindownloads.rsc"); |
146 _LIT(KResourceFile, "z:glxplugindownloads.rsc"); |
136 |
147 |
137 TInt count = aCpiAttributes.Count(); |
148 TInt count = aCpiAttributes.Count(); |
159 |
170 |
160 if(0 == usageCount) |
171 if(0 == usageCount) |
161 { |
172 { |
162 GLX_LOG_INFO("Count is 0 items"); |
173 GLX_LOG_INFO("Count is 0 items"); |
163 |
174 |
164 tempTitle = LoadLocalizedStringLC(KResourceFile,R_DOWNLOADS_SUB_TITLE_NO_IMG_NO_VID); |
175 tempTitle = LoadLocalizedStringLC(KResourceFile, |
|
176 R_DOWNLOADS_SUB_TITLE_NO_IMG_NO_VID); |
165 aResponse->SetTextValueL(attr, *tempTitle); |
177 aResponse->SetTextValueL(attr, *tempTitle); |
166 } |
178 } |
167 |
179 |
168 else if (1 == usageCount) |
180 else if (1 == usageCount) |
169 { |
181 { |
170 GLX_LOG_INFO("Count is 1 item"); |
182 GLX_LOG_INFO("Count is 1 item"); |
171 |
183 |
172 tempTitle = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_SUB_TITLE_SINGLE); |
184 tempTitle = LoadLocalizedStringLC(KResourceFile, |
|
185 R_DOWNLOADS_SUB_TITLE_SINGLE); |
173 aResponse->SetTextValueL(attr, *tempTitle); |
186 aResponse->SetTextValueL(attr, *tempTitle); |
174 } |
187 } |
175 else |
188 else |
176 { |
189 { |
177 GLX_LOG_INFO1("Count is %d items",usageCount); |
190 GLX_LOG_INFO1("Count is %d items",usageCount); |
178 |
191 |
179 tempTitle = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_SUB_TITLE_MULTI); |
192 tempTitle = LoadLocalizedStringLC(KResourceFile, |
|
193 R_DOWNLOADS_SUB_TITLE_MULTI); |
180 //Format the string |
194 //Format the string |
181 TPtr formatString = tempTitle->Des(); |
195 TPtr formatString = tempTitle->Des(); |
182 |
196 |
183 // Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number |
197 // Now create a buffer that will contain the result. |
184 HBufC* title = HBufC::NewLC(formatString.Length() + 10); |
198 // needs to be length of format string plus a few |
|
199 // extra for the number |
|
200 HBufC* title = HBufC::NewLC(formatString.Length() + |
|
201 KDateBufferPadding); |
185 TPtr ptr = title->Des(); |
202 TPtr ptr = title->Des(); |
186 StringLoader::Format(ptr, formatString, -1, usageCount); |
203 StringLoader::Format(ptr, formatString, -1, usageCount); |
187 |
204 |
188 // Set the title in the response. |
205 // Set the title in the response. |
189 aResponse->SetTextValueL(attr, *title); |
206 aResponse->SetTextValueL(attr, *title); |
191 } |
208 } |
192 CleanupStack::PopAndDestroy(tempTitle); |
209 CleanupStack::PopAndDestroy(tempTitle); |
193 #else |
210 #else |
194 if(0 == usageCount) |
211 if(0 == usageCount) |
195 { |
212 { |
196 tempTitle = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_SUB_TITLE_NO_IMG_NO_VID); |
213 tempTitle = LoadLocalizedStringLC(KResourceFile, |
|
214 R_DOWNLOADS_SUB_TITLE_NO_IMG_NO_VID); |
197 // Set the title in the response. |
215 // Set the title in the response. |
198 aResponse->SetTextValueL(attr, *tempTitle); |
216 aResponse->SetTextValueL(attr, *tempTitle); |
199 CleanupStack::PopAndDestroy(tempTitle); |
217 CleanupStack::PopAndDestroy(tempTitle); |
200 continue; |
218 continue; |
201 } |
219 } |
202 // Get the format string |
220 // Get the format string |
203 else if (1 == usageCount) |
221 else if (1 == usageCount) |
204 { |
222 { |
205 tempTitle = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_SUB_TITLE_SINGLE); |
223 tempTitle = LoadLocalizedStringLC(KResourceFile, |
|
224 R_DOWNLOADS_SUB_TITLE_SINGLE); |
206 aResponse->SetTextValueL(attr, *tempTitle); |
225 aResponse->SetTextValueL(attr, *tempTitle); |
207 CleanupStack::PopAndDestroy(tempTitle); |
226 CleanupStack::PopAndDestroy(tempTitle); |
208 continue; |
227 continue; |
209 } |
228 } |
210 else |
229 else |
211 { |
230 { |
212 tempTitle = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_SUB_TITLE_MULTI); |
231 tempTitle = LoadLocalizedStringLC(KResourceFile, |
|
232 R_DOWNLOADS_SUB_TITLE_MULTI); |
213 } |
233 } |
214 TPtr formatString = tempTitle->Des(); |
234 TPtr formatString = tempTitle->Des(); |
215 |
235 |
216 // Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number |
236 // Now create a buffer that will contain the result. needs to be |
217 HBufC* title = HBufC::NewLC(formatString.Length() + 10); |
237 // length of format string plus a few extra for the number |
|
238 HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPadding); |
218 TPtr ptr = title->Des(); |
239 TPtr ptr = title->Des(); |
219 StringLoader::Format(ptr, formatString, -1, usageCount); |
240 StringLoader::Format(ptr, formatString, -1, usageCount); |
220 |
241 |
221 // Set the title in the response. |
242 // Set the title in the response. |
222 aResponse->SetTextValueL(attr, *title); |
243 aResponse->SetTextValueL(attr, *title); |
246 } |
267 } |
247 else if (attr == KMPXMediaGeneralTitle) |
268 else if (attr == KMPXMediaGeneralTitle) |
248 { |
269 { |
249 GLX_LOG_INFO("Attribute : GeneralTitle"); |
270 GLX_LOG_INFO("Attribute : GeneralTitle"); |
250 |
271 |
251 HBufC* title = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_GENERAL_TITLE); |
272 HBufC* title = LoadLocalizedStringLC(KResourceFile, |
|
273 R_DOWNLOADS_GENERAL_TITLE); |
252 // Set the title in the response. |
274 // Set the title in the response. |
253 aResponse->SetTextValueL(attr, *title); |
275 aResponse->SetTextValueL(attr, *title); |
254 CleanupStack::PopAndDestroy(title); |
276 CleanupStack::PopAndDestroy(title); |
255 } |
277 } |
256 } |
278 } |
263 // ---------------------------------------------------------------------------- |
285 // ---------------------------------------------------------------------------- |
264 // |
286 // |
265 TBool CGlxCollectionPluginDownloads::IsUpdateMessageIgnoredL(CMPXMessage& /*aMessage*/) |
287 TBool CGlxCollectionPluginDownloads::IsUpdateMessageIgnoredL(CMPXMessage& /*aMessage*/) |
266 { |
288 { |
267 TRACER("CGlxCollectionPluginDownloads::IsUpdateMessageIgnoredL"); |
289 TRACER("CGlxCollectionPluginDownloads::IsUpdateMessageIgnoredL"); |
268 /// @todo origin could be passed up to allow downloads to ignore irrelevant adds, wait until inheritance is resolved |
290 /// @todo origin could be passed up to allow downloads to ignore irrelevant adds, |
|
291 // wait until inheritance is resolved |
269 TBool ignore = EFalse; |
292 TBool ignore = EFalse; |
270 return ignore; |
293 return ignore; |
271 } |
294 } |
272 |
295 |
273 |
296 |
277 // |
300 // |
278 TGlxFilterProperties CGlxCollectionPluginDownloads::DefaultFilter(TInt aLevel) |
301 TGlxFilterProperties CGlxCollectionPluginDownloads::DefaultFilter(TInt aLevel) |
279 { |
302 { |
280 TRACER("CGlxCollectionPluginDownloads::DefaultFilter"); |
303 TRACER("CGlxCollectionPluginDownloads::DefaultFilter"); |
281 |
304 |
282 __ASSERT_DEBUG(( (aLevel == KGlxCollectionRootLevel) || (aLevel == KGlxCollectionRootLevel+1) |
305 __ASSERT_DEBUG(( (aLevel == KGlxCollectionRootLevel) |
283 || (aLevel == KGlxCollectionRootLevel+2) ), Panic(EGlxPanicInvalidPathLevel)); |
306 || (aLevel == KGlxCollectionRootLevel+1) |
|
307 || (aLevel == KGlxCollectionRootLevel+2) ), |
|
308 Panic(EGlxPanicInvalidPathLevel)); |
284 TGlxFilterProperties filterProperties; |
309 TGlxFilterProperties filterProperties; |
285 filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; |
310 filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; |
286 filterProperties.iSortDirection = EGlxFilterSortDirectionDescending; |
311 filterProperties.iSortDirection = EGlxFilterSortDirectionDescending; |
287 #ifdef RD_MDS_2_5 |
312 #ifdef RD_MDS_2_5 |
288 filterProperties.iOrigin = EGlxFilterOriginDownload; |
313 filterProperties.iOrigin = EGlxFilterOriginDownload; |