23 */ |
23 */ |
24 |
24 |
25 #include "glxdatasourcetaskmdsidlist.h" |
25 #include "glxdatasourcetaskmdsidlist.h" |
26 |
26 |
27 #include <glxcollectionplugincamera.hrh> |
27 #include <glxcollectionplugincamera.hrh> |
28 #include <glxcollectionplugindownloads.hrh> |
|
29 #include <glxcollectionpluginmonths.hrh> |
|
30 #include <glxcollectionpluginalbums.hrh> |
28 #include <glxcollectionpluginalbums.hrh> |
31 #include <glxcollectionpluginall.hrh> |
29 #include <glxcollectionpluginall.hrh> |
32 #include <glxcollectionplugintags.hrh> |
30 #include <glxcollectionplugintags.hrh> |
33 #include <glxcollectionpluginimageviewer.hrh> |
31 #include <glxcollectionpluginimageviewer.hrh> |
34 |
32 |
144 { |
141 { |
145 isContent = EFalse; |
142 isContent = EFalse; |
146 objectDef = &DataSource()->TagDef(); |
143 objectDef = &DataSource()->TagDef(); |
147 break; |
144 break; |
148 } |
145 } |
149 case KGlxCollectionPluginMonthsImplementationUid: |
|
150 { |
|
151 iFilterProperties.iOrigin = EGlxFilterOriginAll; |
|
152 container = TGlxMediaId(KGlxCollectionRootId); |
|
153 resultMode = EQueryResultModeItem; |
|
154 break; |
|
155 } |
|
156 case KGlxCollectionPluginImageViewerImplementationUid: |
146 case KGlxCollectionPluginImageViewerImplementationUid: |
157 { |
147 { |
158 RArray<TGlxMediaId> list; |
148 RArray<TGlxMediaId> list; |
159 CleanupClosePushL(list); |
149 CleanupClosePushL(list); |
160 list.AppendL(TGlxMediaId(request->CollectionPluginUid().iUid)); |
150 list.AppendL(TGlxMediaId(request->CollectionPluginUid().iUid)); |
222 // ---------------------------------------------------------------------------- |
205 // ---------------------------------------------------------------------------- |
223 // |
206 // |
224 void CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL() |
207 void CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL() |
225 { |
208 { |
226 TRACER("CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL()") |
209 TRACER("CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL()") |
227 if(iQueries[0]->ResultMode() == EQueryResultModeItem) |
210 RArray<TGlxMediaId> localList; |
228 { |
211 CleanupClosePushL(localList); |
229 DoMonthListCreationL(*iQueries[0], iFilterProperties); |
212 NGlxDataSourceMdsUtility::CopyItemIdArrayL(localList, |
230 } |
213 iQueries[0]->ResultIds()); |
231 else // only id or item supported |
214 PostFilterL(localList, iFilterProperties); |
232 { |
215 CleanupStack::PopAndDestroy(&localList); |
233 |
|
234 RArray<TGlxMediaId> localList; |
|
235 CleanupClosePushL(localList); |
|
236 NGlxDataSourceMdsUtility::CopyItemIdArrayL(localList,iQueries[0]->ResultIds()); |
|
237 PostFilterL(localList, iFilterProperties); |
|
238 CleanupStack::PopAndDestroy(&localList); |
|
239 } |
|
240 } |
216 } |
241 |
|
242 // ---------------------------------------------------------------------------- |
|
243 // CGlxDataSourceTaskMdeIdList::DoMonthListCreationL |
|
244 // ---------------------------------------------------------------------------- |
|
245 // |
|
246 void CGlxDataSourceTaskMdeIdList::DoMonthListCreationL(CMdEQuery& aQuery, |
|
247 const TGlxFilterProperties& aFilterProperties) |
|
248 { |
|
249 TRACER("CGlxDataSourceTaskMdeIdList::DoMonthListCreationL()") |
|
250 CMdEProperty* time; |
|
251 CMdEPropertyDef& creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); |
|
252 if (creationDateDef.PropertyType() != EPropertyTime) |
|
253 { |
|
254 User::Leave(KErrCorrupt); |
|
255 } |
|
256 RArray<TGlxMediaId> monthList; |
|
257 CleanupClosePushL(monthList); |
|
258 TTime lastMonth; |
|
259 TTime currentMonth; |
|
260 TInt count = aQuery.Count(); |
|
261 GLX_DEBUG2("CGlxDataSourceTaskMdeIdList::DoMonthListCreationL count=%d", count); |
|
262 for( TInt i = 0 ; i < count ; i++ ) |
|
263 { |
|
264 CMdEObject& object = (CMdEObject&)aQuery.ResultItem(i); |
|
265 TInt timeIndex = object.Property(creationDateDef, time); |
|
266 if( KErrNotFound == timeIndex ) |
|
267 { |
|
268 User::Leave(KErrCorrupt); |
|
269 } |
|
270 currentMonth = static_cast<CMdETimeProperty*>(time)->Value(); |
|
271 |
|
272 // Also Checking for a Valid Month Entry Based on a Year Greater than 0000. |
|
273 if( !DataSource()->SameMonth(lastMonth, currentMonth) && (currentMonth.DateTime().Year() > 0) ) |
|
274 { |
|
275 const TGlxMediaId monthId = DataSource()->GetMonthIdL(currentMonth); |
|
276 monthList.AppendL(monthId); |
|
277 GLX_DEBUG2("CGlxDataSourceTaskMdeIdList::DoMonthListCreationL monthId=%d", monthId.Value()); |
|
278 lastMonth = currentMonth; |
|
279 } |
|
280 } |
|
281 GLX_DEBUG2("CGlxDataSourceTaskMdeIdList::DoMonthListCreationL monthList.Count=%d", monthList.Count()); |
|
282 PostFilterL(monthList, aFilterProperties); |
|
283 CleanupStack::PopAndDestroy(&monthList); |
|
284 } |
|
285 |
217 |
286 // ---------------------------------------------------------------------------- |
218 // ---------------------------------------------------------------------------- |
287 // CGlxDataSourceTaskMdeIdList::DoPostFilterComplete |
219 // CGlxDataSourceTaskMdeIdList::DoPostFilterComplete |
288 // ---------------------------------------------------------------------------- |
220 // ---------------------------------------------------------------------------- |
289 // |
221 // |