153 // ----------------------------------------------------------------------------- |
153 // ----------------------------------------------------------------------------- |
154 // DynInitMenuPaneL |
154 // DynInitMenuPaneL |
155 // ----------------------------------------------------------------------------- |
155 // ----------------------------------------------------------------------------- |
156 // |
156 // |
157 EXPORT_C void CGlxMediaListCommandHandler::DynInitMenuPaneL(TInt aResourceId, |
157 EXPORT_C void CGlxMediaListCommandHandler::DynInitMenuPaneL(TInt aResourceId, |
158 CEikMenuPane* aMenuPane) |
158 CEikMenuPane* aMenuPane, TBool aIsBrowseMode) |
159 { |
159 { |
160 if ( aMenuPane ) |
160 if ( aMenuPane ) |
161 { |
161 { |
162 if ( BypassFiltersForMenu() ) |
162 if ( BypassFiltersForMenu() ) |
163 { |
163 { |
173 { |
173 { |
174 CEikMenuPaneItem::SData& item = aMenuPane->ItemDataByIndexL(i); |
174 CEikMenuPaneItem::SData& item = aMenuPane->ItemDataByIndexL(i); |
175 |
175 |
176 // Check if the menu command is know to this command handler |
176 // Check if the menu command is know to this command handler |
177 if ( IsSupported( item.iCommandId ) ) |
177 if ( IsSupported( item.iCommandId ) ) |
178 { |
178 { |
179 TBool isDisabled = IsDisabledL(item.iCommandId, MediaList()); |
179 TBool isDisabled = EFalse; |
|
180 //If we are in grid view check whether to disable the item |
|
181 //with a light weight API, since the API IsDisabledL( ) |
|
182 //takes time to execute randomly over the time, which is |
|
183 //not predictable. This is not be required for list view |
|
184 //since it has only 2-3 commands and there are no AIW |
|
185 //menu. |
|
186 if(aIsBrowseMode) |
|
187 { |
|
188 TBool isContextItem = EFalse; |
|
189 //Check whether its a context menu item. |
|
190 if(item.iFlags & EEikMenuItemSpecific) |
|
191 { |
|
192 isContextItem = ETrue; |
|
193 } |
|
194 |
|
195 isDisabled = CheckDisabledForBrowseModeL(item.iCommandId, |
|
196 MediaList(), isContextItem); |
|
197 } |
|
198 else |
|
199 { |
|
200 isDisabled = IsDisabledL(item.iCommandId, MediaList()); |
|
201 } |
|
202 |
180 // Check visibility of the menu item |
203 // Check visibility of the menu item |
181 aMenuPane->SetItemDimmed( item.iCommandId, isDisabled); |
204 aMenuPane->SetItemDimmed( item.iCommandId, isDisabled); |
182 |
205 |
183 atLeastOneEnabledSupportedItem = atLeastOneEnabledSupportedItem || (!isDisabled); |
206 atLeastOneEnabledSupportedItem = atLeastOneEnabledSupportedItem || (!isDisabled); |
184 } |
207 } |
237 RArray< TMPXAttribute >& aAttributes, |
260 RArray< TMPXAttribute >& aAttributes, |
238 TBool aFilterUsingSelection, |
261 TBool aFilterUsingSelection, |
239 TBool aFilterUsingCommandId, |
262 TBool aFilterUsingCommandId, |
240 TInt aCommandId) const |
263 TInt aCommandId) const |
241 { |
264 { |
|
265 CleanupClosePushL(aAttributes); |
242 if (!aFilterUsingCommandId || IsSupported(aCommandId)) |
266 if (!aFilterUsingCommandId || IsSupported(aCommandId)) |
243 { |
267 { |
244 GetRequiredAttributesL(aAttributes, aFilterUsingSelection); |
268 GetRequiredAttributesL(aAttributes, aFilterUsingSelection); |
245 } |
269 } |
|
270 CleanupStack::Pop(&aAttributes); |
246 } |
271 } |
247 |
272 |
248 // ----------------------------------------------------------------------------- |
273 // ----------------------------------------------------------------------------- |
249 // Check if command is currently disabled |
274 // Check if command is currently disabled |
250 // ----------------------------------------------------------------------------- |
275 // ----------------------------------------------------------------------------- |
643 aAttributes.AppendL(KGlxMediaGeneralSlideshowableContent); |
668 aAttributes.AppendL(KGlxMediaGeneralSlideshowableContent); |
644 } |
669 } |
645 |
670 |
646 DoGetRequiredAttributesL(aAttributes, aFilterUsingSelection); |
671 DoGetRequiredAttributesL(aAttributes, aFilterUsingSelection); |
647 } |
672 } |
|
673 |
|
674 // ----------------------------------------------------------------------------- |
|
675 // Check if the command should be disabled/enabled for grid view |
|
676 // ----------------------------------------------------------------------------- |
|
677 // |
|
678 TBool CGlxMediaListCommandHandler::CheckDisabledForBrowseModeL(TInt aCommandId, |
|
679 MGlxMediaList& aMediaList, TBool aIsContextItem) |
|
680 |
|
681 { |
|
682 TInt mlCount = aMediaList.Count(); |
|
683 TInt selectionCount = aMediaList.SelectionCount(); |
|
684 |
|
685 if(mlCount<=0) |
|
686 { |
|
687 //If no items are present then enable Help and Exit in options |
|
688 if(aCommandId != EAknCmdHelp && |
|
689 aCommandId != EAknCmdExit) |
|
690 { |
|
691 return ETrue; |
|
692 } |
|
693 } |
|
694 //If count is >0 and if its context menu item then enable them |
|
695 //always, Since all the items are static it would not affect |
|
696 //the normal behaviour present earlier. |
|
697 else if(aIsContextItem) |
|
698 { |
|
699 return EFalse; |
|
700 } |
|
701 //If selectionCount is 0 then enable only slideshow, markall |
|
702 //help and exit as present currently. |
|
703 else if((selectionCount == 0) && |
|
704 (aCommandId != EAknCmdHelp && |
|
705 aCommandId != EAknCmdExit && |
|
706 aCommandId != EGlxCmdSlideshow && |
|
707 aCommandId != EAknMarkAll && |
|
708 aCommandId != EGlxCmdSlideshowPlay && |
|
709 aCommandId != EGlxCmdSlideshowSettings)) |
|
710 { |
|
711 return ETrue; |
|
712 } |
|
713 //If selectionCount is same as media count then disable |
|
714 //Markall and Details view. If only one item is present |
|
715 //then only disable MarkAll. |
|
716 else if((selectionCount == mlCount) && |
|
717 (aCommandId == EAknMarkAll || |
|
718 (aCommandId == EGlxCmdDetails && mlCount>1))) |
|
719 { |
|
720 return ETrue; |
|
721 } |
|
722 //If selectionCount > 1 then disable Details view. |
|
723 else if((selectionCount > 1) && |
|
724 (aCommandId == EGlxCmdDetails)) |
|
725 { |
|
726 return ETrue; |
|
727 } |
|
728 |
|
729 return EFalse; |
|
730 } |