86 iProgressComplete = EFalse; |
86 iProgressComplete = EFalse; |
87 |
87 |
88 // deriving class consumes command by default |
88 // deriving class consumes command by default |
89 TBool consume = ETrue; |
89 TBool consume = ETrue; |
90 TInt selectionCount = aList.SelectionCount(); |
90 TInt selectionCount = aList.SelectionCount(); |
91 const TGlxMedia& focusedMedia = aList.Item(aList.FocusIndex()); |
91 |
|
92 // Do not consume If no item is selected and |
|
93 // "focused" item index is invalid |
|
94 TInt focusIndex = aList.FocusIndex(); |
|
95 if ((selectionCount == 0) && (KErrNotFound == focusIndex || focusIndex |
|
96 > aList.Count())) |
|
97 { |
|
98 return EFalse; |
|
99 } |
|
100 |
|
101 const TGlxMedia& focusedMedia = aList.Item(focusIndex); |
92 // show confirmation note |
102 // show confirmation note |
93 consume = ConfirmationNoteL(aCommandId, aList); |
103 consume = ConfirmationNoteL(aCommandId, aList); |
94 |
104 |
95 // Check if the selected / focused file(s)s have been deleted from |
105 // Check if the selected / focused file(s)s have been deleted from |
96 // another application while the confirmation note is displayed |
106 // another application while the confirmation note is displayed |
97 if (((selectionCount > 0) && (aList.SelectionCount() == 0)) |
107 // 1. If list is empty or previously Items were selected & are removed in current list |
98 || ((selectionCount == 0) && aList.Count() && (focusedMedia.Id() |
108 if (aList.Count() == 0 || ((selectionCount > 0) && (aList.SelectionCount() == 0))) |
99 != aList.Item(aList.FocusIndex()).Id()))) |
|
100 { |
109 { |
101 // All the selected / focused item(s) have been deleted, |
110 consume = EFalse; |
102 // do not allow the command to execute. |
111 } |
|
112 // 2.If previously no Item selected then check if current focus index is valid |
|
113 // and previous & current focused item are same. |
|
114 else if ((selectionCount == 0) && ((KErrNotFound != aList.FocusIndex() |
|
115 && aList.FocusIndex() < aList.Count()) && (focusedMedia.Id() |
|
116 != aList.Item(aList.FocusIndex()).Id()))) |
|
117 { |
103 consume = EFalse; |
118 consume = EFalse; |
104 } |
119 } |
105 |
120 |
106 if ( consume ) |
121 if ( consume ) |
107 { |
122 { |