63 // ============================ MEMBER FUNCTIONS =============================== |
63 // ============================ MEMBER FUNCTIONS =============================== |
64 |
64 |
65 // --------------------------------------------------------- |
65 // --------------------------------------------------------- |
66 // NewL |
66 // NewL |
67 // --------------------------------------------------------- |
67 // --------------------------------------------------------- |
68 // |
68 // |
69 CGlxMetadataContainer* CGlxMetadataContainer::NewL( const TRect& aRect, |
69 CGlxMetadataContainer* CGlxMetadataContainer::NewL( const TRect& aRect, |
70 MGlxMetadataDialogObserver& aDialogObserver, |
70 MGlxMetadataDialogObserver& aDialogObserver, |
71 const TDesC& item,MToolbarResetObserver& aResetToolbarObs) |
71 const TDesC& item,MToolbarResetObserver& aResetToolbarObs) |
72 { |
72 { |
73 TRACER("CGlxMetadataContainer::NewL"); |
73 TRACER("CGlxMetadataContainer::NewL"); |
74 CGlxMetadataContainer* self = CGlxMetadataContainer::NewLC( aRect, |
74 CGlxMetadataContainer* self = CGlxMetadataContainer::NewLC( aRect, |
75 aDialogObserver,item,aResetToolbarObs); |
75 aDialogObserver,item,aResetToolbarObs); |
76 CleanupStack::Pop(self); |
76 CleanupStack::Pop(self); |
77 return self; |
77 return self; |
78 } |
78 } |
79 |
79 |
80 // --------------------------------------------------------- |
80 // --------------------------------------------------------- |
81 // NewLC |
81 // NewLC |
82 // --------------------------------------------------------- |
82 // --------------------------------------------------------- |
83 // |
83 // |
84 CGlxMetadataContainer* CGlxMetadataContainer::NewLC( const TRect& aRect, |
84 CGlxMetadataContainer* CGlxMetadataContainer::NewLC( const TRect& aRect, |
85 MGlxMetadataDialogObserver& aDialogObserver, |
85 MGlxMetadataDialogObserver& aDialogObserver, |
86 const TDesC& aUri,MToolbarResetObserver& aResetToolbarObs) |
86 const TDesC& aUri,MToolbarResetObserver& aResetToolbarObs) |
87 { |
87 { |
88 TRACER("CGlxMetadataContainer::NewLC"); |
88 TRACER("CGlxMetadataContainer::NewLC"); |
89 CGlxMetadataContainer* self = new(ELeave) CGlxMetadataContainer(aDialogObserver,aUri,aResetToolbarObs); |
89 CGlxMetadataContainer* self = new(ELeave) CGlxMetadataContainer(aDialogObserver, aResetToolbarObs); |
90 CleanupStack::PushL(self); |
90 CleanupStack::PushL(self); |
91 self->ConstructL( aRect); |
91 self->ConstructL( aRect, aUri); |
92 return self; |
92 return self; |
93 } |
93 } |
94 |
94 |
95 // --------------------------------------------------------- |
95 // --------------------------------------------------------- |
96 // CGlxMetadataContainer |
96 // CGlxMetadataContainer |
97 // --------------------------------------------------------- |
97 // --------------------------------------------------------- |
98 // |
98 // |
99 CGlxMetadataContainer::CGlxMetadataContainer(MGlxMetadataDialogObserver& aDialogObserver, |
99 CGlxMetadataContainer::CGlxMetadataContainer(MGlxMetadataDialogObserver& aDialogObserver, |
100 const TDesC& aUri,MToolbarResetObserver& aResetToolbarObs) |
100 MToolbarResetObserver& aResetToolbarObs) |
101 :iDialogObesrver ( aDialogObserver ),iUri(aUri),iResetToolbarObs(aResetToolbarObs) |
101 :iDialogObesrver ( aDialogObserver ),iResetToolbarObs(aResetToolbarObs) |
102 { |
102 { |
103 // No implementation |
103 // No implementation |
104 } |
104 } |
105 |
105 |
106 // --------------------------------------------------------- |
106 // --------------------------------------------------------- |
107 // CGlxMetadataContainer::ConstructL |
107 // CGlxMetadataContainer::ConstructL |
108 // --------------------------------------------------------- |
108 // --------------------------------------------------------- |
109 // |
109 // |
110 void CGlxMetadataContainer::ConstructL( const TRect& /*aRect*/ ) |
110 void CGlxMetadataContainer::ConstructL( const TRect& /*aRect*/ , const TDesC& aUri) |
111 { |
111 { |
|
112 |
|
113 //media's uri |
|
114 iUri = aUri.AllocL(); |
|
115 |
112 //Creating the RBuf texts for all the items except tags & albums |
116 //Creating the RBuf texts for all the items except tags & albums |
113 //which would be updated as whne the item is edited |
117 //which would be updated as whne the item is edited |
114 iTextSetter.CreateL(KMaxFileName); |
118 iTextSetter.CreateL(KMaxFileName); |
115 |
119 |
116 //RBuf text which would be updated as when a tag is edited for the item. |
120 //RBuf text which would be updated as when a tag is edited for the item. |
117 iTagSetter.CreateL(KMaxFileName); |
121 iTagSetter.CreateL(KMaxFileName); |
118 |
122 |
119 //RBuf text which would be updated as when a album is edited for the item. |
123 //RBuf text which would be updated as when a album is edited for the item. |
120 iAlbumSetter.CreateL(KMaxFileName); |
124 iAlbumSetter.CreateL(KMaxFileName); |
121 |
125 |
122 //Create medialist filtered by uri - iUri |
126 //Create medialist filtered by uri - iUri |
123 CreateMediaListForSelectedItemL(); |
127 CreateMediaListForSelectedItemL(); |
124 |
128 |
125 //Setting the iVideo flag to EFalse initially |
129 //Setting the iVideo flag to EFalse initially |
126 iVideo = EFalse; |
130 iVideo = EFalse; |
127 |
131 |
128 //Setting the iMarquee flag to EFalse initially |
132 //Setting the iMarquee flag to EFalse initially |
129 iMarquee = EFalse; |
133 iMarquee = EFalse; |
130 |
134 |
131 //check when Remove location information is selected. |
135 //check when Remove location information is selected. |
132 iLocationinfo = EFalse; |
136 iLocationinfo = EFalse; |
133 |
137 |
134 //Creating a CGlxMetadataAsyncUpdate object |
138 //Flag to indicate rename command is started |
135 iAsyncRequest = CGlxMetadataAsyncUpdate::NewL(*this); |
139 iRenameStarted = EFalse; |
136 |
140 |
137 //Initializing to NULL |
|
138 iModifiedUri = NULL; |
|
139 |
|
140 //Flag to check if rename is completed successfully. |
|
141 iRenameCompleted = EFalse; |
|
142 } |
141 } |
143 |
142 |
144 // --------------------------------------------------------- |
143 // --------------------------------------------------------- |
145 // ~CGlxMetadataContainer |
144 // ~CGlxMetadataContainer |
146 // --------------------------------------------------------- |
145 // --------------------------------------------------------- |
147 // |
146 // |
148 CGlxMetadataContainer::~CGlxMetadataContainer() |
147 CGlxMetadataContainer::~CGlxMetadataContainer() |
149 { |
148 { |
150 TRACER("CGlxMetadataContainer::~CGlxMetadataContainer"); |
149 TRACER("CGlxMetadataContainer::~CGlxMetadataContainer"); |
151 if( iItemMediaList ) |
150 if( iItemMediaList ) |
152 { |
151 { |
153 iItemMediaList->RemoveContext(iMainListAttributecontext); |
152 iItemMediaList->RemoveContext(iMainListAttributecontext); |
154 iItemMediaList->RemoveMediaListObserver(this); |
153 iItemMediaList->RemoveMediaListObserver(this); |
155 iItemMediaList->Close(); |
154 iItemMediaList->Close(); |
156 iItemMediaList = NULL; |
155 iItemMediaList = NULL; |
157 } |
156 } |
158 if ( iTagMediaList ) |
157 if ( iTagMediaList ) |
159 { |
158 { |
160 iTagMediaList->RemoveContext(iTagContext); |
159 iTagMediaList->RemoveContext(iTagContext); |
161 iTagMediaList->RemoveMediaListObserver(this); |
160 iTagMediaList->RemoveMediaListObserver(this); |
162 iTagMediaList->Close(); |
161 iTagMediaList->Close(); |
163 iTagMediaList = NULL; |
162 iTagMediaList = NULL; |
164 } |
163 } |
165 if ( iAlbumMediaList ) |
164 if ( iAlbumMediaList ) |
166 { |
165 { |
167 iAlbumMediaList->RemoveContext(iAlbumContext); |
166 iAlbumMediaList->RemoveContext(iAlbumContext); |
168 iAlbumMediaList->RemoveMediaListObserver(this); |
167 iAlbumMediaList->RemoveMediaListObserver(this); |
169 iAlbumMediaList->Close(); |
168 iAlbumMediaList->Close(); |
170 iAlbumMediaList = NULL; |
169 iAlbumMediaList = NULL; |
171 } |
170 } |
172 if( iTagContext ) |
171 if( iTagContext ) |
173 { |
172 { |
174 delete iTagContext; |
173 delete iTagContext; |
175 iTagContext = NULL; |
174 iTagContext = NULL; |
176 } |
175 } |
177 if( iAlbumContext ) |
176 if( iAlbumContext ) |
178 { |
177 { |
179 delete iAlbumContext; |
178 delete iAlbumContext; |
180 iAlbumContext = NULL; |
179 iAlbumContext = NULL; |
181 } |
180 } |
182 if( iMainListAttributecontext ) |
181 if( iMainListAttributecontext ) |
183 { |
182 { |
184 delete iMainListAttributecontext; |
183 delete iMainListAttributecontext; |
185 iMainListAttributecontext = NULL; |
184 iMainListAttributecontext = NULL; |
186 } |
185 } |
187 if( IsVisible() ) |
186 if( IsVisible() ) |
188 { |
187 { |
189 MakeVisible(EFalse); |
188 MakeVisible(EFalse); |
190 } |
189 } |
191 iTextSetter.Close(); |
190 iTextSetter.Close(); |
192 iTagSetter.Close(); |
191 iTagSetter.Close(); |
193 iAlbumSetter.Close(); |
192 iAlbumSetter.Close(); |
194 if(iAsyncRequest) |
193 |
195 { |
194 if(iUri) |
196 delete iAsyncRequest; |
195 { |
197 } |
196 delete iUri; |
198 if(iModifiedUri) |
197 iUri = NULL; |
199 { |
|
200 delete iModifiedUri; |
|
201 } |
198 } |
202 } |
199 } |
203 |
200 |
204 //----------------------------------------------------------------------------- |
201 //----------------------------------------------------------------------------- |
205 // CGlxMetadataContainer::MediaList |
202 // CGlxMetadataContainer::MediaList |
206 //----------------------------------------------------------------------------- |
203 //----------------------------------------------------------------------------- |
207 MGlxMediaList& CGlxMetadataContainer::MediaList() |
204 MGlxMediaList& CGlxMetadataContainer::MediaList() |
208 { |
205 { |
209 //returns the active medialist. |
206 //returns the active medialist. |
210 return *iItemMediaList; |
207 return *iItemMediaList; |
211 } |
208 } |
212 |
209 |
213 //----------------------------------------------------------------------------- |
210 //----------------------------------------------------------------------------- |
214 // CGlxMetadataContainer::CreateSettingItemL |
211 // CGlxMetadataContainer::CreateSettingItemL |
215 //----------------------------------------------------------------------------- |
212 //----------------------------------------------------------------------------- |
216 CAknSettingItem* CGlxMetadataContainer::CreateSettingItemL(TInt aResourceId) |
213 CAknSettingItem* CGlxMetadataContainer::CreateSettingItemL(TInt aResourceId) |
217 { |
214 { |
218 TRACER("CGlxMetadataContainer::CreateSettingItemL"); |
215 TRACER("CGlxMetadataContainer::CreateSettingItemL"); |
219 CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack |
216 CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack |
220 iTextSetter.Zero(); |
217 iTextSetter.Zero(); |
221 |
218 |
222 //Creating a empty Settings list box which will be populated with metadata in handleattributeavailable |
219 //Creating a empty Settings list box which will be populated with metadata in handleattributeavailable |
223 |
220 |
224 switch(aResourceId) |
221 switch(aResourceId) |
225 { |
222 { |
226 case ENameItem: |
223 case ENameItem: |
227 case EDateAndTimeItem: |
224 case EDateAndTimeItem: |
228 case EDescriptionItem: |
225 case EDescriptionItem: |
229 { |
226 { |
230 settingItem = new (ELeave) CAknTextSettingItem( |
227 settingItem = new (ELeave) CAknTextSettingItem( |
231 aResourceId, iTextSetter ); |
228 aResourceId, iTextSetter ); |
232 |
229 |
233 break; |
230 break; |
234 } |
231 } |
235 case ETagsItem: |
232 case ETagsItem: |
236 { |
233 { |
237 iTagSetter.Copy(KGlxTextSetter); |
234 iTagSetter.Copy(KGlxTextSetter); |
238 settingItem = new (ELeave) CAknTextSettingItem( |
235 settingItem = new (ELeave) CAknTextSettingItem( |
239 aResourceId, iTagSetter ); |
236 aResourceId, iTagSetter ); |
240 break; |
237 break; |
241 } |
238 } |
242 case EAlbumsItem: |
239 case EAlbumsItem: |
243 { |
240 { |
244 iAlbumSetter.Copy(KGlxTextSetter); |
241 iAlbumSetter.Copy(KGlxTextSetter); |
245 settingItem = new (ELeave) CAknTextSettingItem( |
242 settingItem = new (ELeave) CAknTextSettingItem( |
246 aResourceId, iAlbumSetter ); |
243 aResourceId, iAlbumSetter ); |
247 break; |
244 break; |
248 } |
245 } |
249 case ELocationItem: |
246 case ELocationItem: |
250 case ESizeItem: |
247 case ESizeItem: |
251 case EResolutionItem: |
248 case EResolutionItem: |
252 { |
249 { |
253 settingItem = new (ELeave) CAknTextSettingItem( |
250 settingItem = new (ELeave) CAknTextSettingItem( |
254 aResourceId, iTextSetter ); |
251 aResourceId, iTextSetter ); |
255 |
252 |
346 // CGlxMetadataContainer::HandleListboxChangesL |
343 // CGlxMetadataContainer::HandleListboxChangesL |
347 //----------------------------------------------------------------------------- |
344 //----------------------------------------------------------------------------- |
348 void CGlxMetadataContainer::HandleListboxChangesL() |
345 void CGlxMetadataContainer::HandleListboxChangesL() |
349 { |
346 { |
350 TRACER("CGlxMetadataContainer::HandleListboxChangesL"); |
347 TRACER("CGlxMetadataContainer::HandleListboxChangesL"); |
351 if(iItemMediaList->Count() == 0) |
348 |
|
349 //dont Edit Item's details if medialist is empty |
|
350 //OR Rename command is in progress |
|
351 if(iItemMediaList->Count() == 0 || iRenameStarted) |
352 { |
352 { |
|
353 GLX_LOG_INFO("MediaList empty or Rename command started"); |
353 return; |
354 return; |
354 } |
355 } |
355 |
356 |
356 TInt index = ListBox()->CurrentItemIndex(); |
357 TInt index = ListBox()->CurrentItemIndex(); |
357 |
358 |
358 switch(index) |
359 switch(index) |
359 { |
360 { |
360 case ENameItem: |
361 case ENameItem: |
361 case EDescriptionItem: |
362 case EDescriptionItem: |
362 { |
363 { |
363 SetNameDescriptionL(index); |
364 SetNameDescriptionL(index); |
364 break; |
365 break; |
365 } |
366 } |
366 case ETagsItem: |
367 case ETagsItem: |
367 { |
368 { |
368 //Set the focus of the item |
369 //Set the focus of the item |
369 iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0); |
370 iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0); |
370 //Launch add to container commandhandler via dialog observer. |
371 //Launch add to container commandhandler via dialog observer. |
371 iDialogObesrver.AddTagL(); |
372 iDialogObesrver.AddTagL(); |
372 break; |
373 break; |
373 } |
374 } |
374 case EAlbumsItem: |
375 case EAlbumsItem: |
375 { |
376 { |
376 //Set the focus of the item |
377 //Set the focus of the item |
377 iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0); |
378 iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0); |
378 //Launch add to container commandhandler via dialog observer. |
379 //Launch add to container commandhandler via dialog observer. |
379 iDialogObesrver.AddAlbumL(); |
380 iDialogObesrver.AddAlbumL(); |
380 break; |
381 break; |
381 } |
382 } |
382 case ELocationItem: |
383 case ELocationItem: |
383 { |
384 { |
384 // Get the Media Item |
385 // Get the Media Item |
385 const TGlxMedia& media = iItemMediaList->Item(0); |
386 const TGlxMedia& media = iItemMediaList->Item(0); |
386 // Test to see if the Coordinate is Present |
387 // Test to see if the Coordinate is Present |
387 TCoordinate coordinate; |
388 TCoordinate coordinate; |
388 if( !media.GetCoordinate(coordinate) ) |
389 if( !media.GetCoordinate(coordinate) ) |
389 { |
390 { |
390 HBufC *noLocationBuf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_INFO_NO_LOCATION); |
391 HBufC *noLocationBuf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_INFO_NO_LOCATION); |
401 break; |
402 break; |
402 } |
403 } |
403 } |
404 } |
404 case ElicenseItem: |
405 case ElicenseItem: |
405 { |
406 { |
406 //Create DRM utility |
407 const TGlxMedia& item = iItemMediaList->Item(0); |
407 CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL(); |
408 if( item.IsDrmProtected()) |
408 CleanupClosePushL(*drmUtility); |
409 { |
409 drmUtility->ShowDRMDetailsPaneL(iItemMediaList->Item(0).Uri()); |
410 //Create DRM utility |
410 CleanupStack::PopAndDestroy(drmUtility); |
411 CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL(); |
411 } |
412 CleanupClosePushL(*drmUtility); |
|
413 drmUtility->ShowDRMDetailsPaneL(item.Uri()); |
|
414 CleanupStack::PopAndDestroy(drmUtility); |
|
415 } |
|
416 } |
412 break; |
417 break; |
413 default: |
418 default: |
414 { |
419 { |
415 break; |
420 break; |
416 } |
421 } |
417 } |
422 } |
418 } |
423 } |
419 //----------------------------------------------------------------------------- |
424 //----------------------------------------------------------------------------- |
420 // CGlxMetadataContainer::CreateMediaListForSelectedItemL |
425 // CGlxMetadataContainer::CreateMediaListForSelectedItemL |
421 //----------------------------------------------------------------------------- |
426 //----------------------------------------------------------------------------- |
422 void CGlxMetadataContainer::CreateMediaListForSelectedItemL(TBool aIsRename) |
427 void CGlxMetadataContainer::CreateMediaListForSelectedItemL( ) |
423 { |
428 { |
424 TRACER("CGlxMetadataContainer::CreateMediaListForSelectedItemL"); |
429 TRACER("CGlxMetadataContainer::CreateMediaListForSelectedItemL"); |
425 |
430 |
426 //create the collection path for the medialist to be created |
431 //create the collection path for the medialist to be created |
427 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
432 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
428 CleanupStack::PushL( path ); |
433 CleanupStack::PushL( path ); |
429 //set the all collection path as the details dialog can be launched from any of the grid views and filter with URI |
434 //set the all collection path as the details dialog can be launched from any of the grid views and filter with URI |
430 path->AppendL(KGlxCollectionPluginAllImplementationUid); |
435 path->AppendL(KGlxCollectionPluginAllImplementationUid); |
431 //create the filter with the URI |
436 //create the filter with the URI |
432 CMPXFilter* filter = NULL; |
437 CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(*iUri); |
433 if(aIsRename) |
438 CleanupStack::PushL( filter ); |
434 { |
439 //create the medialist |
435 //create the filter with the modified URI after Rename happens |
440 iItemMediaList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(KMediaListId),filter); |
436 filter = TGlxFilterFactory::CreateURIFilterL(iModifiedUri->Des()); |
441 |
437 } |
|
438 else |
|
439 { |
|
440 filter = TGlxFilterFactory::CreateURIFilterL(iUri); |
|
441 } |
|
442 CleanupStack::PushL( filter ); |
|
443 //create the medialist |
|
444 iItemMediaList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(KMediaListId),filter); |
|
445 |
|
446 //Add the attributes which are required to be displayed. |
442 //Add the attributes which are required to be displayed. |
447 iMainListAttributecontext = new (ELeave) CGlxAttributeContext(&iSelectionIterator); |
443 iMainListAttributecontext = new (ELeave) CGlxAttributeContext(&iSelectionIterator); |
448 iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected); |
444 iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected); |
449 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralCategory); |
445 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralCategory); |
450 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize); |
446 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize); |
824 //Modify the MDS and setting list only if the entry is different from previous Item value |
828 //Modify the MDS and setting list only if the entry is different from previous Item value |
825 iTextSetter.Zero(); |
829 iTextSetter.Zero(); |
826 iTextSetter.Copy(*textBuf); |
830 iTextSetter.Copy(*textBuf); |
827 EditItemL(aItem,EFalse); |
831 EditItemL(aItem,EFalse); |
828 iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item |
832 iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item |
829 CMPXCollectionPath* path = iItemMediaList->PathLC(); |
833 |
830 CMPXCommand* command = NULL; |
|
831 //Create the glx command based on the item |
|
832 if(aItem == ENameItem) |
834 if(aItem == ENameItem) |
833 { |
835 { |
834 command = TGlxCommandFactory::RenameCommandLC(settingsitem->SettingTextL(), |
836 //indicate Rename command is started |
835 *path); |
837 iRenameStarted = ETrue; |
|
838 //set Setting List Box to Dimmed status |
|
839 SetDimmed(iRenameStarted); |
|
840 |
|
841 const TGlxMedia& media = iItemMediaList->Item(0); |
|
842 ContentAccess::CManager *manager = ContentAccess::CManager::NewL(); |
|
843 CleanupStack::PushL(manager); |
|
844 HBufC* modifiedName = fileName.AllocLC(); |
|
845 |
|
846 //rename the media |
|
847 TInt error = manager->RenameFile(media.Uri(), *modifiedName); |
|
848 if(KErrNone == error) |
|
849 { |
|
850 //Redundant call But needed in case FileSystem is too slow |
|
851 //to notify MDS for updating title. |
|
852 //Create the glx command for updating Title in MDS |
|
853 CMPXCollectionPath* path = iItemMediaList->PathLC(); |
|
854 CMPXCommand* command = TGlxCommandFactory::RenameCommandLC( |
|
855 settingsitem->SettingTextL(), *path); |
|
856 command->SetTObjectValueL<TAny*> ( |
|
857 KMPXCommandGeneralSessionId, |
|
858 static_cast<TAny*> (this)); |
|
859 //issue command to the medialist which further |
|
860 //calls data source to update MDS |
|
861 iItemMediaList->CommandL(*command); |
|
862 CleanupStack::PopAndDestroy(command); |
|
863 CleanupStack::PopAndDestroy(path); |
|
864 } |
|
865 else |
|
866 { |
|
867 //Renaming commmand failed |
|
868 iRenameStarted = EFalse; |
|
869 //reset Setting Items to undim status |
|
870 SetDimmed(iRenameStarted); |
|
871 //Reset the EName Settings field |
|
872 iTextSetter.Zero(); |
|
873 iTextSetter.Copy(media.Title()); |
|
874 EditItemL(ENameItem,EFalse); |
|
875 |
|
876 User::LeaveIfError(error); |
|
877 } |
|
878 CleanupStack::PopAndDestroy(modifiedName); |
|
879 CleanupStack::PopAndDestroy(manager); |
836 } |
880 } |
837 else |
881 else |
838 { |
882 { |
839 command = TGlxCommandFactory::SetDescriptionCommandLC(settingsitem->SettingTextL(), |
883 //Create the glx command for changing description |
840 *path); |
884 CMPXCollectionPath* path = iItemMediaList->PathLC(); |
|
885 CMPXCommand* command = |
|
886 TGlxCommandFactory::SetDescriptionCommandLC( |
|
887 settingsitem->SettingTextL(), *path); |
|
888 command->SetTObjectValueL<TAny*> ( |
|
889 KMPXCommandGeneralSessionId, |
|
890 static_cast<TAny*> (this)); |
|
891 //issue command to the medialist which further |
|
892 //calls data source to update MDS |
|
893 iItemMediaList->CommandL(*command); |
|
894 CleanupStack::PopAndDestroy(command); |
|
895 CleanupStack::PopAndDestroy(path); |
841 } |
896 } |
842 command->SetTObjectValueL<TAny*>(KMPXCommandGeneralSessionId, static_cast<TAny*>(this)); |
897 |
843 //issue command to the medialist which further calls data source to update MDS |
|
844 iItemMediaList->CommandL(*command); |
|
845 CleanupStack::PopAndDestroy(command); |
|
846 CleanupStack::PopAndDestroy(path); |
|
847 } |
898 } |
848 } |
899 } |
849 } |
900 } |
850 CleanupStack::PopAndDestroy( textBuf ); |
901 CleanupStack::PopAndDestroy( textBuf ); |
851 |
902 |
1300 |
1375 |
1301 return destinationFileName; |
1376 return destinationFileName; |
1302 } |
1377 } |
1303 |
1378 |
1304 // --------------------------------------------------------------------------- |
1379 // --------------------------------------------------------------------------- |
1305 // Create new MediaList with modified FileName. |
1380 // Refresh MediaList with modified FileName. |
1306 // --------------------------------------------------------------------------- |
1381 // --------------------------------------------------------------------------- |
1307 void CGlxMetadataContainer::RefreshMediaListL() |
1382 void CGlxMetadataContainer::RefreshMediaListL(const TDesC& aModifiedUri) |
1308 { |
1383 { |
|
1384 //Refresh media list since media is renamed |
1309 TRACER("CGlxMetadataContainer::RefreshMediaList()"); |
1385 TRACER("CGlxMetadataContainer::RefreshMediaList()"); |
1310 if (iItemMediaList) |
1386 if (iUri) |
1311 { |
1387 { |
1312 iItemMediaList->RemoveContext(iMainListAttributecontext); |
1388 delete iUri; |
1313 iItemMediaList->RemoveMediaListObserver(this); |
1389 iUri = NULL; |
1314 iItemMediaList->Close(); |
1390 } |
1315 iItemMediaList = NULL; |
1391 //always points to current media name |
1316 if (iMainListAttributecontext) |
1392 iUri = aModifiedUri.AllocL(); |
1317 { |
1393 CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(*iUri); |
1318 delete iMainListAttributecontext; |
1394 CleanupStack::PushL(filter); |
1319 iMainListAttributecontext = NULL; |
1395 |
1320 } |
1396 //Update media list's filter |
1321 CreateMediaListForSelectedItemL(ETrue); |
1397 iItemMediaList->SetFilterL(filter); |
1322 } |
1398 CleanupStack::PopAndDestroy(filter); |
1323 iRenameCompleted = ETrue; |
1399 } |
1324 } |
1400 |
1325 |
|
1326 // --------------------------------------------------------------------------- |
|
1327 // Completes the active object causing a call from the active scheduler to RunL() |
|
1328 // --------------------------------------------------------------------------- |
|
1329 // |
|
1330 void CGlxMetadataAsyncUpdate::CompleteSelf() |
|
1331 { |
|
1332 TRACER("CGlxMetadataAsyncUpdate::CompleteSelf"); |
|
1333 TRequestStatus* status=&iStatus; |
|
1334 User::RequestComplete(status, KErrNone); |
|
1335 SetActive(); |
|
1336 } |
|
1337 |
|
1338 // ----------------------------------------------------------------------------- |
|
1339 // RunL |
|
1340 // ----------------------------------------------------------------------------- |
|
1341 // |
|
1342 void CGlxMetadataAsyncUpdate::RunL() |
|
1343 { |
|
1344 TRACER("CGlxMetadataAsyncUpdate::RunL"); |
|
1345 if(iStatus.Int() == KErrNone) |
|
1346 { |
|
1347 iObserver.RefreshMediaListL(); |
|
1348 } |
|
1349 } |
|
1350 |
|
1351 // ----------------------------------------------------------------------------- |
|
1352 // DoCancel |
|
1353 // ----------------------------------------------------------------------------- |
|
1354 // |
|
1355 void CGlxMetadataAsyncUpdate::DoCancel() |
|
1356 { |
|
1357 TRACER("CGlxMetadataAsyncUpdate::DoCancel"); |
|
1358 // No need to do anything |
|
1359 } |
|
1360 |
|
1361 // --------------------------------------------------------- |
|
1362 // NewL |
|
1363 // --------------------------------------------------------- |
|
1364 // |
|
1365 CGlxMetadataAsyncUpdate* CGlxMetadataAsyncUpdate::NewL(CGlxMetadataContainer& aObserver) |
|
1366 { |
|
1367 TRACER("CGlxMetadataAsyncUpdate::NewL"); |
|
1368 CGlxMetadataAsyncUpdate* self = CGlxMetadataAsyncUpdate::NewLC(aObserver); |
|
1369 CleanupStack::Pop(self); |
|
1370 return self; |
|
1371 } |
|
1372 |
|
1373 // --------------------------------------------------------- |
|
1374 // NewLC |
|
1375 // --------------------------------------------------------- |
|
1376 // |
|
1377 CGlxMetadataAsyncUpdate* CGlxMetadataAsyncUpdate::NewLC(CGlxMetadataContainer& aObserver) |
|
1378 { |
|
1379 TRACER("CGlxMetadataAsyncUpdate::NewLC"); |
|
1380 CGlxMetadataAsyncUpdate* self = new(ELeave) CGlxMetadataAsyncUpdate(aObserver); |
|
1381 CleanupStack::PushL(self); |
|
1382 return self; |
|
1383 } |
|
1384 |
|
1385 // --------------------------------------------------------- |
|
1386 // Constructor |
|
1387 // --------------------------------------------------------- |
|
1388 // |
|
1389 CGlxMetadataAsyncUpdate::CGlxMetadataAsyncUpdate(CGlxMetadataContainer& aObserver): |
|
1390 CActive(EPriorityStandard),iObserver(aObserver) |
|
1391 { |
|
1392 TRACER("CGlxMetadataAsyncUpdate::CGlxMetadataAsyncUpdate()"); |
|
1393 CActiveScheduler::Add(this); |
|
1394 } |
|
1395 |
|
1396 // --------------------------------------------------------- |
|
1397 // Destructor |
|
1398 // --------------------------------------------------------- |
|
1399 // |
|
1400 CGlxMetadataAsyncUpdate::~CGlxMetadataAsyncUpdate() |
|
1401 { |
|
1402 TRACER("CGlxMetadataAsyncUpdate::~CGlxMetadataAsyncUpdate"); |
|
1403 Cancel(); |
|
1404 } |
|
1405 //End of file |
1401 //End of file |