2176 TRAP_IGNORE( DoUpdateListBoxL( aRestFindBox ) ); |
2176 TRAP_IGNORE( DoUpdateListBoxL( aRestFindBox ) ); |
2177 |
2177 |
2178 iListBox->MakeVisible( ETrue ); |
2178 iListBox->MakeVisible( ETrue ); |
2179 } |
2179 } |
2180 |
2180 |
2181 // ---------------------------------------------------------------------------- |
|
2182 // CMediaFileDialog::FilterInvalidFiles |
|
2183 // |
|
2184 // Filters the invalid files from media file handler |
|
2185 // invalid files = rights expired DRM Protected files and no right files |
|
2186 // ---------------------------------------------------------------------------- |
|
2187 // |
|
2188 void CMediaFileDialog::FilterInvalidFiles() |
|
2189 { |
|
2190 TInt count = iMediaFileHandler->ResultCount(); |
|
2191 |
|
2192 for ( TInt idx = 0; idx < count; ) |
|
2193 { |
|
2194 // check the validity |
|
2195 GetSelectedItemFileName( idx, iBuf ); |
|
2196 if ( iProtectionHandler->IsFlieDRMExpired( iBuf ) ) |
|
2197 { |
|
2198 // remove the item from handler in case of invalid file |
|
2199 iMediaFileHandler->Remove( idx ); |
|
2200 |
|
2201 // if an item was removed from handler, the idx will not |
|
2202 // be changed and the count will be decreased one. after |
|
2203 // recalculate the count, the next item will be checked in next loop. |
|
2204 count = iMediaFileHandler->ResultCount(); |
|
2205 } |
|
2206 else |
|
2207 { |
|
2208 // just increase the idx in case of valid file |
|
2209 idx++; |
|
2210 } |
|
2211 } |
|
2212 } |
|
2213 |
2181 |
2214 // ---------------------------------------------------------------------------- |
2182 // ---------------------------------------------------------------------------- |
2215 // CMediaFileDialog::DoUpdateListBoxL |
2183 // CMediaFileDialog::DoUpdateListBoxL |
2216 // |
2184 // |
2217 // Update listbox contents (currently open folder items). |
2185 // Update listbox contents (currently open folder items). |
2218 // ---------------------------------------------------------------------------- |
2186 // ---------------------------------------------------------------------------- |
2219 // |
2187 // |
2220 void CMediaFileDialog::DoUpdateListBoxL( TBool aRestFindBox ) |
2188 void CMediaFileDialog::DoUpdateListBoxL( TBool aRestFindBox ) |
2221 { |
2189 { |
2222 // filter the invalid files to avoid showing in the list box |
|
2223 FilterInvalidFiles(); |
|
2224 iState->SetUnknownFolderPosition( iMediaFileHandler->ResultCount() ); |
2190 iState->SetUnknownFolderPosition( iMediaFileHandler->ResultCount() ); |
2225 |
2191 |
2226 // check current item index in case media file database has changed |
2192 // check current item index in case media file database has changed |
2227 CheckListboxIndex(); |
2193 CheckListboxIndex(); |
2228 if ( aRestFindBox ) |
2194 if ( aRestFindBox ) |
3120 // |
3086 // |
3121 void CMediaFileDialog::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
3087 void CMediaFileDialog::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
3122 TListBoxEvent aEventType ) |
3088 TListBoxEvent aEventType ) |
3123 { |
3089 { |
3124 TInt current = iState->CurrentFolder(); |
3090 TInt current = iState->CurrentFolder(); |
3125 if ( aEventType == EEventPenDownOnItem) |
3091 |
3126 { |
3092 switch ( aEventType ) |
3127 iListBox->View()->ItemDrawer()->SetFlags( CListItemDrawer::EPressedDownState ); |
3093 { |
3128 return; |
3094 case EEventPenDownOnItem: |
3129 } |
3095 { |
3130 |
3096 iListBox->View()->ItemDrawer()->SetFlags( CListItemDrawer::EPressedDownState ); |
3131 if ( aEventType == EEventItemClicked ) |
3097 break; |
3132 { |
3098 } |
3133 iIsDoubleClicked = EFalse; |
3099 |
3134 if ( current != KErrNotFound ) |
3100 case EEventItemClicked: |
3135 { |
3101 { |
3136 HandleOKL( EAttrOpen ); // open folder item |
3102 iIsDoubleClicked = EFalse; |
3137 } |
3103 |
3138 return; |
3104 if ( current != KErrNotFound ) |
3139 } |
3105 { |
3140 |
3106 HandleOKL( EAttrOpen ); // open folder item |
3141 if ( aEventType == EEventItemDoubleClicked || aEventType == EEventEnterKeyPressed ) |
3107 } |
3142 { |
3108 break; |
3143 iIsDoubleClicked = ETrue; |
3109 } |
3144 TBool closeDialog = HandleOKL( EAttrDoubleClicked ); |
3110 |
3145 |
3111 case EEventItemDoubleClicked: |
3146 if ( closeDialog ) |
3112 case EEventEnterKeyPressed: |
3147 { |
3113 { |
3148 // close after short delay (dialog cannot be closed from this function) |
3114 iIsDoubleClicked = ETrue; |
3149 CloseDialogWithDelayL(); |
3115 TBool closeDialog = HandleOKL( EAttrDoubleClicked ); |
3150 } |
3116 |
3151 } |
3117 if ( closeDialog ) |
3152 if ( aEventType == EEventItemDraggingActioned ) |
3118 { |
3153 { |
3119 // close after short delay (dialog cannot be closed from this function) |
3154 UpdateCbaL( KErrNone ); |
3120 CloseDialogWithDelayL(); |
3155 DrawNow(); |
3121 } |
3156 } |
3122 break; |
|
3123 } |
|
3124 |
|
3125 case EEventItemDraggingActioned: |
|
3126 { |
|
3127 UpdateCbaL( KErrNone ); |
|
3128 DrawNow(); |
|
3129 break; |
|
3130 } |
|
3131 |
|
3132 case EEventFlickStarted: |
|
3133 case EEventPanningStarted: |
|
3134 { |
|
3135 //cancel preview if Kinetic scrolling is started |
|
3136 if ( iCaller ) |
|
3137 { |
|
3138 iCaller->Cancel(); |
|
3139 } |
|
3140 break; |
|
3141 } |
|
3142 |
|
3143 default: |
|
3144 break; |
|
3145 } |
3157 } |
3146 } |
3158 |
3147 |
3159 |
3148 |
3160 // ----------------------------------------------------------------------------- |
3149 // ----------------------------------------------------------------------------- |
3161 // CMediaFileDialog::CloseDialogWithDelayL |
3150 // CMediaFileDialog::CloseDialogWithDelayL |