20 |
20 |
21 #include "glxmedialistviewbase.h" |
21 #include "glxmedialistviewbase.h" |
22 |
22 |
23 #include <mpxcollectionutility.h> |
23 #include <mpxcollectionutility.h> |
24 #include <glxcollectionpluginimageviewer.hrh> |
24 #include <glxcollectionpluginimageviewer.hrh> |
|
25 #include <glxcollectionpluginalbums.hrh> |
25 #include <glxcommandhandler.h> |
26 #include <glxcommandhandler.h> |
26 #include <glxassert.h> |
27 #include <glxassert.h> |
27 #include <glxgallery.hrh> |
28 #include <glxgallery.hrh> |
28 #include <glxattributecontext.h> |
29 #include <glxattributecontext.h> |
29 #include <glxuistd.h> |
30 #include <glxuistd.h> |
57 iMediaListFactory = aMediaListFactory; |
58 iMediaListFactory = aMediaListFactory; |
58 iCollectionUtility = MMPXCollectionUtility::NewL(NULL, KMcModeDefault); |
59 iCollectionUtility = MMPXCollectionUtility::NewL(NULL, KMcModeDefault); |
59 iEnableMidddleSoftkey = aEnableMiddleSoftkey; |
60 iEnableMidddleSoftkey = aEnableMiddleSoftkey; |
60 |
61 |
61 iSelectionIterator.SetRange(KMaxTInt); |
62 iSelectionIterator.SetRange(KMaxTInt); |
62 iPreloadContextForCommandHandlers = new (ELeave) CGlxAttributeContext(&iSelectionIterator); |
63 |
63 |
64 if (aTitle.Length() > 0) |
64 if(aTitle.Length() > 0) |
|
65 { |
65 { |
66 iFixedTitle = aTitle.AllocL(); |
66 iFixedTitle = aTitle.AllocL(); |
67 } |
67 } |
68 |
68 |
69 |
69 if (iUiUtility->IsPenSupported()) |
70 if(iUiUtility->IsPenSupported()) |
|
71 { |
70 { |
72 // Responsible for controlling the ui states of toolbar |
71 // Responsible for controlling the ui states of toolbar |
73 // Create ToolbarController only for touch supported devices. |
72 // Create ToolbarController only for touch supported devices. |
74 iToolbarControl = CGlxToolbarController::NewL(); |
73 iToolbarControl = CGlxToolbarController::NewL(); |
75 } |
74 } |
76 else |
75 else |
77 { |
76 { |
78 // Responsible for controlling the middle softkey if enabled. |
77 // Responsible for controlling the middle softkey if enabled. |
79 // Create Middle Softkey Controller only for non-touch devices |
78 // Create Middle Softkey Controller only for non-touch devices |
80 iCbaControl = CGlxMSKController::NewL(); |
79 iCbaControl = CGlxMSKController::NewL(); |
81 } |
80 } |
82 } |
81 } |
83 |
82 |
84 // ----------------------------------------------------------------------------- |
83 // ----------------------------------------------------------------------------- |
85 // Destructor |
84 // Destructor |
86 // ----------------------------------------------------------------------------- |
85 // ----------------------------------------------------------------------------- |
159 CleanupStack::PopAndDestroy( path ); |
161 CleanupStack::PopAndDestroy( path ); |
160 } |
162 } |
161 |
163 |
162 if (!iMediaList && iMediaListFactory) |
164 if (!iMediaList && iMediaListFactory) |
163 { |
165 { |
164 iMediaList = &iMediaListFactory->CreateMediaListL(*iCollectionUtility); |
166 iMediaList |
165 iMediaList->AddContextL(iPreloadContextForCommandHandlers, 0); |
167 = &iMediaListFactory->CreateMediaListL(*iCollectionUtility); |
|
168 |
|
169 if ((navigationalState->Id() != TMPXItemId( |
|
170 KGlxCollectionPluginAlbumsImplementationUid)) |
|
171 && (navigationalState->Id() != TMPXItemId( |
|
172 KGlxCollectionPluginAlbumsImplementationUid))) |
|
173 { |
|
174 iPreloadContextForCommandHandlers |
|
175 = new (ELeave) CGlxAttributeContext(&iSelectionIterator); |
|
176 TInt commandHandlerCount = iCommandHandlerList.Count(); |
|
177 for (TInt i = 0; i < commandHandlerCount; i++) |
|
178 { |
|
179 DoPrepareCommandHandlerL(iCommandHandlerList[i]); |
|
180 } |
|
181 |
|
182 iMediaList->AddContextL(iPreloadContextForCommandHandlers, 0); |
|
183 } |
166 } |
184 } |
167 __ASSERT_ALWAYS(iMediaList, Panic(EGlxPanicNullMediaList)); |
185 __ASSERT_ALWAYS(iMediaList, Panic(EGlxPanicNullMediaList)); |
168 |
186 |
169 |
187 |
170 if (navigationalState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) |
188 if (navigationalState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) |
300 for (TInt i = 0; i < commandHandlerCount; i++) |
318 for (TInt i = 0; i < commandHandlerCount; i++) |
301 { |
319 { |
302 AddAttributesToContextL(*attributeContext, iCommandHandlerList[i], ETrue, aFilterUsingCommandId, aCommandId); |
320 AddAttributesToContextL(*attributeContext, iCommandHandlerList[i], ETrue, aFilterUsingCommandId, aCommandId); |
303 } |
321 } |
304 |
322 |
|
323 if( EAknSoftkeyBack == aCommandId || attributeContext->AttributeCount()) |
|
324 { |
|
325 // Check if media attributes are already fetched. |
|
326 // If media item is NULL, Cancel the previous pending request |
|
327 MediaList().CancelPreviousRequests(); |
|
328 } |
|
329 |
305 if (attributeContext->AttributeCount()) |
330 if (attributeContext->AttributeCount()) |
306 { |
331 { |
307 // Check if media attributes are already fetched. |
|
308 // If media item is NULL, Cancel the previous pending request |
|
309 MediaList().CancelPreviousRequests(); |
|
310 |
332 |
311 MediaList().AddContextL(attributeContext, KGlxFetchContextPriorityCommandHandlerOpening ); |
333 MediaList().AddContextL(attributeContext, KGlxFetchContextPriorityCommandHandlerOpening ); |
312 |
334 |
313 // TGlxContextRemover will remove the context when it goes out of scope |
335 // TGlxContextRemover will remove the context when it goes out of scope |
314 // Used here to avoid a trap and still have safe cleanup |
336 // Used here to avoid a trap and still have safe cleanup |
350 // ----------------------------------------------------------------------------- |
372 // ----------------------------------------------------------------------------- |
351 // |
373 // |
352 EXPORT_C void CGlxMediaListViewBase::DoPrepareCommandHandlerL( |
374 EXPORT_C void CGlxMediaListViewBase::DoPrepareCommandHandlerL( |
353 CGlxCommandHandler* aCommandHandler) |
375 CGlxCommandHandler* aCommandHandler) |
354 { |
376 { |
355 AddAttributesToContextL(*iPreloadContextForCommandHandlers, |
377 if (iPreloadContextForCommandHandlers) |
356 aCommandHandler, EFalse, EFalse); |
378 { |
357 } |
379 AddAttributesToContextL(*iPreloadContextForCommandHandlers, |
|
380 aCommandHandler, EFalse, EFalse); |
|
381 } |
|
382 } |
358 |
383 |
359 // ----------------------------------------------------------------------------- |
384 // ----------------------------------------------------------------------------- |
360 // CGlxMediaListViewBase::CloseMediaList |
385 // CGlxMediaListViewBase::CloseMediaList |
361 // ----------------------------------------------------------------------------- |
386 // ----------------------------------------------------------------------------- |
362 // |
387 // |
363 void CGlxMediaListViewBase::CloseMediaList() |
388 void CGlxMediaListViewBase::CloseMediaList() |
364 { |
389 { |
365 if (iMediaList) |
390 if (iMediaList) |
366 { |
391 { |
367 iMediaList->RemoveContext(iPreloadContextForCommandHandlers); |
392 if (iPreloadContextForCommandHandlers) |
|
393 { |
|
394 iMediaList->RemoveContext(iPreloadContextForCommandHandlers); |
|
395 } |
368 iMediaList->Close(); |
396 iMediaList->Close(); |
369 iMediaList = NULL; |
397 iMediaList = NULL; |
370 } |
398 } |
371 } |
399 } |
372 |
400 |