photosgallery/viewframework/views/metadatadialog/src/glxmetadatacontainer.cpp
branchRCL_3
changeset 24 ea65f74e6de4
parent 17 a60acebbbd9d
equal deleted inserted replaced
23:b023a8d2866a 24:ea65f74e6de4
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include  "glxmetadatacontainer.h"
    18 #include  "glxmetadatacontainer.h"
    19 #include  "glxustringconverter.h"        		 // converts the symbian types to UString type
    19 #include  "glxustringconverter.h"        		 // converts the symbian types to UString type
    20 #include  <AknUtils.h>
    20 #include  "mglxmetadatadialogobserver.h"
       
    21 
    21 #include  <StringLoader.h>
    22 #include  <StringLoader.h>
       
    23 #include  <caf/manager.h>                         // For Filesystem
       
    24 #include  <ExifModify.h>                          // For CExifModify 
       
    25 #include  <mpxcommandgeneraldefs.h>               // Content ID identifying general category of content provided
       
    26 #include  <mpxmediadrmdefs.h>
       
    27 #include  <eikfrlb.h>                             // For marquee  
       
    28 #include  <eikfrlbd.h>                            // For marquee
       
    29 
    22 #include  <glxmetadatadialog.rsg>
    30 #include  <glxmetadatadialog.rsg>
    23 #include  <glxviewbase.rsg>
       
    24 #include  <glxlog.h>
       
    25 #include  <glxtracer.h>
       
    26 #include  <glxscreenfurniture.h>
    31 #include  <glxscreenfurniture.h>
    27 #include  <glxdetailsmulmodelprovider.h>  		  //Details data provider
       
    28 #include  <glxdetailsboundcommand.hrh>
    32 #include  <glxdetailsboundcommand.hrh>
    29 #include  <glxcommandhandleraddtocontainer.h>     // For CGlxCommandHandlerAddToContainer
    33 #include  <glxcommandhandleraddtocontainer.h>     // For CGlxCommandHandlerAddToContainer
    30 #include  <glxcommandhandlers.hrh>                // for command handler id
    34 #include  <glxcommandhandlers.hrh>                // for command handler id
    31 #include  <glxcommandfactory.h>                   //for command factory
    35 #include  <glxcommandfactory.h>                   // for command factory
    32 #include  <mpxcommandgeneraldefs.h>               // Content ID identifying general category of content provided
       
    33 #include  "mglxmetadatadialogobserver.h"
       
    34 #include  <glxtextentrypopup.h>
    36 #include  <glxtextentrypopup.h>
    35 #include  <glxcollectionpluginall.hrh>
       
    36 #include  <glxuistd.h>
    37 #include  <glxuistd.h>
    37 #include  <glxcollectionplugintags.hrh>       	  // tag collection plugin uid
    38 #include  <glxcollectionplugintags.hrh>       	  // tag collection plugin uid
    38 #include  <glxthumbnailattributeinfo.h>           // KGlxMediaIdThumbnail
       
    39 #include  <glxattributeretriever.h>               // CGlxAttributeReteiver
    39 #include  <glxattributeretriever.h>               // CGlxAttributeReteiver
    40 #include  <aknQueryControl.h>
    40 #include  <glxdrmutility.h>                       // For launching DRM details pane
    41 #include  <glxdrmutility.h>                       //For launching DRM details pane
       
    42 #include  <glxgeneraluiutilities.h>               // General utilties class definition
    41 #include  <glxgeneraluiutilities.h>               // General utilties class definition
    43 #include  <ExifModify.h>
    42 #include  <glxuiutilities.rsg>                    
    44 #include  <glxuiutilities.rsg>                    //For CExifModify
       
    45 #include  <mpxmediadrmdefs.h>
       
    46 #include  <glxfilterfactory.h>
    43 #include  <glxfilterfactory.h>
    47 #include  <caf/manager.h>						  //For Filesystem
    44 #include  <glxlog.h>
    48 
    45 #include  <glxtracer.h>
    49 //marquee
    46 #include <glxgeneraluiutilities.h>
    50 
    47 
    51 #include <eikfrlb.h>
       
    52 #include <eikfrlbd.h>
       
    53 const TInt KMaxMediaPopupTitleLength = 0x100;
       
    54 const TInt KMediaListId  			 = 0x2000D248;
    48 const TInt KMediaListId  			 = 0x2000D248;
    55 const TInt KOffsets					 = 50;
    49 const TInt KOffsets					 = 50;
    56 const TInt KMarqueeLoopCount         = 3;
    50 const TInt KMarqueeLoopCount         = 3;
    57 const TInt KMarqueeScrollAmount      = 20;
    51 const TInt KMarqueeScrollAmount      = 20;
    58 const TInt KMarqueeScrollDelay       = 1000000;
    52 const TInt KMarqueeScrollDelay       = 1000000;
    59 const TInt KMarqueeScrollInterval    = 200000;
    53 const TInt KMarqueeScrollInterval    = 200000;
    60 _LIT( KGlxTextSetter, "");
    54 
    61 _LIT( KGlxComma, ",");
    55 _LIT( KGlxComma, ",");
    62 
    56 
    63 // ============================ MEMBER FUNCTIONS ===============================
    57 // ============================ MEMBER FUNCTIONS ===============================
    64 
    58 
    65 // ---------------------------------------------------------
    59 // ---------------------------------------------------------
    66 // NewL
    60 // NewL
    67 // ---------------------------------------------------------
    61 // ---------------------------------------------------------
    68 //
    62 //
    69 CGlxMetadataContainer* CGlxMetadataContainer::NewL( const TRect& aRect,
    63 CGlxMetadataContainer* CGlxMetadataContainer::NewL(const TRect& aRect,
    70                                                     MGlxMetadataDialogObserver& aDialogObserver,
    64         MGlxMetadataDialogObserver& aDialogObserver, const TDesC& item,
    71                                                     const TDesC& item,MToolbarResetObserver& aResetToolbarObs)
    65         MToolbarResetObserver& aResetToolbarObs)
    72 	{
    66     {
    73 	TRACER("CGlxMetadataContainer::NewL");
    67     TRACER("CGlxMetadataContainer::NewL");
    74 	CGlxMetadataContainer* self = CGlxMetadataContainer::NewLC( aRect,
    68     CGlxMetadataContainer* self = CGlxMetadataContainer::NewLC(aRect,
    75                                                                 aDialogObserver,item,aResetToolbarObs);
    69             aDialogObserver, item, aResetToolbarObs);
    76 	CleanupStack::Pop(self);
    70     CleanupStack::Pop(self);
    77 	return self;
    71     return self;
    78 	}
    72     }
    79 
    73 
    80 // ---------------------------------------------------------
    74 // ---------------------------------------------------------
    81 // NewLC
    75 // NewLC
    82 // ---------------------------------------------------------
    76 // ---------------------------------------------------------
    83 //
    77 //
    84 CGlxMetadataContainer* CGlxMetadataContainer::NewLC( const TRect& aRect,
    78 CGlxMetadataContainer* CGlxMetadataContainer::NewLC(const TRect& aRect,
    85 													 MGlxMetadataDialogObserver&  aDialogObserver,
    79         MGlxMetadataDialogObserver& aDialogObserver, const TDesC& aUri,
    86 													 const TDesC& aUri,MToolbarResetObserver& aResetToolbarObs)
    80         MToolbarResetObserver& aResetToolbarObs)
    87 	{
    81     {
    88 	TRACER("CGlxMetadataContainer::NewLC");
    82     TRACER("CGlxMetadataContainer::NewLC");
    89 	CGlxMetadataContainer* self = new(ELeave) CGlxMetadataContainer(aDialogObserver, aResetToolbarObs);
    83     CGlxMetadataContainer* self = new (ELeave) CGlxMetadataContainer(
    90 	CleanupStack::PushL(self);
    84             aDialogObserver, aResetToolbarObs);
    91 	self->ConstructL( aRect, aUri);
    85     CleanupStack::PushL(self);
    92 	return self;
    86     self->ConstructL(aRect, aUri);
    93 	}
    87     return self;
       
    88     }
    94 
    89 
    95 // ---------------------------------------------------------
    90 // ---------------------------------------------------------
    96 // CGlxMetadataContainer
    91 // CGlxMetadataContainer
    97 // ---------------------------------------------------------
    92 // ---------------------------------------------------------
    98 //
    93 //
    99 CGlxMetadataContainer::CGlxMetadataContainer(MGlxMetadataDialogObserver& aDialogObserver,
    94 CGlxMetadataContainer::CGlxMetadataContainer(
   100                                               MToolbarResetObserver& aResetToolbarObs)
    95         MGlxMetadataDialogObserver& aDialogObserver,
   101 					  :iDialogObesrver ( aDialogObserver ),iResetToolbarObs(aResetToolbarObs)
    96         MToolbarResetObserver& aResetToolbarObs) :
       
    97     iDialogObesrver(aDialogObserver), iResetToolbarObs(aResetToolbarObs)
   102     {
    98     {
   103     // No implementation
    99     // No implementation
   104     }
   100     }
   105 
   101 
   106 // ---------------------------------------------------------
   102 // ---------------------------------------------------------
   107 // CGlxMetadataContainer::ConstructL
   103 // CGlxMetadataContainer::ConstructL
   108 // ---------------------------------------------------------
   104 // ---------------------------------------------------------
   109 //
   105 //
   110 void CGlxMetadataContainer::ConstructL( const TRect& /*aRect*/ , const TDesC& aUri)
   106 void CGlxMetadataContainer::ConstructL(const TRect& /*aRect*/,
   111 	{
   107         const TDesC& aUri)
   112 
   108     {
   113 	//media's uri
   109     TRACER("CGlxMetadataContainer::ConstructL");
   114 	iUri = aUri.AllocL();
   110 
   115 
   111     //media's uri
   116 	//Creating the RBuf texts for all the items except tags & albums
   112     iUri = aUri.AllocL();
   117 	//which would be updated as whne the item is edited
   113 
   118 	iTextSetter.CreateL(KMaxFileName);
   114     //Creating the RBuf texts for all the items except tags & albums
   119 
   115     //which would be updated as whne the item is edited
   120 	//RBuf text which would be updated as when a tag is edited for the item.
   116     iTextSetter.CreateL(KMaxFileName);
   121 	iTagSetter.CreateL(KMaxFileName);
   117 
   122 
   118     //RBuf text which would be updated as when a tag is edited for the item.
   123 	//RBuf text which would be updated as when a album is edited for the item.
   119     iTagSetter.CreateL(KMaxFileName);
   124 	iAlbumSetter.CreateL(KMaxFileName);
   120 
   125 
   121     //RBuf text which would be updated as when a album is edited for the item.
   126 	//Create medialist filtered by uri - iUri
   122     iAlbumSetter.CreateL(KMaxFileName);
   127 	CreateMediaListForSelectedItemL();
   123 
   128 
   124     //Create medialist filtered by uri - iUri
   129 	//Setting the iVideo flag to EFalse initially
   125     CreateMediaListForSelectedItemL();
   130 	iVideo = EFalse;
   126 
   131 
   127     //Setting the iVideo flag to EFalse initially
   132 	//Setting the iMarquee flag to EFalse initially
   128     iVideo = EFalse;
       
   129 
       
   130     //Setting the iMarquee flag to EFalse initially
   133     iMarquee = EFalse;
   131     iMarquee = EFalse;
   134 
   132 
   135     //check when Remove location information is selected.
   133     //check when Remove location information is selected.
   136     iLocationinfo = EFalse;
   134     iLocationinfo = EFalse;
   137 
   135 
   138 	//Flag to indicate rename command is started
   136     //Flag to indicate rename command is started
   139 	iRenameStarted = EFalse;
   137     iRenameStarted = EFalse;
   140 
   138     }
   141 	}
       
   142 
   139 
   143 // ---------------------------------------------------------
   140 // ---------------------------------------------------------
   144 // ~CGlxMetadataContainer
   141 // ~CGlxMetadataContainer
   145 // ---------------------------------------------------------
   142 // ---------------------------------------------------------
   146 //
   143 //
   212 //-----------------------------------------------------------------------------
   209 //-----------------------------------------------------------------------------
   213 CAknSettingItem* CGlxMetadataContainer::CreateSettingItemL(TInt aResourceId)
   210 CAknSettingItem* CGlxMetadataContainer::CreateSettingItemL(TInt aResourceId)
   214     {
   211     {
   215     TRACER("CGlxMetadataContainer::CreateSettingItemL");
   212     TRACER("CGlxMetadataContainer::CreateSettingItemL");
   216     CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack
   213     CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack
   217 	iTextSetter.Zero();
   214     iTextSetter.Zero();
   218 
   215 
   219     //Creating a empty Settings list box which will  be populated with metadata in handleattributeavailable
   216     // Creating a empty Settings list box which will  be populated 
   220 
   217     // with metadata in handleattributeavailable
   221     switch(aResourceId)
   218     switch (aResourceId)
   222         {
   219         {
   223         case ENameItem:
   220         case ENameItem:
   224         case EDateAndTimeItem:
   221         case EDateAndTimeItem:
   225         case EDescriptionItem:
   222         case EDescriptionItem:
   226             {
   223             {
   227             settingItem = new (ELeave) CAknTextSettingItem(
   224             settingItem = new (ELeave) CAknTextSettingItem(aResourceId,
   228                                              aResourceId, iTextSetter );
   225                     iTextSetter);
   229 
   226 
   230             break;
   227             break;
   231             }
   228             }
   232         case ETagsItem:
   229         case ETagsItem:
   233             {
   230             {
   234              iTagSetter.Copy(KGlxTextSetter);
   231             settingItem = new (ELeave) CAknTextSettingItem(aResourceId,
   235              settingItem = new (ELeave) CAknTextSettingItem(
   232                     iTagSetter);
   236                                                              aResourceId, iTagSetter );
       
   237             break;
   233             break;
   238             }
   234             }
   239         case EAlbumsItem:
   235         case EAlbumsItem:
   240             {
   236             {
   241             iAlbumSetter.Copy(KGlxTextSetter);
   237             settingItem = new (ELeave) CAknTextSettingItem(aResourceId,
   242             settingItem = new (ELeave) CAknTextSettingItem(
   238                     iAlbumSetter);
   243                                                   aResourceId, iAlbumSetter );
       
   244             break;
   239             break;
   245             }
   240             }
   246         case ELocationItem:
   241         case ELocationItem:
   247         case ESizeItem:
   242         case ESizeItem:
   248         case EResolutionItem:
   243         case EResolutionItem:
   249             {
   244             {
   250             settingItem = new (ELeave) CAknTextSettingItem( 
   245             settingItem = new (ELeave) CAknTextSettingItem(aResourceId,
   251                                                   aResourceId, iTextSetter );
   246                     iTextSetter);
   252             
   247 
   253             break;          
   248             break;
   254             }            
   249             }
   255         case EDurationItem:
   250         case EDurationItem:
   256         case ElicenseItem:
   251         case ElicenseItem:
   257             {
   252             {
   258               settingItem = new (ELeave) CAknTextSettingItem( 
   253             settingItem = new (ELeave) CAknTextSettingItem(aResourceId,
   259                                                          aResourceId, iTextSetter );
   254                     iTextSetter);
   260 							//Hide the item until we get the attributes
   255             //Hide the item until we get the attributes
   261 							//where in we check for the usage rights.                                                                                                            
   256             //where in we check for the usage rights.                                                                                                            
   262               settingItem->SetHidden(ETrue);
   257             settingItem->SetHidden(ETrue);
   263               //Required to refresh the listbox when any items visiblity is changed
   258             //Required to refresh the listbox when any items visiblity is changed
   264               this->HandleChangeInItemArrayOrVisibilityL();
   259             this->HandleChangeInItemArrayOrVisibilityL();
   265              }
   260             }
   266             break;
   261             break;
   267            
   262 
   268         default:
   263         default:
   269             {
   264             {
   270             break;    
   265             break;
   271             }
   266             }
   272         }
   267         }
   273     return settingItem;
   268     return settingItem;
   274     }
   269     }
       
   270 
   275 //-----------------------------------------------------------------------------
   271 //-----------------------------------------------------------------------------
   276 // CGlxMetadataContainer::IsItemModifiable
   272 // CGlxMetadataContainer::IsItemModifiable
   277 //-----------------------------------------------------------------------------
   273 //-----------------------------------------------------------------------------
   278 TBool CGlxMetadataContainer::IsItemModifiable()
   274 TBool CGlxMetadataContainer::IsItemModifiable()
   279     {
   275     {
       
   276     TRACER("CGlxMetadataContainer::IsItemModifiable");   
   280     //Only items like name , description, tag and albums are modifiable
   277     //Only items like name , description, tag and albums are modifiable
   281     //The check is for the items from ENameItem(0) tille ETagsItem(4)
   278     //The check is for the items from ENameItem(0) tille ETagsItem(4)
   282     if(ListBox()->CurrentItemIndex()<=ETagsItem)
   279     if(ListBox()->CurrentItemIndex()<=ETagsItem)
   283         {
   280         {
   284         return EFalse;
   281         return EFalse;
   285         }
   282         }
   286     //return ETrue to dim the item
   283     //return ETrue to dim the item
   287     return ETrue;
   284     return ETrue;
   288     
   285     }
   289     }
   286 
   290 //-----------------------------------------------------------------------------
       
   291 // CGlxMetadataContainer::IsLicenseItem
       
   292 //-----------------------------------------------------------------------------
       
   293 TBool CGlxMetadataContainer::IsLicenseItem()
       
   294     {
       
   295     //Checks the item for DRMProtection.
       
   296     //if item is a video item index should be ELicense else check for EDuration Item.
       
   297     //because License Item index would become EDuration as the duration item is hidden in case of inage file.
       
   298     if((!iVideo && ListBox()->CurrentItemIndex()== EDurationItem) 
       
   299             || (ListBox()->CurrentItemIndex()== ElicenseItem))
       
   300         {
       
   301         return EFalse;
       
   302         }
       
   303     return ETrue;
       
   304     }
       
   305     
       
   306 //-----------------------------------------------------------------------------
   287 //-----------------------------------------------------------------------------
   307 // CGlxMetadataContainer::IsLocationItem
   288 // CGlxMetadataContainer::IsLocationItem
   308 //-----------------------------------------------------------------------------
   289 //-----------------------------------------------------------------------------
   309 TBool CGlxMetadataContainer::IsLocationItem()
   290 TBool CGlxMetadataContainer::IsLocationItem()
   310     {
   291     {
       
   292     TRACER("CGlxMetadataContainer::IsLocationItem");
   311     //if its location item - enable the delete option
   293     //if its location item - enable the delete option
   312     if (iItemMediaList->Count() && ListBox()->CurrentItemIndex()
   294     if (iItemMediaList->Count() && ListBox()->CurrentItemIndex()
   313             == ELocationItem)
   295             == ELocationItem)
   314         {
   296         {
   315         const TGlxMedia& item = iItemMediaList->Item(0);
   297         const TGlxMedia& item = iItemMediaList->Item(0);
   346     {
   328     {
   347     TRACER("CGlxMetadataContainer::HandleListboxChangesL");
   329     TRACER("CGlxMetadataContainer::HandleListboxChangesL");
   348 
   330 
   349     //dont Edit Item's details if medialist is empty
   331     //dont Edit Item's details if medialist is empty
   350     //OR Rename command is in progress
   332     //OR Rename command is in progress
   351     if(iItemMediaList->Count() == 0 || iRenameStarted)
   333     if (iItemMediaList->Count() == 0 || iRenameStarted)
   352     	{
   334         {
   353 		GLX_LOG_INFO("MediaList empty or Rename command started");
   335         GLX_LOG_INFO("MediaList empty or Rename command started");
   354     	return;
   336         return;
   355     	}
   337         }
   356 
   338 
   357     TInt index = ListBox()->CurrentItemIndex();
   339     TInt index = ListBox()->CurrentItemIndex();
   358 
   340 
   359     switch(index)
   341     switch (index)
   360         {
   342         {
   361         case ENameItem:
   343         case ENameItem:
   362         case EDescriptionItem:
   344         case EDescriptionItem:
   363             {
   345             {
   364             SetNameDescriptionL(index);
   346             SetNameDescriptionL(index);
   365             break;
   347             break;
   366             }
   348             }
   367         case ETagsItem:
   349         case ETagsItem:
   368 			{
   350             {
   369 			//Set the focus of the item
   351             //Set the focus of the item
   370 			iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);
   352             iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0);
   371 			//Launch add to container commandhandler via dialog observer.
   353             //Launch add to container commandhandler via dialog observer.
   372 			iDialogObesrver.AddTagL();
   354             iDialogObesrver.AddTagL();
   373 			break;
   355             break;
   374 			}
   356             }
   375         case EAlbumsItem:
   357         case EAlbumsItem:
   376 			{
   358             {
   377 			//Set the focus of the item
   359             //Set the focus of the item
   378 			iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);
   360             iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0);
   379 			//Launch add to container commandhandler via dialog observer.
   361             //Launch add to container commandhandler via dialog observer.
   380 			iDialogObesrver.AddAlbumL();
   362             iDialogObesrver.AddAlbumL();
   381 			break;
   363             break;
   382 			}
   364             }
   383 		case ELocationItem:
   365         case ELocationItem:
   384 			{
   366             {
   385 			// Get the Media Item
   367             // Get the Media Item
   386 			const TGlxMedia& media = iItemMediaList->Item(0);
   368             const TGlxMedia& media = iItemMediaList->Item(0);
   387 			// Test to see if the Coordinate is Present
   369             // Test to see if the Coordinate is Present
   388 			TCoordinate coordinate;
   370             TCoordinate coordinate;
   389 			if( !media.GetCoordinate(coordinate) )
   371             if (!media.GetCoordinate(coordinate))
       
   372                 {
       
   373                 HBufC *noLocationBuf = StringLoader::LoadLC(
       
   374                         R_GLX_METADATA_NOTE_INFO_NO_LOCATION);
       
   375                 GlxGeneralUiUtilities::ShowInfoNoteL(*noLocationBuf, ETrue);
       
   376                 CleanupStack::PopAndDestroy(noLocationBuf);
       
   377                 }
       
   378 			else
   390 				{
   379 				{
   391 				HBufC *noLocationBuf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_INFO_NO_LOCATION);
   380 				CAknSettingItem* settingsitem = (*SettingItemArray())[index]; 
   392 				GlxGeneralUiUtilities::ShowInfoNoteL(*noLocationBuf,ETrue);
   381 			    GlxGeneralUiUtilities::ShowInfoNoteL(settingsitem->SettingTextL(),ETrue);
   393 				CleanupStack::PopAndDestroy(noLocationBuf);
       
   394 				}
   382 				}
   395 			break;
   383             break;
   396 			}
   384             }
   397         case EDurationItem:
   385         case EDurationItem:
   398 			{
   386             {
   399 			//This is condition is useful when the license item is selected for a image file
   387             //This is condition is useful when the license item is selected for a image file
   400 			if(iVideo)
   388             if (iVideo)
       
   389                 {
       
   390                 break;
       
   391                 }
       
   392             }
       
   393         case EResolutionItem:
       
   394         	{
       
   395 			//This is condition is useful when the license item is selected for a DRM Video file
       
   396 			if (!iVideo || !iItemMediaList->Item(0).IsDrmProtected())
   401 				{
   397 				{
   402 				break;
   398 				break;
   403 				}
   399 				}
   404 			}
   400 			}
   405         case ElicenseItem:
   401         case ElicenseItem:
   406 			{
   402             {
   407 		    const TGlxMedia& item = iItemMediaList->Item(0);
   403             const TGlxMedia& item = iItemMediaList->Item(0);
   408 		    if( item.IsDrmProtected())
   404             if (item.IsDrmProtected())
   409 		        {
   405                 {
   410                 //Create DRM utility
   406                 //Create DRM utility
   411                 CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL();
   407                 CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL();
   412                 CleanupClosePushL(*drmUtility);
   408                 CleanupClosePushL(*drmUtility);
   413                 drmUtility->ShowDRMDetailsPaneL(item.Uri());
   409 
       
   410                 // check if rights have expired
       
   411                 TBool expired = EFalse;
       
   412                 expired = !drmUtility->ItemRightsValidityCheckL(item.Uri(),
       
   413                         EMPXImage == item.Category());
       
   414 
       
   415                 if (expired)
       
   416                     {
       
   417                     drmUtility->ShowRightsInfoL(item.Uri());
       
   418                     }
       
   419                 else
       
   420                     {
       
   421                     drmUtility->ShowDRMDetailsPaneL(item.Uri());
       
   422                     }
   414                 CleanupStack::PopAndDestroy(drmUtility);
   423                 CleanupStack::PopAndDestroy(drmUtility);
   415 			    }
   424                 }
   416 			}
   425             }
   417 			break;
   426             break;
   418         default:
   427         default:
   419 			{
   428             {
   420 			break;    
   429             break;
   421 			}
   430             }
   422         }
   431         }
   423     }
   432     }
   424 //-----------------------------------------------------------------------------
   433 //-----------------------------------------------------------------------------
   425 // CGlxMetadataContainer::CreateMediaListForSelectedItemL
   434 // CGlxMetadataContainer::CreateMediaListForSelectedItemL
   426 //-----------------------------------------------------------------------------
   435 //-----------------------------------------------------------------------------
   427 void CGlxMetadataContainer::CreateMediaListForSelectedItemL( )
   436 void CGlxMetadataContainer::CreateMediaListForSelectedItemL( )
   428     {
   437     {
   429     TRACER("CGlxMetadataContainer::CreateMediaListForSelectedItemL");
   438     TRACER("CGlxMetadataContainer::CreateMediaListForSelectedItemL");
   430    
   439 
   431     //create the collection path for the medialist to be created
   440     //create the collection path for the medialist to be created
   432     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
   441     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
   433     CleanupStack::PushL( path );
   442     CleanupStack::PushL(path);
   434     //set the all collection path as the details dialog can be launched from any of the grid views and filter with URI
   443     //set the all collection path as the details dialog can be launched from any of the grid views and filter with URI
   435     path->AppendL(KGlxCollectionPluginAllImplementationUid);
   444     path->AppendL(KGlxCollectionPluginAllImplementationUid);
   436     //create the filter with the URI
   445     //create the filter with the URI
   437     CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(*iUri);
   446     CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(*iUri);
   438 	CleanupStack::PushL( filter );
   447     CleanupStack::PushL(filter);
   439     //create the medialist
   448     //create the medialist
   440     iItemMediaList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(KMediaListId),filter);
   449     iItemMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId(
       
   450             KMediaListId), filter);
   441 
   451 
   442     //Add the attributes which are required to be displayed.
   452     //Add the attributes which are required to be displayed.
   443     iMainListAttributecontext = new (ELeave) CGlxAttributeContext(&iSelectionIterator);
   453     iMainListAttributecontext = new (ELeave) CGlxAttributeContext(
       
   454             &iSelectionIterator);
   444     iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected);
   455     iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected);
   445     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralCategory);
   456     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralCategory);
   446     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize);
   457     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize);
   447     iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions); 
   458     iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions);
   448     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralTitle);
   459     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralTitle);
   449     iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralLastModifiedDate);
   460     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralDate);
   450     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralComment); 
   461     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralComment);
   451     iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralLocation);
   462     iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralLocation);
   452     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralDuration);    
   463     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralDuration);
   453     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralUri);
   464     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralUri);
   454     
   465 
   455     //Add Context so that we get the handleattributes call once the medialist is populated with above mentioned attributes.
   466     //Add Context so that we get the handleattributes call once the medialist is populated with above mentioned attributes.
   456     iItemMediaList->AddContextL( iMainListAttributecontext,
   467     iItemMediaList->AddContextL(iMainListAttributecontext,
   457             KGlxFetchContextPriorityBlocking );
   468             KGlxFetchContextPriorityBlocking);
   458     
   469 
   459     //add to observer for callbacks.
   470     //add to observer for callbacks.
   460     iItemMediaList->AddMediaListObserverL(this);
   471     iItemMediaList->AddMediaListObserverL(this);
   461     
   472 
   462     CleanupStack::PopAndDestroy( filter );
   473     CleanupStack::PopAndDestroy(filter);
   463     CleanupStack::PopAndDestroy( path ); 
   474     CleanupStack::PopAndDestroy(path);
   464     }
   475     }
   465 
   476 
   466 //-----------------------------------------------------------------------------
   477 //-----------------------------------------------------------------------------
   467 // CGlxMetadataContainer::CreateTagsMediaList
   478 // CGlxMetadataContainer::CreateTagsMediaList
   468 //-----------------------------------------------------------------------------
   479 //-----------------------------------------------------------------------------
   469 void CGlxMetadataContainer::CreateTagsMediaListL()
   480 void CGlxMetadataContainer::CreateTagsMediaListL()
   470     {
   481     {
   471     TRACER("CGlxMetadataContainer::CreateTagsMediaListL");
   482     TRACER("CGlxMetadataContainer::CreateTagsMediaListL");
   472     	//create the collection path for the medialist to be created
   483     //create the collection path for the medialist to be created
   473       CMPXCollectionPath* path = CMPXCollectionPath::NewL();
   484     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
   474       CleanupStack::PushL( path );
   485     CleanupStack::PushL(path);
   475       //Set the Tags collection for the particular item
   486     //Set the Tags collection for the particular item
   476       path->AppendL(KGlxTagCollectionPluginImplementationUid);
   487     path->AppendL(KGlxTagCollectionPluginImplementationUid);
   477       //get the media item for which we require the tags collection
   488     //get the media item for which we require the tags collection
   478       TGlxMedia item = iItemMediaList->Item(0);            
   489     TGlxMedia item = iItemMediaList->Item(0);
   479       //create the medialist filter with media ID
   490     //create the medialist filter with media ID
   480       CMPXFilter* filter1  = 
   491     CMPXFilter* filter1 =
   481               TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL(item.Id());
   492             TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL(
   482       CleanupStack::PushL(filter1);
   493                     item.Id());
   483       //set the array order as required, here its alphabetical
   494     CleanupStack::PushL(filter1);
   484       TGlxFilterProperties filterProperty;
   495     //set the array order as required, here its alphabetical
   485       filterProperty.iSortOrder = EGlxFilterSortOrderAlphabetical;
   496     TGlxFilterProperties filterProperty;
   486       filterProperty.iSortDirection = EGlxFilterSortDirectionAscending;
   497     filterProperty.iSortOrder = EGlxFilterSortOrderAlphabetical;
   487       //combine the filter with filterProperty
   498     filterProperty.iSortDirection = EGlxFilterSortDirectionAscending;
   488       CMPXFilter* filter  = TGlxFilterFactory::CreateCombinedFilterL( filterProperty,
   499     //combine the filter with filterProperty
   489                                                                       filter1,
   500     CMPXFilter* filter = TGlxFilterFactory::CreateCombinedFilterL(
   490                                                                       EFalse);
   501             filterProperty, filter1, EFalse);
   491       CleanupStack::PushL(filter); 
   502     CleanupStack::PushL(filter);
   492       
   503 
   493       //create the medialist to get the tags array.
   504     //create the medialist to get the tags array.
   494       iTagMediaList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(KMediaListId),filter);
   505     iTagMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId(
   495       
   506             KMediaListId), filter);
   496       //add the attribute KMPXMediaGeneralTitle to the context to get the tag name
   507 
   497       iTagContext = CGlxDefaultAttributeContext::NewL();
   508     //add the attribute KMPXMediaGeneralTitle to the context to get the tag name
   498       iTagContext->AddAttributeL(KMPXMediaGeneralTitle); 
   509     iTagContext = CGlxDefaultAttributeContext::NewL();
   499       iTagContext->SetRangeOffsets(KOffsets,KOffsets);
   510     iTagContext->AddAttributeL(KMPXMediaGeneralTitle);
   500       
   511     iTagContext->SetRangeOffsets(KOffsets, KOffsets);
   501       //Add Context so that we get the handleattributes call once the medialist is populated with tags.
   512 
   502       iTagMediaList->AddContextL( iTagContext,
   513     //Add Context so that we get the handleattributes call once the medialist is populated with tags.
   503                                       KGlxFetchContextPriorityUMPViewTagPane );
   514     iTagMediaList->AddContextL(iTagContext,
   504                                       
   515             KGlxFetchContextPriorityUMPViewTagPane);
   505 			//add to observer for callbacks.                                      
   516 
   506       iTagMediaList->AddMediaListObserverL(this);
   517     //add to observer for callbacks.                                      
   507       
   518     iTagMediaList->AddMediaListObserverL(this);
   508       CleanupStack::PopAndDestroy(filter);
   519 
   509       CleanupStack::PopAndDestroy(filter1);
   520     CleanupStack::PopAndDestroy(filter);
   510       CleanupStack::PopAndDestroy(path);
   521     CleanupStack::PopAndDestroy(filter1);
   511   
   522     CleanupStack::PopAndDestroy(path);
   512     }
   523     }
       
   524 
   513 //-----------------------------------------------------------------------------
   525 //-----------------------------------------------------------------------------
   514 // CGlxMetadataContainer::CreateAlbumsMediaListL
   526 // CGlxMetadataContainer::CreateAlbumsMediaListL
   515 //-----------------------------------------------------------------------------
   527 //-----------------------------------------------------------------------------
   516 void CGlxMetadataContainer::CreateAlbumsMediaListL()
   528 void CGlxMetadataContainer::CreateAlbumsMediaListL()
   517     {
   529     {
   518     TRACER("CGlxMetadataContainer::CreateAlbumsMediaListL");
   530     TRACER("CGlxMetadataContainer::CreateAlbumsMediaListL");
   519     	//create the collection path for the medialist to be created
   531     //create the collection path for the medialist to be created
   520       CMPXCollectionPath* path = CMPXCollectionPath::NewL();
   532     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
   521       CleanupStack::PushL( path );
   533     CleanupStack::PushL(path);
   522       //Set the albums collection for the particular item
   534     //Set the albums collection for the particular item
   523       path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);
   535     path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);
   524       //get the media item for which we require the tags collection
   536     //get the media item for which we require the tags collection
   525       TGlxMedia item = iItemMediaList->Item(0);     
   537     TGlxMedia item = iItemMediaList->Item(0);
   526       //create the medialist filter with media ID
   538     //create the medialist filter with media ID
   527       CMPXFilter* filter  =
   539     CMPXFilter* filter =
   528               TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL(item.Id());
   540             TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL(
   529       CleanupStack::PushL(filter);    
   541                     item.Id());
   530       //create the albums medialist.
   542     CleanupStack::PushL(filter);
   531       iAlbumMediaList = MGlxMediaList::InstanceL(*path,
   543     //create the albums medialist.
   532                                                   TGlxHierarchyId(KMediaListId),
   544     iAlbumMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId(
   533                                                   filter);
   545             KMediaListId), filter);
   534                                                   
   546 
   535       //add the attribute KMPXMediaGeneralTitle to the context to get the album name
   547     //add the attribute KMPXMediaGeneralTitle to the context to get the album name
   536       iAlbumContext = CGlxDefaultAttributeContext::NewL();
   548     iAlbumContext = CGlxDefaultAttributeContext::NewL();
   537       iAlbumContext->AddAttributeL(KMPXMediaGeneralTitle);
   549     iAlbumContext->AddAttributeL(KMPXMediaGeneralTitle);
   538       iAlbumContext->SetRangeOffsets(KOffsets,KOffsets);
   550     iAlbumContext->SetRangeOffsets(KOffsets, KOffsets);
   539       //Add Context to the medialist so that we get the handleattributes call once the medialist is populated with albums.
   551     //Add Context to the medialist so that we get the handleattributes call once the medialist is populated with albums.
   540       iAlbumMediaList->AddContextL( iAlbumContext, 
   552     iAlbumMediaList->AddContextL(iAlbumContext,
   541                               KGlxFetchContextPriorityUMPViewAlbumPane );
   553             KGlxFetchContextPriorityUMPViewAlbumPane);
   542       
   554 
   543       //add to observer for callbacks. 
   555     //add to observer for callbacks. 
   544       iAlbumMediaList->AddMediaListObserverL(this);        
   556     iAlbumMediaList->AddMediaListObserverL(this);
   545        
   557 
   546       CleanupStack::PopAndDestroy(filter);   
   558     CleanupStack::PopAndDestroy(filter);
   547       CleanupStack::PopAndDestroy(path); 
   559     CleanupStack::PopAndDestroy(path);
   548   
   560     }
   549     }
       
   550 
       
   551 
   561 
   552 // ----------------------------------------------------------------------------
   562 // ----------------------------------------------------------------------------
   553 // CGlxMetadataContainer::ViewDynInitMenuPaneL
   563 // CGlxMetadataContainer::ViewDynInitMenuPaneL
   554 // ----------------------------------------------------------------------------
   564 // ----------------------------------------------------------------------------
   555 // 
   565 // 
   556 void CGlxMetadataContainer::ViewDynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane)
   566 void CGlxMetadataContainer::ViewDynInitMenuPaneL(TInt aMenuId,
   557     {
   567         CEikMenuPane* aMenuPane)
   558     if( aMenuId == R_METADATA_MENU )
   568     {
   559         {
   569     if (aMenuId == R_METADATA_MENU)
   560         //Set dim the options based on the utem selected
   570         {
   561         //Viewdetails option will be availble only for the license item
   571         //Set dim the options based on the item selected
   562         //Delete option will be available only for the location item	
       
   563         aMenuPane->SetItemDimmed(KGlxViewBoundMenuCommandId,IsLicenseItem());
       
   564         //location info will be enabled if the item has a location info
   572         //location info will be enabled if the item has a location info
   565 		aMenuPane->SetItemDimmed(KGlxDeleteBoundMenuCommandId,IsLocationItem());
   573         aMenuPane->SetItemDimmed(KGlxDeleteBoundMenuCommandId,
   566 		// Show on Map is no longer part of requirements and should not be shown in the 
   574                 IsLocationItem());
   567 		// options menu. When show on map has to come back, replace the 'ETrue' below with 
   575         }
   568 		// the function IsLocationItem. 
   576     }
   569         aMenuPane->SetItemDimmed(EGlxCmdAiwShowMap,ETrue);
   577 
   570         }
       
   571         
       
   572     
       
   573     }
       
   574 // ----------------------------------------------------------------------------
   578 // ----------------------------------------------------------------------------
   575 // CGlxMetadataContainer::RemoveLocationL
   579 // CGlxMetadataContainer::RemoveLocationL
   576 // ----------------------------------------------------------------------------
   580 // ----------------------------------------------------------------------------
   577 //
   581 //
   578 void CGlxMetadataContainer::RemoveLocationL() 
   582 void CGlxMetadataContainer::RemoveLocationL() 
   579     {
   583     {
   580     TRACER("CGlxMetadataContainer::RemoveLocationL");    
   584     TRACER("CGlxMetadataContainer::RemoveLocationL");
   581     
   585 
   582     iLocationinfo = ETrue;
   586     iLocationinfo = ETrue;
   583     // get the media item
   587     // get the media item
   584     const TGlxMedia& media = iItemMediaList->Item(0);    
   588     const TGlxMedia& media = iItemMediaList->Item(0);
   585     // Test to see if the coordinate is present
   589     // Test to see if the coordinate is present
   586     TCoordinate coordinate;
   590     TCoordinate coordinate;
   587     TBool isSupported = media.GetCoordinate(coordinate);
   591     TBool isSupported = media.GetCoordinate(coordinate);
   588     if( !isSupported )
   592     if (!isSupported)
   589         {
   593         {
   590         HBufC *buf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_INFO_NO_LOCATION);
   594         HBufC *buf = StringLoader::LoadLC(
   591         GlxGeneralUiUtilities::ShowInfoNoteL(*buf,ETrue);
   595                 R_GLX_METADATA_NOTE_INFO_NO_LOCATION);
       
   596         GlxGeneralUiUtilities::ShowInfoNoteL(*buf, ETrue);
   592         CleanupStack::PopAndDestroy(buf);
   597         CleanupStack::PopAndDestroy(buf);
   593         }
   598         }
   594     else
   599     else
   595         {
   600         {
   596         HBufC *buf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_DELETE_LOCATION);
   601         HBufC *buf =
   597         TBool response = GlxGeneralUiUtilities::ConfirmQueryL(R_GLX_QUERY_YES_NO,*buf);
   602                 StringLoader::LoadLC(R_GLX_METADATA_NOTE_DELETE_LOCATION);
       
   603         TBool response = GlxGeneralUiUtilities::ConfirmQueryL(
       
   604                 R_GLX_QUERY_YES_NO, *buf);
   598         CleanupStack::PopAndDestroy(buf);
   605         CleanupStack::PopAndDestroy(buf);
   599    
   606 
   600         if( response )
   607         if (response)
   601             {
   608             {
   602             //user selected yes, so delete location     
   609             //user selected yes, so delete location     
   603             //send command for delete location after successfull removal of command remove this pane
   610             //send command for delete location after successfull removal of command remove this pane
   604             if( iItemMediaList->Count() > 0 )
   611             if (iItemMediaList->Count() > 0)
   605                 {       
   612                 {
   606                 //set focus to first item	
   613                 //set focus to first item	
   607                 iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);
   614                 iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0);
   608                 
   615 
   609                 // Deleting location information from image file
   616                 // Deleting location information from image file
   610                 RFs rFs;
   617                 RFs rFs;
   611                 User::LeaveIfError( rFs.Connect() );
   618                 User::LeaveIfError(rFs.Connect());
   612                 CleanupClosePushL( rFs );
   619                 CleanupClosePushL(rFs);
   613                 RFile rFile;                
   620                 RFile rFile;
   614                 User::LeaveIfError( rFile.Open(rFs,
   621                 User::LeaveIfError(rFile.Open(rFs,
   615                                                iItemMediaList->Item(0).Uri()
   622                         iItemMediaList->Item(0).Uri(), EFileWrite));
   616                                                ,EFileWrite ));
   623                 CleanupClosePushL(rFile);
   617                 CleanupClosePushL( rFile );
   624 
   618                 
       
   619                 TInt imageFileSize = 0; // Image File Size
   625                 TInt imageFileSize = 0; // Image File Size
   620                 User::LeaveIfError( rFile.Size( imageFileSize ) );
   626                 User::LeaveIfError(rFile.Size(imageFileSize));
   621                 HBufC8* imageData = HBufC8::NewL( imageFileSize );  //Actual Image Data
   627                 HBufC8* imageData = HBufC8::NewL(imageFileSize); //Actual Image Data
   622                 CleanupStack::PushL( imageData );
   628                 CleanupStack::PushL(imageData);
   623                 
   629 
   624                 TPtr8 myImagePtr = imageData->Des();
   630                 TPtr8 myImagePtr = imageData->Des();
   625                 TInt readError = rFile.Read( myImagePtr );
   631                 TInt readError = rFile.Read(myImagePtr);
   626                 if ( readError != KErrNone )
   632                 if (readError != KErrNone)
   627                     {
   633                     {
   628                     User::Leave( KErrGeneral );
   634                     User::Leave(KErrGeneral);
   629                     }
   635                     }
   630                     
   636 
   631                 //CExifModify Interface class for modifying existing Exif v2.2 (or prior) 
   637                 //CExifModify Interface class for modifying existing Exif v2.2 (or prior) 
   632                 //file format or creating Exif v2.2 file format using valid Jpeg image     
   638                 //file format or creating Exif v2.2 file format using valid Jpeg image     
   633                 CExifModify* exifWriter = NULL;
   639                 CExifModify* exifWriter = NULL;
   634                 TRAPD(err,exifWriter = CExifModify::NewL( imageData->Des()));
   640                 TRAPD(err,exifWriter = CExifModify::NewL( imageData->Des()));
   635                 CleanupStack::PushL( exifWriter );
   641                 CleanupStack::PushL(exifWriter);
   636                 if(err == KErrNone)
   642                 if (err == KErrNone)
   637                     {
   643                     {
   638 					//Removes the specified IFD structure and all its tags from the Exif data
   644                     //Removes the specified IFD structure and all its tags from the Exif data
   639 					exifWriter->DeleteIfd  ( EIfdGps  );
   645                     exifWriter->DeleteIfd(EIfdGps);
   640                 
   646 
   641 					HBufC8* modifiedExif = exifWriter->WriteDataL( imageData->Des() );  //Modified Image Data
   647                     HBufC8* modifiedExif = exifWriter->WriteDataL(
   642 					CleanupStack::PushL( modifiedExif );
   648                             imageData->Des()); //Modified Image Data
   643                 
   649                     CleanupStack::PushL(modifiedExif);
   644 					const TUint32 fileSize = modifiedExif->Des().Length();  //Size of Modified File
   650 
   645 					TInt oldSize;
   651                     const TUint32 fileSize = modifiedExif->Des().Length(); //Size of Modified File
   646 					rFile.Size( oldSize );
   652                     TInt oldSize;
   647 					// set position to begin of file & write the Modified data (Without Location Information)
   653                     rFile.Size(oldSize);
   648 					TInt pos = 0;
   654                     // set position to begin of file & write the Modified data (Without Location Information)
   649 					User::LeaveIfError( rFile.Seek( ESeekStart, pos ) );
   655                     TInt pos = 0;
   650 					User::LeaveIfError( rFile.Write( modifiedExif->Des(), fileSize ) );
   656                     User::LeaveIfError(rFile.Seek(ESeekStart, pos));
   651 
   657                     User::LeaveIfError(rFile.Write(modifiedExif->Des(),
   652 					TTime lastModified;
   658                             fileSize));
   653 					lastModified.UniversalTime();   
   659 
   654 					User::LeaveIfError( rFile.SetModified( lastModified ) );    //Change the Modified Time
   660                     TTime lastModified;
   655 
   661                     lastModified.UniversalTime();
   656 					CleanupStack::PopAndDestroy( modifiedExif);
   662                     User::LeaveIfError(rFile.SetModified(lastModified)); //Change the Modified Time
   657                     }
   663 
   658                 CleanupStack::PopAndDestroy( exifWriter);
   664                     CleanupStack::PopAndDestroy(modifiedExif);
   659                 CleanupStack::PopAndDestroy( imageData );
   665                     }
   660                 CleanupStack::PopAndDestroy( &rFile );
   666                 CleanupStack::PopAndDestroy(exifWriter);
   661                 CleanupStack::PopAndDestroy( &rFs );
   667                 CleanupStack::PopAndDestroy(imageData);
       
   668                 CleanupStack::PopAndDestroy(&rFile);
       
   669                 CleanupStack::PopAndDestroy(&rFs);
   662 
   670 
   663                 //Deleting location information from MDS database
   671                 //Deleting location information from MDS database
   664                 CMPXCollectionPath* path =  iItemMediaList->PathLC();
   672                 CMPXCollectionPath* path = iItemMediaList->PathLC();
   665                 CMPXCommand* command = TGlxCommandFactory::DeleteLocationCommandLC(*path);
   673                 CMPXCommand* command =
   666             
   674                         TGlxCommandFactory::DeleteLocationCommandLC(*path);
   667                 command->SetTObjectValueL<TAny*>(KMPXCommandGeneralSessionId,
   675 
   668                                                  static_cast<TAny*>(this));
   676                 command->SetTObjectValueL<TAny*> (
   669             
   677                         KMPXCommandGeneralSessionId,
   670                 iItemMediaList->CommandL(*command);            
   678                         static_cast<TAny*> (this));
       
   679 
       
   680                 iItemMediaList->CommandL(*command);
   671                 CleanupStack::PopAndDestroy(command);
   681                 CleanupStack::PopAndDestroy(command);
   672                 CleanupStack::PopAndDestroy(path);
   682                 CleanupStack::PopAndDestroy(path);
   673                 }
   683                 }
   674             }       
   684             }
   675         }
   685         }
   676     }
   686     }
   677 // ----------------------------------------------------------------------------
   687 // ----------------------------------------------------------------------------
   678 // CGlxMetadataContainer::EditItemL
   688 // CGlxMetadataContainer::EditItemL
   679 // ----------------------------------------------------------------------------
   689 // ----------------------------------------------------------------------------
   687     settingsitem->UpdateListBoxTextL();
   697     settingsitem->UpdateListBoxTextL();
   688     settingsitem->StoreL();
   698     settingsitem->StoreL();
   689     ListBox()->DrawNow();
   699     ListBox()->DrawNow();
   690     }
   700     }
   691 // ----------------------------------------------------------------------------
   701 // ----------------------------------------------------------------------------
   692 // CGlxMetadataContainer::SetAttributes
   702 // CGlxMetadataContainer::SetAttributesL
   693 // ----------------------------------------------------------------------------
   703 // ----------------------------------------------------------------------------
   694 //
   704 //
   695 void CGlxMetadataContainer::SetAttributesL(TMPXAttribute attribute)
   705 void CGlxMetadataContainer::SetAttributesL(TMPXAttribute attribute)
   696 	{
   706 	{
   697     TRACER("CGlxMetadataContainer::SetAttributesL");    
   707     TRACER("CGlxMetadataContainer::SetAttributesL");
   698     
   708 
   699     //create the tags and albums medialist once the item medialist is populated
   709     //create the tags and albums medialist once the item medialist is populated
   700     //Tags and albums medialist can be created only with media ID.
   710     //Tags and albums medialist can be created only with media ID.
   701     if(!iTagMediaList)
   711     if (!iTagMediaList)
   702 		{
   712         {
   703 		CreateTagsMediaListL();
   713         CreateTagsMediaListL();
   704 		}		
   714         }
   705     if(!iAlbumMediaList)
   715     if (!iAlbumMediaList)
   706 		{
   716         {
   707 		CreateAlbumsMediaListL();	
   717         CreateAlbumsMediaListL();
   708 		}
   718         }
   709     if(!iSetVisible)
   719     if (!iSetVisible)
   710 		{
   720         {
   711 		iSetVisible = ETrue;
   721         iSetVisible = ETrue;
   712 		SetDurationLIicenseItemVisibilityL();
   722         SetDurationLIicenseItemVisibilityL();
   713 		}
   723         }
   714     TGlxMedia item = iItemMediaList->Item(0);
   724     TGlxMedia item = iItemMediaList->Item(0);
   715     //Create the string convertor instance 
   725     //Create the string convertor instance 
   716     //String convertor class with provide the specific format for date,location and duration and size.
   726     //String convertor class with provide the specific format for date,location and duration and size.
   717     CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
   727     CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
   718     CleanupStack::PushL(stringConverter );
   728     CleanupStack::PushL(stringConverter);
   719     HBufC* string = NULL;    
   729     HBufC* string = NULL;
   720     
   730 
   721     //if attribute is date and time we need to pass the format it as R_QTN_DATE_USUAL_WITH_ZERO else null
   731     //if attribute is date and time we need to pass the format it as R_QTN_DATE_USUAL_WITH_ZERO else null
   722     if(attribute == KGlxMediaGeneralLastModifiedDate)
   732     if (attribute == KMPXMediaGeneralDate)
   723         {
   733         {
   724         stringConverter->AsStringL(item, 
   734         stringConverter->AsStringL(item, attribute,
   725                                    attribute,
   735                 R_QTN_DATE_USUAL_WITH_ZERO, string);
   726                                    R_QTN_DATE_USUAL_WITH_ZERO, string );
   736         }
   727         }    
       
   728     else
   737     else
   729         {
   738         {
   730         stringConverter->AsStringL(item,
   739         stringConverter->AsStringL(item, attribute, 0, string);
   731                                    attribute,0, string );
       
   732         }
   740         }
   733     //get the settings item based on the attribute and set the text.
   741     //get the settings item based on the attribute and set the text.
   734     if ( string )
   742     if (string)
   735 		{
   743         {
   736         iTextSetter.Zero();
   744         iTextSetter.Zero();
   737 		iTextSetter.Append(*string);
   745         iTextSetter.Append(*string);
   738 		if(attribute == KMPXMediaGeneralSize)
   746         if (attribute == KMPXMediaGeneralSize)
   739 			{
   747             {
   740 			EditItemL(ESizeItem,EFalse);
   748             EditItemL(ESizeItem, EFalse);
   741 			}
   749             }
   742 		else if(attribute == KMPXMediaGeneralDuration)
   750         else if (attribute == KMPXMediaGeneralDuration)
   743 			{
   751             {
   744 			EditItemL(EDurationItem,EFalse);
   752             EditItemL(EDurationItem, EFalse);
   745 			}
   753             }
   746 		else if(attribute == KMPXMediaGeneralTitle)
   754         else if (attribute == KMPXMediaGeneralTitle)
   747 			{
   755             {
   748 			EditItemL(ENameItem,EFalse);
   756             EditItemL(ENameItem, EFalse);
   749 			}
   757             }
   750 		else if(attribute == KGlxMediaGeneralLastModifiedDate)
   758         else if (attribute == KMPXMediaGeneralDate)
   751 			{  
   759             {
   752 			EditItemL(EDateAndTimeItem,EFalse);
   760             EditItemL(EDateAndTimeItem, EFalse);
   753 			}
   761             }
   754 		else if(attribute == KMPXMediaGeneralComment)
   762         else if (attribute == KMPXMediaGeneralComment)
   755 			{
   763             {
   756 			EditItemL(EDescriptionItem,EFalse);
   764             EditItemL(EDescriptionItem, EFalse);
   757 			}
   765             }
   758 		else if(attribute == KGlxMediaGeneralLocation)
   766         else if (attribute == KGlxMediaGeneralLocation)
   759 			{
   767             {
   760 			EditItemL(ELocationItem,EFalse);
   768             EditItemL(ELocationItem, EFalse);
   761 			}
   769             }
   762 		else if(attribute == KGlxMediaGeneralDimensions)
   770         else if (attribute == KGlxMediaGeneralDimensions)
   763 			{
   771             {
   764 			EditItemL(EResolutionItem,EFalse);
   772             EditItemL(EResolutionItem, EFalse);
   765 			}    
   773             }
   766 		else
   774         else
   767 			{
   775             {
   768     
   776             }
   769 			} 
   777         delete string;
   770 		delete string;
   778         string = NULL;
   771 		string = NULL;
   779         }
   772 		}
   780     CleanupStack::PopAndDestroy(stringConverter);
   773     CleanupStack::PopAndDestroy(stringConverter );
   781     }
   774 	}
       
   775 
   782 
   776 // ----------------------------------------------------------------------------
   783 // ----------------------------------------------------------------------------
   777 // CGlxMetadataContainer::SetNameDescriptionL
   784 // CGlxMetadataContainer::SetNameDescriptionL
   778 // ----------------------------------------------------------------------------
   785 // ----------------------------------------------------------------------------
   779 //
   786 //
   780 void CGlxMetadataContainer::SetNameDescriptionL(TInt aItem)
   787 void CGlxMetadataContainer::SetNameDescriptionL(TInt aItem)
   781     {
   788     {
   782     TRACER("CGlxMetadataContainer::SetNameDescriptionL");   
   789     TRACER("CGlxMetadataContainer::SetNameDescriptionL");
   783     //This functions i commn for updatng both name and description once modified    
   790     //This functions i commn for updatng both name and description once modified    
   784     //get the item handcle to be modified    	
   791     //get the item handcle to be modified    	
   785     CAknSettingItem* settingsitem = (*SettingItemArray())[aItem]; 
   792     CAknSettingItem* settingsitem = (*SettingItemArray())[aItem];
   786     HBufC* textBuf = HBufC::NewLC( KMaxMediaPopupTitleLength );
   793     HBufC* textBuf = HBufC::NewLC(KMaxMediaPopupTextLength);
   787     (textBuf->Des()).Copy((settingsitem->SettingTextL()));
   794     const TDesC& popupText = settingsitem->SettingTextL();
       
   795     (textBuf->Des()).Copy(popupText.Left(KMaxMediaPopupTextLength));
   788     TPtr textPtr = textBuf->Des();
   796     TPtr textPtr = textBuf->Des();
   789     //Remove preceeding & trailing spaces
   797     //Remove preceeding & trailing spaces
   790     textPtr.Trim();
   798     textPtr.Trim();
   791     TBuf<KMaxMediaPopupTitleLength> titleText(*textBuf);
   799     HBufC* buf = NULL;
   792     HBufC *buf = NULL;
   800 
   793     if(aItem == ENameItem)
   801     if(aItem == ENameItem)
   794         {
   802         {
   795         buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_TITLE_NSERIES);
   803         buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_TITLE_NSERIES);
   796         }
   804         }
   797     else
   805     else
   798         {
   806         {
   799         buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_DESCRIPTION_NSERIES);
   807         buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_DESCRIPTION_NSERIES);
   800         }
   808         }
   801     
   809 
   802     //Launch the text entry editor.
   810     //Launch the text entry editor.
   803     CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *buf, textPtr );
   811     CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL(*buf, textPtr);
   804     CleanupStack::PopAndDestroy(buf);
   812     CleanupStack::PopAndDestroy(buf);
   805     if(aItem == EDescriptionItem)
   813     if (aItem == EDescriptionItem)
   806         {
   814         {
   807         popup->SetLeftSoftKeyL(ETrue);
   815         popup->SetLeftSoftKeyL(ETrue);
   808         }
   816         }
   809     
   817 
   810     //action upon selecting ok from the editor 
   818     //action upon selecting ok from the editor 
   811     if ( popup->ExecuteLD() == EEikBidOk )
   819     if (popup->ExecuteLD() == EEikBidOk)
   812 		{
   820         {
   813 		if(0 != (titleText.Compare(*textBuf)))
   821 		if(0 != (popupText.Compare(*textBuf)))
   814 			{
   822             {
   815 			
   823             TFileName fileName = ParseFileName(*textBuf);
   816 			TFileName fileName = ParseFileName(*textBuf);
   824             //check If filename already exists
   817 			//check If filename already exists
   825             if ((aItem == ENameItem) && (BaflUtils::FileExists(
   818 			if ((aItem == ENameItem) &&
   826                     ControlEnv()->FsSession(), fileName)))
   819 					(BaflUtils::FileExists(ControlEnv()->FsSession(), fileName)))
   827                 {
   820 				{
   828                 //if changed title is same as existing one then showing the already use popup to user
   821 				//if changed title is same as existing one then showing the already use popup to user
   829                 HBufC* info = StringLoader::LoadLC(R_GLX_NAME_ALREADY_USED,
   822 				HBufC* info = StringLoader::LoadLC(R_GLX_NAME_ALREADY_USED, *textBuf);
   830                         *textBuf);
   823 				GlxGeneralUiUtilities::ShowInfoNoteL(*info, ETrue);
   831                 GlxGeneralUiUtilities::ShowInfoNoteL(*info, ETrue);
   824 				CleanupStack::PopAndDestroy(info);
   832                 CleanupStack::PopAndDestroy(info);
   825 				}
   833                 }
   826 			else
   834             // Check if the filename is valid
   827 				{
   835             else if ((aItem == ENameItem)
   828 				//Modify the MDS and setting list only if the entry is different from previous Item value
   836                     && (!ControlEnv()->FsSession().IsValidName(*textBuf)))
       
   837                 {
       
   838                 //Show illegal characters error note 
       
   839                 HBufC* info = StringLoader::LoadLC(
       
   840                         R_GLX_QTN_FLDR_ILLEGAL_CHARACTERS);
       
   841                 GlxGeneralUiUtilities::ShowInfoNoteL(*info, ETrue);
       
   842                 CleanupStack::PopAndDestroy(info);
       
   843                 }
       
   844             else
       
   845                 {
       
   846                 //Modify the MDS and setting list only if the entry is different from previous Item value
   829                 iTextSetter.Zero();
   847                 iTextSetter.Zero();
   830 				iTextSetter.Copy(*textBuf);
   848                 iTextSetter.Copy(*textBuf);
   831 				EditItemL(aItem,EFalse);
   849                 EditItemL(aItem, EFalse);
   832 				iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item
   850                 iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0);//set focus to first item
   833 				
   851 
   834 				if(aItem == ENameItem)
   852                 if (aItem == ENameItem)
   835 					{
   853                     {
   836 					//indicate Rename command is started
   854                     //indicate Rename command is started
   837 					iRenameStarted = ETrue;
   855                     iRenameStarted = ETrue;
   838 					//set Setting List Box to Dimmed status
   856                     //set Setting List Box to Dimmed status
   839 					SetDimmed(iRenameStarted);
   857                     SetDimmed(iRenameStarted);
   840 					
   858 
   841 					const TGlxMedia& media = iItemMediaList->Item(0);
   859                     const TGlxMedia& media = iItemMediaList->Item(0);
   842 					ContentAccess::CManager *manager = ContentAccess::CManager::NewL();
   860                     ContentAccess::CManager *manager =
   843 					CleanupStack::PushL(manager);
   861                             ContentAccess::CManager::NewL();
   844 					HBufC* modifiedName = fileName.AllocLC();
   862                     CleanupStack::PushL(manager);
   845 					
   863                     HBufC* modifiedName = fileName.AllocLC();
   846 					//rename the media
   864 
   847 					TInt error = manager->RenameFile(media.Uri(), *modifiedName);
   865                     //rename the media
   848 					if(KErrNone == error)
   866                     TInt error = manager->RenameFile(media.Uri(),
   849 						{
   867                             *modifiedName);
   850 						//Redundant call But needed in case FileSystem is too slow 
   868                     if (KErrNone == error)
   851 						//to notify MDS for updating title.
   869                         {
   852 						//Create the glx command for updating Title in MDS
   870                         //Redundant call But needed in case FileSystem is too slow 
   853 						CMPXCollectionPath* path = iItemMediaList->PathLC();
   871                         //to notify MDS for updating title.
   854 						CMPXCommand* command = TGlxCommandFactory::RenameCommandLC(
   872                         //Create the glx command for updating Title in MDS
   855 								settingsitem->SettingTextL(), *path);
   873                         CMPXCollectionPath* path = iItemMediaList->PathLC();
   856 						command->SetTObjectValueL<TAny*> (
   874                         CMPXCommand* command =
   857 								KMPXCommandGeneralSessionId,
   875                                 TGlxCommandFactory::RenameCommandLC(
   858 								static_cast<TAny*> (this));
   876                                         settingsitem->SettingTextL(), *path);
   859 						//issue command to the medialist which further 
   877                         command->SetTObjectValueL<TAny*> (
   860 						//calls data source to update MDS
   878                                 KMPXCommandGeneralSessionId,
   861 						iItemMediaList->CommandL(*command);
   879                                 static_cast<TAny*> (this));
   862 						CleanupStack::PopAndDestroy(command);
   880                         //issue command to the medialist which further 
   863 						CleanupStack::PopAndDestroy(path);
   881                         //calls data source to update MDS
   864 						}
   882                         iItemMediaList->CommandL(*command);
   865 					else
   883                         CleanupStack::PopAndDestroy(command);
   866 						{
   884                         CleanupStack::PopAndDestroy(path);
   867 						//Renaming commmand failed
   885                         }
   868 						iRenameStarted = EFalse;
   886                     else
   869 						//reset Setting Items to undim status
   887                         {
   870 						SetDimmed(iRenameStarted);
   888                         //Renaming commmand failed
   871 						//Reset the EName Settings field
   889                         iRenameStarted = EFalse;
   872 						iTextSetter.Zero();
   890                         //reset Setting Items to undim status
   873 						iTextSetter.Copy(media.Title());
   891                         SetDimmed(iRenameStarted);
   874 						EditItemL(ENameItem,EFalse);
   892                         //Reset the EName Settings field
   875 						
   893                         iTextSetter.Zero();
   876 						User::LeaveIfError(error);
   894                         iTextSetter.Copy(media.Title());
   877 						}
   895                         EditItemL(ENameItem, EFalse);
   878 					CleanupStack::PopAndDestroy(modifiedName);
   896 						GlxGeneralUiUtilities::ShowErrorNoteL(error);
   879 					CleanupStack::PopAndDestroy(manager);
   897                         }
   880 					}
   898                     CleanupStack::PopAndDestroy(modifiedName);
   881 				else
   899                     CleanupStack::PopAndDestroy(manager);
   882 					{
   900                     }
   883 					//Create the glx command for changing description
   901                 else
   884 					CMPXCollectionPath* path = iItemMediaList->PathLC();
   902                     {
   885 					CMPXCommand* command =
   903                     //Create the glx command for changing description
   886 							TGlxCommandFactory::SetDescriptionCommandLC(
   904                     CMPXCollectionPath* path = iItemMediaList->PathLC();
   887 									settingsitem->SettingTextL(), *path);
   905                     CMPXCommand* command =
   888 					command->SetTObjectValueL<TAny*> (
   906                             TGlxCommandFactory::SetDescriptionCommandLC(
   889 							KMPXCommandGeneralSessionId,
   907                                     settingsitem->SettingTextL(), *path);
   890 							static_cast<TAny*> (this));
   908                     command->SetTObjectValueL<TAny*> (
   891 					//issue command to the medialist which further 
   909                             KMPXCommandGeneralSessionId,
   892 					//calls data source to update MDS
   910                             static_cast<TAny*> (this));
   893 					iItemMediaList->CommandL(*command);
   911                     //issue command to the medialist which further 
   894 					CleanupStack::PopAndDestroy(command);
   912                     //calls data source to update MDS
   895 					CleanupStack::PopAndDestroy(path);
   913                     iItemMediaList->CommandL(*command);
   896 					}
   914                     CleanupStack::PopAndDestroy(command);
   897 				
   915                     CleanupStack::PopAndDestroy(path);
   898 				}
   916                     }
   899 			}
   917                 }
   900 		}
   918             }
   901     CleanupStack::PopAndDestroy( textBuf );
   919         }
   902     
   920     CleanupStack::PopAndDestroy(textBuf);
       
   921 
   903     //notify observer that some operation has happened. So refresh the toolbar area..
   922     //notify observer that some operation has happened. So refresh the toolbar area..
   904     iResetToolbarObs.HandleToolbarResetting(EFalse);
   923     iResetToolbarObs.HandleToolbarResetting(EFalse);
   905     }
   924     }
       
   925 
   906 // ----------------------------------------------------------------------------
   926 // ----------------------------------------------------------------------------
   907 // CGlxMetadataContainer::UpdateTagsL()
   927 // CGlxMetadataContainer::UpdateTagsL()
   908 // ----------------------------------------------------------------------------
   928 // ----------------------------------------------------------------------------
   909 // 
   929 // 
   910 void CGlxMetadataContainer::UpdateTagsL()
   930 void CGlxMetadataContainer::UpdateTagsL()
   911     {
   931     {
       
   932     TRACER("CGlxMetadataContainer::UpdateTagsL");
   912     //Get the tag setting item handle to set the text
   933     //Get the tag setting item handle to set the text
   913      CAknSettingItem* settingsitem =
   934     CAknSettingItem* settingsitem = (*SettingItemArray())[ETagsItem];
   914                              (*SettingItemArray())[ETagsItem]; 
   935 
   915                              //Set the tag setter to empty string before filling in the data.                                                
   936     //Set the tag setter to empty string before filling in the data.                                                
   916      iTagSetter.Copy(KGlxTextSetter);
   937     iTagSetter.Zero();
   917      //Loop to appened all the tags to the iTagSetter.
   938      
   918      for( TInt index = 0 ; index < iTagMediaList->Count() ; index++ )
   939     //Loop to appened all the tags to the iTagSetter.
   919 		{
   940     for (TInt index = 0; index < iTagMediaList->Count(); index++)
   920 		if(iTagSetter.Length())
   941         {
   921 			{
   942         if (iTagSetter.Length())
   922 			iTagSetter.Append(KGlxComma);
   943             {
   923 			}
   944             iTagSetter.Append(KGlxComma);
   924 		const TGlxMedia&  item = iTagMediaList->Item( index );
   945             }
   925 		const TDesC& title = item.Title();
   946         const TGlxMedia& item = iTagMediaList->Item(index);
   926 		iTagSetter.Append(title);
   947         const TDesC& title = item.Title();
   927 		}    
   948         iTagSetter.Append(title);
   928      EditItemL(ETagsItem,EFalse);
   949         }
   929      }
   950     EditItemL(ETagsItem, EFalse);
       
   951     }
       
   952 
   930 // ----------------------------------------------------------------------------
   953 // ----------------------------------------------------------------------------
   931 // CGlxMetadataContainer::UpdateAlbumsL()
   954 // CGlxMetadataContainer::UpdateAlbumsL()
   932 // ----------------------------------------------------------------------------
   955 // ----------------------------------------------------------------------------
   933 // 
   956 // 
   934 void CGlxMetadataContainer::UpdateAlbumsL()
   957 void CGlxMetadataContainer::UpdateAlbumsL()
   935     {
   958     {
       
   959     TRACER("CGlxMetadataContainer::UpdateAlbumsL");	
   936     //Get the tag setting item handle to set the text
   960     //Get the tag setting item handle to set the text
   937     CAknSettingItem* settingsitem = 
   961     CAknSettingItem* settingsitem = (*SettingItemArray())[EAlbumsItem];
   938                         (*SettingItemArray())[EAlbumsItem];     
   962 
   939     //Set the tag setter to empty string before filling in the data.
   963     //Set the tag setter to empty string before filling in the data.
   940     iAlbumSetter.Copy(KGlxTextSetter);
   964     iAlbumSetter.Zero();
       
   965     
   941     //Loop to appened all the tags to the iAlbumSetter.
   966     //Loop to appened all the tags to the iAlbumSetter.
   942     for( TInt index = 0 ; index < iAlbumMediaList->Count() ; index++ )
   967     for( TInt index = 0 ; index < iAlbumMediaList->Count() ; index++ )
   943 		{
   968 		{
   944         if(iAlbumSetter.Length())
   969         if(iAlbumSetter.Length())
   945 			{
   970 			{
   949 		const TDesC& title = item.Title();
   974 		const TDesC& title = item.Title();
   950 		iAlbumSetter.Append(title);
   975 		iAlbumSetter.Append(title);
   951 		}
   976 		}
   952 	EditItemL(EAlbumsItem,EFalse);
   977 	EditItemL(EAlbumsItem,EFalse);
   953     }
   978     }
       
   979 
   954 // ----------------------------------------------------------------------------
   980 // ----------------------------------------------------------------------------
   955 // CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL()
   981 // CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL()
   956 // ----------------------------------------------------------------------------
   982 // ----------------------------------------------------------------------------
   957 // 
   983 // 
   958 void CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL()
   984 void CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL()
   959     {
   985     {
       
   986     TRACER("CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL");		
   960     //get the media item.
   987     //get the media item.
   961     const TGlxMedia& item = iItemMediaList->Item(0);
   988     const TGlxMedia& item = iItemMediaList->Item(0);
   962     const CGlxMedia* media = item.Properties();
   989     const CGlxMedia* media = item.Properties();
   963 
   990 
   964     //in order to check for video category and drm rights
   991     //in order to check for video category and drm rights
   965    
   992 
   966     CAknSettingItem* hiddenItem = NULL;
   993     CAknSettingItem* hiddenItem = NULL;
   967     if( item.Category() == EMPXVideo)
   994     if (item.Category() == EMPXVideo)
   968         {  
   995         {
   969         if(!item.IsDrmProtected())
   996         if (!item.IsDrmProtected())
   970 	        {
   997             {
   971 	        hiddenItem = (*SettingItemArray())[EDurationItem];        
   998             hiddenItem = (*SettingItemArray())[EDurationItem];
   972 	        //Set the duration item visible
   999             //Set the duration item visible
   973 	        hiddenItem->SetHidden(EFalse);         
  1000             hiddenItem->SetHidden(EFalse);
   974 	        }              
  1001             }
       
  1002         else
       
  1003             {
       
  1004             hiddenItem = (*SettingItemArray())[EResolutionItem];
       
  1005             //Set the Resolution item in-visible for DRM protected Video
       
  1006             hiddenItem->SetHidden(ETrue);
       
  1007             }
   975         //set the video flag which would be used to enable/disable the view details option.               
  1008         //set the video flag which would be used to enable/disable the view details option.               
   976         this->HandleChangeInItemArrayOrVisibilityL();
  1009         this->HandleChangeInItemArrayOrVisibilityL();
   977         iVideo = ETrue;
  1010         iVideo = ETrue;
   978         }    
  1011         }
   979      if( media && media->IsSupported(KMPXMediaDrmProtected))
  1012     if (media && media->IsSupported(KMPXMediaDrmProtected))
   980         {
  1013         {
   981 		if(item.IsDrmProtected())
  1014         if (item.IsDrmProtected())
   982 			{
  1015             {
   983 			hiddenItem = (*SettingItemArray())[ElicenseItem];
  1016             hiddenItem = (*SettingItemArray())[ElicenseItem];
   984 			//Set the License item visible
  1017             //Set the License item visible
   985 			hiddenItem->SetHidden(EFalse);             
  1018             hiddenItem->SetHidden(EFalse);
   986 			//Required to refresh the listbox when any items visiblity is changed
  1019             //Required to refresh the listbox when any items visiblity is changed
   987 			this->HandleChangeInItemArrayOrVisibilityL();
  1020             this->HandleChangeInItemArrayOrVisibilityL();
   988 			}
  1021             }
   989         }
  1022         }
   990     }   
  1023     }
       
  1024 
   991 //Medialist callbacks.    
  1025 //Medialist callbacks.    
   992 // ----------------------------------------------------------------------------
  1026 // ----------------------------------------------------------------------------
   993 // CGlxMetadataContainer::HandleAttributesAvailableL
  1027 // CGlxMetadataContainer::HandleAttributesAvailableL
   994 // ----------------------------------------------------------------------------
  1028 // ----------------------------------------------------------------------------
   995 //
  1029 //
   996 void CGlxMetadataContainer::HandleAttributesAvailableL( TInt /*aItemIndex*/, 
  1030 void CGlxMetadataContainer::HandleAttributesAvailableL(TInt /*aItemIndex*/,
   997     const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList )
  1031         const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList)
   998     {
  1032     {
   999     TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()");
  1033     TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()");
  1000     //generic medialist for the item for all the attributes required other than tags and albums.
  1034     //generic medialist for the item for all the attributes required other than tags and albums.
  1001     if(aList == iItemMediaList)
  1035     if (aList == iItemMediaList)
  1002         {
  1036         {
  1003         // Loop untill it checks for all the avialable attributes
  1037         // Loop untill it checks for all the avialable attributes
  1004         for (TInt i = aAttributes.Count() - 1; i >= 0; i--)
  1038         for (TInt i = aAttributes.Count() - 1; i >= 0; i--)
  1005             {
  1039             {
  1006             //set attributes to the items in the container
  1040             //set attributes to the items in the container
  1014         //2) Rename from Filemanager.
  1048         //2) Rename from Filemanager.
  1015         //- HandleAttributeavailable - new title & new uri at same time.
  1049         //- HandleAttributeavailable - new title & new uri at same time.
  1016         //Check if media's uri(i.e 'aModifiedUri') is different from 'iUri'
  1050         //Check if media's uri(i.e 'aModifiedUri') is different from 'iUri'
  1017         //i.e media is Renamed then Refesh Media list.
  1051         //i.e media is Renamed then Refesh Media list.
  1018         TMPXAttribute uriAttrib(KMPXMediaGeneralUri);
  1052         TMPXAttribute uriAttrib(KMPXMediaGeneralUri);
  1019         TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match );
  1053         TIdentityRelation<TMPXAttribute> match(&TMPXAttribute::Match);
  1020         TInt index = aAttributes.Find(uriAttrib, match);
  1054         TInt index = aAttributes.Find(uriAttrib, match);
  1021         if (KErrNotFound != index)
  1055         if (KErrNotFound != index)
  1022         	{
  1056             {
  1023         	HBufC* modifiedUri = NULL;
  1057             HBufC* modifiedUri = NULL;
  1024 			TGlxMedia item = iItemMediaList->Item(0);
  1058             TGlxMedia item = iItemMediaList->Item(0);
  1025 			//Create the string convertor instance
  1059             //Create the string convertor instance
  1026 			CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
  1060             CGlxUStringConverter* stringConverter =
  1027 			CleanupStack::PushL(stringConverter);
  1061                     CGlxUStringConverter::NewL();
  1028 
  1062             CleanupStack::PushL(stringConverter);
  1029 			//fetch media uri
  1063 
  1030 			stringConverter->AsStringL(item,aAttributes[index],0, modifiedUri );
  1064             //fetch media uri
  1031 			CleanupStack::PopAndDestroy(stringConverter);
  1065             stringConverter->AsStringL(item, aAttributes[index], 0,
  1032 
  1066                     modifiedUri);
  1033 			//Check if media item was renamed
  1067             CleanupStack::PopAndDestroy(stringConverter);
  1034 			if (modifiedUri && modifiedUri->Compare(*iUri) != 0)
  1068 
  1035 				{
  1069             //Check if media item was renamed
  1036 				//Set rename command as started since
  1070             if (modifiedUri && modifiedUri->Compare(*iUri) != 0)
  1037 				//Rename is also possible from File Manager
  1071                 {
  1038 				iRenameStarted = ETrue;
  1072                 //Set rename command as started since
  1039 				CleanupStack::PushL(modifiedUri);
  1073                 //Rename is also possible from File Manager
  1040 				RefreshMediaListL(*modifiedUri);
  1074                 iRenameStarted = ETrue;
  1041 				CleanupStack::PopAndDestroy(modifiedUri);
  1075                 CleanupStack::PushL(modifiedUri);
  1042 				}
  1076                 RefreshMediaListL(*modifiedUri);
  1043 			}
  1077                 CleanupStack::PopAndDestroy(modifiedUri);
  1044 
  1078                 }
  1045         }
  1079             }
  1046     
  1080 
       
  1081         }
       
  1082 
  1047     TMPXAttribute titleAttrib(KMPXMediaGeneralTitle);
  1083     TMPXAttribute titleAttrib(KMPXMediaGeneralTitle);
  1048     TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match );
  1084     TIdentityRelation<TMPXAttribute> match(&TMPXAttribute::Match);
  1049 
  1085 
  1050     if (KErrNotFound != aAttributes.Find(titleAttrib, match))
  1086     if (KErrNotFound != aAttributes.Find(titleAttrib, match))
  1051         {
  1087         {
  1052         if (aList == iTagMediaList)
  1088         if (aList == iTagMediaList)
  1053             {
  1089             {
  1056         else if (aList == iAlbumMediaList)
  1092         else if (aList == iAlbumMediaList)
  1057             {
  1093             {
  1058             UpdateAlbumsL();
  1094             UpdateAlbumsL();
  1059             }
  1095             }
  1060         }
  1096         }
  1061     
       
  1062     }
  1097     }
  1063 
  1098 
  1064 // ----------------------------------------------------------------------------
  1099 // ----------------------------------------------------------------------------
  1065 // HandleItemAddedL
  1100 // HandleItemAddedL
  1066 // ----------------------------------------------------------------------------
  1101 // ----------------------------------------------------------------------------
  1067 // 
  1102 // 
  1068 void CGlxMetadataContainer::HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, 
  1103 void CGlxMetadataContainer::HandleItemAddedL(TInt /*aStartIndex*/,
  1069      MGlxMediaList* aList )
  1104         TInt /*aEndIndex*/, MGlxMediaList* aList)
  1070     {
  1105     {
  1071     TRACER("CGlxMetadataContainer::HandleItemAddedL()");
  1106     TRACER("CGlxMetadataContainer::HandleItemAddedL()");
  1072     
  1107 
  1073     if(!iTagMediaList)
  1108     if (!iTagMediaList)
  1074 		{
  1109         {
  1075         CreateTagsMediaListL();
  1110         CreateTagsMediaListL();
  1076 		}       
  1111         }
  1077     if(!iAlbumMediaList)
  1112     if (!iAlbumMediaList)
  1078 		{
  1113         {
  1079         CreateAlbumsMediaListL();   
  1114         CreateAlbumsMediaListL();
  1080 		}
  1115         }
  1081     if(!iMarquee)
  1116     if (!iMarquee)
  1082 		{
  1117         {
  1083         EnableMarqueingL();
  1118         EnableMarqueingL();
  1084 		}
  1119         }
  1085     SetDurationLIicenseItemVisibilityL();
  1120     SetDurationLIicenseItemVisibilityL();
  1086     if(aList == iTagMediaList)
  1121     if (aList == iTagMediaList)
  1087 		{     
  1122         {
  1088 		UpdateTagsL();
  1123         UpdateTagsL();
  1089 		}
  1124         }
  1090 	else if(aList == iAlbumMediaList)
  1125     else if (aList == iAlbumMediaList)
  1091 		{
  1126         {
  1092 		UpdateAlbumsL();
  1127         UpdateAlbumsL();
  1093 		}
  1128         }
  1094     if(aList == iItemMediaList)
  1129     if (aList == iItemMediaList)
  1095         {
  1130         {
  1096         if(iItemMediaList->Count())
  1131         if (iItemMediaList->Count())
  1097 			{
  1132             {
  1098 			TGlxMedia item = iItemMediaList->Item(0);
  1133             TGlxMedia item = iItemMediaList->Item(0);
  1099 			CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
  1134             CGlxUStringConverter* stringConverter =
  1100 			CleanupStack::PushL(stringConverter );
  1135                     CGlxUStringConverter::NewL();
  1101 			for(TInt index = 0; index <= EDurationItem ; index++)
  1136             CleanupStack::PushL(stringConverter);
  1102 				{
  1137             for (TInt index = 0; index <= EDurationItem; index++)
  1103 				HBufC* string = NULL;               
  1138                 {
  1104                 iTextSetter.Zero();             
  1139                 HBufC* string = NULL;
  1105   
  1140                 iTextSetter.Zero();
  1106 				if(index == ESizeItem)
  1141 
  1107 					{
  1142                 if (index == ESizeItem)
  1108 					stringConverter->AsStringL(item,
  1143                     {
  1109 							KMPXMediaGeneralSize,0, string );              
  1144                     stringConverter->AsStringL(item, KMPXMediaGeneralSize, 0,
  1110 					}
  1145                             string);
  1111 				else if(index == EDurationItem)
  1146                     }
  1112 					{
  1147                 else if (index == EDurationItem)
  1113 					stringConverter->AsStringL(item, 
  1148                     {
  1114 							KMPXMediaGeneralDuration,0, string );
  1149                     stringConverter->AsStringL(item,
  1115 					}
  1150                             KMPXMediaGeneralDuration, 0, string);
  1116 				else if(index == ENameItem)
  1151                     }
  1117 					{
  1152                 else if (index == ENameItem)
  1118 					stringConverter->AsStringL(item,
  1153                     {
  1119 							KMPXMediaGeneralTitle,0, string );
  1154                     stringConverter->AsStringL(item, KMPXMediaGeneralTitle,
  1120 					}
  1155                             0, string);
  1121 				else if(index == EDateAndTimeItem)
  1156                     }
  1122 					{  
  1157                 else if (index == EDateAndTimeItem)
  1123 					stringConverter->AsStringL( item, 
  1158                     {
  1124 					        KGlxMediaGeneralLastModifiedDate,
  1159                     stringConverter->AsStringL(item, KMPXMediaGeneralDate,
  1125 							R_QTN_DATE_USUAL_WITH_ZERO,string );
  1160                             R_QTN_DATE_USUAL_WITH_ZERO, string);
  1126 					}
  1161                     }
  1127 				else if(index == EDescriptionItem)
  1162                 else if (index == EDescriptionItem)
  1128 					{
  1163                     {
  1129 					stringConverter->AsStringL(item,
  1164                     stringConverter->AsStringL(item, KMPXMediaGeneralComment,
  1130 							KMPXMediaGeneralComment,0, string ); 
  1165                             0, string);
  1131 					}
  1166                     }
  1132 				else if(index == ELocationItem)
  1167                 else if (index == ELocationItem)
  1133 					{
  1168                     {
  1134 					stringConverter->AsStringL(item,
  1169                     stringConverter->AsStringL(item,
  1135 							KGlxMediaGeneralLocation,0, string );
  1170                             KGlxMediaGeneralLocation, 0, string);
  1136 					}
  1171                     }
  1137 				else if(index == EResolutionItem)
  1172                 else if (index == EResolutionItem)
  1138 					{
  1173                     {
  1139 					stringConverter->AsStringL(item,
  1174                     stringConverter->AsStringL(item,
  1140 							KGlxMediaGeneralDimensions,0, string );
  1175                             KGlxMediaGeneralDimensions, 0, string);
  1141 					}    
  1176                     }
  1142 				else if(index == ElicenseItem)
  1177                 else if (index == ElicenseItem)
  1143 					{
  1178                     {
  1144 					// If an item is DRM protected, License field in details
  1179                     // If an item is DRM protected, License field in details
  1145 					// should display "View Details"
  1180                     // should display "View Details"
  1146 					string = StringLoader::LoadL(R_GLX_METADATA_VIEW_OPTIONS_VIEW);					
  1181                     string = StringLoader::LoadL(
  1147 					} 				
  1182                             R_GLX_METADATA_VIEW_OPTIONS_VIEW);
  1148 				else
  1183                     }
  1149 					{
  1184                 else
  1150 					//no implementation
  1185                     {
  1151 					} 
  1186                     //no implementation
  1152 				if(string)
  1187                     }
  1153 					{
  1188                 if (string)
  1154 					iTextSetter.Copy(KGlxTextSetter);
  1189                     {
  1155 					iTextSetter.Append(*string);
  1190                     iTextSetter.Append(*string);
  1156 					}	
  1191                     }
  1157 				CleanupStack::PushL( string );
  1192                 CleanupStack::PushL(string);
  1158 				EditItemL(index,EFalse);
  1193                 EditItemL(index, EFalse);
  1159 				CleanupStack::PopAndDestroy(string );
  1194                 CleanupStack::PopAndDestroy(string);
  1160 				}
  1195                 }
  1161 			CleanupStack::PopAndDestroy(stringConverter );
  1196             CleanupStack::PopAndDestroy(stringConverter);
  1162 
  1197 
  1163 			//Reopening Media list is completed
  1198             //Reopening Media list is completed
  1164 			//& Rename Command is also completed
  1199             //& Rename Command is also completed
  1165 			if(iRenameStarted)
  1200             if (iRenameStarted)
  1166 				{
  1201                 {
  1167 				iRenameStarted = EFalse;
  1202                 iRenameStarted = EFalse;
  1168 				//reset Setting Items to undimmed status
  1203                 //reset Setting Items to undimmed status
  1169 				SetDimmed(iRenameStarted);
  1204                 SetDimmed(iRenameStarted);
  1170 				iAvkonAppUi->ProcessCommandL(EGlxCmdRenameCompleted);
  1205                 iAvkonAppUi->ProcessCommandL(EGlxCmdRenameCompleted);
  1171 				}
  1206                 }
  1172 			}
  1207             }
  1173         }
  1208         }
  1174     }
  1209     }
  1175 // ----------------------------------------------------------------------------
  1210 // ----------------------------------------------------------------------------
  1176 // EnableMarqueingL
  1211 // EnableMarqueingL
  1177 // ----------------------------------------------------------------------------
  1212 // ----------------------------------------------------------------------------
  1178 //  
  1213 //  
  1179 void CGlxMetadataContainer::EnableMarqueingL()
  1214 void CGlxMetadataContainer::EnableMarqueingL()
  1180     {
  1215     {
  1181     TRACER("CGlxMetadataContainer::EnableMarqueingL()");    
  1216     TRACER("CGlxMetadataContainer::EnableMarqueingL()");
  1182     iMarquee = ETrue;
  1217     iMarquee = ETrue;
  1183     ListBox()->UseLogicalToVisualConversion(ETrue);
  1218     ListBox()->UseLogicalToVisualConversion(ETrue);
  1184     ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams (KMarqueeLoopCount,
  1219     ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams(
  1185             KMarqueeScrollAmount, KMarqueeScrollDelay, KMarqueeScrollInterval);
  1220             KMarqueeLoopCount, KMarqueeScrollAmount, KMarqueeScrollDelay,
       
  1221             KMarqueeScrollInterval);
  1186     ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
  1222     ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
  1187     
  1223 
  1188     //Fetch the current item index
  1224     //Fetch the current item index
  1189     TInt index = ListBox()->CurrentItemIndex();
  1225     TInt index = ListBox()->CurrentItemIndex();
  1190 
  1226 
  1191     //Reset the disable marquee flag, so that marquee effect can continue (this is normally reset by 
  1227     //Reset the disable marquee flag, so that marquee effect can continue (this is normally reset by 
  1192     //base class of glxmetaDatadialog::HandlePointerEventL()
  1228     //base class of glxmetaDatadialog::HandlePointerEventL()
  1193     ListBox()->ItemDrawer()->ClearFlags(CListItemDrawer::EDisableMarquee);
  1229     ListBox()->ItemDrawer()->ClearFlags(CListItemDrawer::EDisableMarquee);
  1194     
  1230 
  1195     //This is the function which actually starts marquee effect. It is anyway being called from base
  1231     //This is the function which actually starts marquee effect. It is anyway being called from base
  1196     //implementation of OfferKeyEventL(), but for pointer event, we have to call
  1232     //implementation of OfferKeyEventL(), but for pointer event, we have to call
  1197     //this function
  1233     //this function
  1198     ListBox()->DrawItem(index);
  1234     ListBox()->DrawItem(index);
  1199     }    
  1235     }
       
  1236 
  1200 // ----------------------------------------------------------------------------
  1237 // ----------------------------------------------------------------------------
  1201 // HandleCommandCompleteL
  1238 // HandleCommandCompleteL
  1202 // ----------------------------------------------------------------------------
  1239 // ----------------------------------------------------------------------------
  1203 // 
  1240 // 
  1204 void CGlxMetadataContainer::HandleCommandCompleteL(TAny* aSessionId, 
  1241 void CGlxMetadataContainer::HandleCommandCompleteL(TAny* aSessionId,
  1205         CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList)
  1242         CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList)
  1206     {
  1243     {
  1207     TRACER("CGlxMetadataContainer::HandleCommandCompleteL()");
  1244     TRACER("CGlxMetadataContainer::HandleCommandCompleteL()");
  1208     
  1245 
  1209     //Callback from MDS when rename the Title
  1246     //Callback from MDS when rename the Title
  1210     if(aError == KErrNone)
  1247     if (aError == KErrNone)
  1211 		{
  1248         {
  1212 		if(aList == iItemMediaList && aCommandResult->IsSupported(KMPXMediaGeneralTitle))
  1249         if (aList == iItemMediaList && aCommandResult->IsSupported(
  1213 			{
  1250                 KMPXMediaGeneralTitle))
  1214 			GLX_LOG_INFO("RenameCMD to MDS completed");
  1251             {
  1215 			//Since RenameCommand to MDS is redundant and FileSystem has 
  1252             GLX_LOG_INFO("RenameCMD to MDS completed");
  1216 			//already renamed the file, so there is no need to do anything here
  1253             //Since RenameCommand to MDS is redundant and FileSystem has 
  1217 			}
  1254             //already renamed the file, so there is no need to do anything here
  1218 		}
  1255             }
  1219     
  1256         }
       
  1257 
  1220     //To update the location information once the delete operation is successful.
  1258     //To update the location information once the delete operation is successful.
  1221     if(aList == iItemMediaList && iLocationinfo 
  1259     if (aList == iItemMediaList && iLocationinfo && static_cast<TAny*> (this)
  1222             && static_cast<TAny*>( this ) == aSessionId)
  1260             == aSessionId)
  1223 		{
  1261         {
  1224 		TGlxMedia media = iItemMediaList->Item(0) ;
  1262         TGlxMedia media = iItemMediaList->Item(0);
  1225 		media.DeleteLocationAttribute();
  1263         media.DeleteLocationAttribute();
  1226 		iLocationinfo = EFalse;      
  1264         iLocationinfo = EFalse;
  1227 		if ( aError == KErrNone )
  1265         if (aError == KErrNone)
  1228 			{
  1266             {
  1229             iTextSetter.Zero();
  1267             iTextSetter.Zero();
  1230 			EditItemL(ELocationItem,EFalse);
  1268             EditItemL(ELocationItem, EFalse);
  1231 			}
  1269             }
  1232 		}
  1270         }
  1233 	}
  1271     }
  1234           
  1272 
  1235 // ----------------------------------------------------------------------------
  1273 // ----------------------------------------------------------------------------
  1236 // HandleItemRemoved
  1274 // HandleItemRemovedL
  1237 // ----------------------------------------------------------------------------
  1275 // ----------------------------------------------------------------------------
  1238 //  
  1276 //  
  1239 void CGlxMetadataContainer::HandleItemRemovedL(  TInt /*aStartIndex*/, TInt /*aEndIndex*/, 
  1277 void CGlxMetadataContainer::HandleItemRemovedL(TInt /*aStartIndex*/,
  1240         MGlxMediaList* /*aList*/  )
  1278         TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
  1241     {
  1279     {
  1242     TRACER("CGlxMetadataContainer::HandleItemRemovedL()");    
  1280     TRACER("CGlxMetadataContainer::HandleItemRemovedL()");
  1243     }    
  1281     if (iItemMediaList->Count() == 0)
       
  1282         {
       
  1283         iDialogObesrver.HandleItemRemovedL();
       
  1284         }
       
  1285     }
       
  1286 
  1244 // ----------------------------------------------------------------------------
  1287 // ----------------------------------------------------------------------------
  1245 // HandleFocusChangedL
  1288 // HandleFocusChangedL
  1246 // ----------------------------------------------------------------------------
  1289 // ----------------------------------------------------------------------------
  1247 //  
  1290 //  
  1248 void CGlxMetadataContainer::HandleFocusChangedL( NGlxListDefs::
  1291 void CGlxMetadataContainer::HandleFocusChangedL(
  1249     TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, 
  1292         NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/,
  1250     MGlxMediaList* /*aList*/ )
  1293         TInt /*aOldIndex*/, MGlxMediaList* /*aList*/)
  1251     {
  1294     {
  1252     TRACER("CGlxMetadataContainer::HandleFocusChangedL()");
  1295     TRACER("CGlxMetadataContainer::HandleFocusChangedL()");
  1253     }
  1296     }
  1254 // ----------------------------------------------------------------------------
  1297 
  1255 // HandleItemSelected
  1298 // ----------------------------------------------------------------------------
       
  1299 // HandleItemSelectedL
  1256 // ----------------------------------------------------------------------------
  1300 // ----------------------------------------------------------------------------
  1257 //  
  1301 //  
  1258 void CGlxMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/, 
  1302 void CGlxMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/,
  1259     TBool /*aSelected*/, MGlxMediaList* /*aList*/ )
  1303         TBool /*aSelected*/, MGlxMediaList* /*aList*/)
  1260     {
  1304     {
  1261     TRACER("CGlxMetadataContainer::HandleItemSelectedL");
  1305     TRACER("CGlxMetadataContainer::HandleItemSelectedL");
  1262     }
  1306     }
       
  1307 
  1263 // ----------------------------------------------------------------------------
  1308 // ----------------------------------------------------------------------------
  1264 // HandleMessageL
  1309 // HandleMessageL
  1265 // ----------------------------------------------------------------------------
  1310 // ----------------------------------------------------------------------------
  1266 //    
  1311 //    
  1267 void CGlxMetadataContainer::HandleMessageL( const CMPXMessage& /*aMessage*/, 
  1312 void CGlxMetadataContainer::HandleMessageL(const CMPXMessage& /*aMessage*/,
  1268     MGlxMediaList* /*aList*/ )
  1313         MGlxMediaList* /*aList*/)
  1269     {
  1314     {
  1270     TRACER("CGlxMetadataContainer::HandleMessageL()");
  1315     TRACER("CGlxMetadataContainer::HandleMessageL()");
  1271     }
  1316     }
       
  1317 
  1272 // ----------------------------------------------------------------------------
  1318 // ----------------------------------------------------------------------------
  1273 // HandleError
  1319 // HandleError
  1274 // ----------------------------------------------------------------------------
  1320 // ----------------------------------------------------------------------------
  1275 //
  1321 //
  1276 void CGlxMetadataContainer::HandleError( TInt /*aError*/ ) 
  1322 void CGlxMetadataContainer::HandleError(TInt /*aError*/)
  1277     {
  1323     {
  1278     TRACER("CGlxMetadataContainer::HandleError()");
  1324     TRACER("CGlxMetadataContainer::HandleError()");
  1279     TRAP_IGNORE(HandleErrorL());
  1325     TRAP_IGNORE(HandleErrorL());
  1280     }
  1326     }
  1281 
  1327 
  1285 //
  1331 //
  1286 void CGlxMetadataContainer::HandleErrorL()
  1332 void CGlxMetadataContainer::HandleErrorL()
  1287     {
  1333     {
  1288     TRACER("CGlxMetadataContainer::HandleErrorL()");
  1334     TRACER("CGlxMetadataContainer::HandleErrorL()");
  1289     }
  1335     }
       
  1336 
  1290 // ----------------------------------------------------------------------------
  1337 // ----------------------------------------------------------------------------
  1291 // HandleCommandCompleteL
  1338 // HandleCommandCompleteL
  1292 // ----------------------------------------------------------------------------
  1339 // ----------------------------------------------------------------------------
  1293 //  
  1340 //  
  1294 void CGlxMetadataContainer::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, 
  1341 void CGlxMetadataContainer::HandleCommandCompleteL(
  1295     TInt /*aError*/, MGlxMediaList* /*aList*/ )
  1342         CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/)
  1296     {
  1343     {
  1297     TRACER("CGlxMetadataContainer::HandleCommandCompleteL()");
  1344     TRACER("CGlxMetadataContainer::HandleCommandCompleteL()");
  1298     }
  1345     }
  1299   
  1346 
  1300 // ----------------------------------------------------------------------------
  1347 // ----------------------------------------------------------------------------
  1301 // HandleMediaL
  1348 // HandleMediaL
  1302 // ----------------------------------------------------------------------------
  1349 // ----------------------------------------------------------------------------
  1303 //  
  1350 //  
  1304 void CGlxMetadataContainer::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ )
  1351 void CGlxMetadataContainer::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/)
  1305     {
  1352     {
  1306     TRACER("CGlxMetadataContainer::HandleMediaL()");
  1353     TRACER("CGlxMetadataContainer::HandleMediaL()");
  1307     }
  1354     }
  1308   
  1355 
  1309 // ----------------------------------------------------------------------------
  1356 // ----------------------------------------------------------------------------
  1310 // HandleItemModifiedL
  1357 // HandleItemModifiedL
  1311 // ----------------------------------------------------------------------------
  1358 // ----------------------------------------------------------------------------
  1312 //  
  1359 //  
  1313 void CGlxMetadataContainer::HandleItemModifiedL( const RArray<TInt>& /*aItemIndexes*/,
  1360 void CGlxMetadataContainer::HandleItemModifiedL(
  1314     MGlxMediaList* /*aList*/ )
  1361         const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/)
  1315     {
  1362     {
  1316     TRACER("CGlxMetadataContainer::HandleItemModifiedL()");
  1363     TRACER("CGlxMetadataContainer::HandleItemModifiedL()");
  1317     }
  1364     }
       
  1365 
  1318 // ----------------------------------------------------------------------------
  1366 // ----------------------------------------------------------------------------
  1319 // ChangeMskL
  1367 // ChangeMskL
  1320 // ----------------------------------------------------------------------------
  1368 // ----------------------------------------------------------------------------
  1321 //     
  1369 //     
  1322 void CGlxMetadataContainer::ChangeMskL()
  1370 void CGlxMetadataContainer::ChangeMskL()
  1323 	{
  1371     {
  1324 	TRACER("CGlxMetadataContainer::ChangeMsk()");
  1372     TRACER("CGlxMetadataContainer::ChangeMskL()");
  1325 	TInt index = ListBox()->CurrentItemIndex();
  1373     CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
  1326 	CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();    	        
  1374     CleanupClosePushL(*uiUtility);
  1327     switch(index)
  1375     switch (ListBox()->CurrentItemIndex())
  1328         {
  1376         {
  1329         case ENameItem:        
  1377         case ENameItem:
  1330         case EDescriptionItem:
  1378         case EDescriptionItem:
  1331        	case ETagsItem:
  1379         case ETagsItem:
  1332         case EAlbumsItem:        
  1380         case EAlbumsItem:
  1333             {
  1381             {
  1334             uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition,
  1382             uiUtility->ScreenFurniture()->ModifySoftkeyIdL(
  1335             EAknSoftkeyEdit,R_GLX_METADATA_MSK_EDIT);
  1383                     CEikButtonGroupContainer::EMiddleSoftkeyPosition,
  1336             }        
  1384                     EAknSoftkeyEdit, R_GLX_METADATA_MSK_EDIT);
  1337         	break;        	
  1385             }
       
  1386             break;
  1338         case EDateAndTimeItem:
  1387         case EDateAndTimeItem:
  1339         case ELocationItem:
  1388         case ELocationItem:
  1340         case ESizeItem:
  1389         case ESizeItem:
  1341         case EDurationItem:
  1390         case EDurationItem:
  1342         case ElicenseItem:
  1391         case ElicenseItem:
  1343         case EResolutionItem:
  1392         case EResolutionItem:
  1344 	        {
  1393             {
  1345 	        uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition,
  1394             uiUtility->ScreenFurniture()->ModifySoftkeyIdL(
  1346             EAknSoftkeyEdit,R_GLX_METADATA_MSK_BLANK);            
  1395                     CEikButtonGroupContainer::EMiddleSoftkeyPosition,
  1347 	        }        
  1396                     EAknSoftkeyEdit, R_GLX_METADATA_MSK_BLANK);
  1348         	break;
  1397             }
       
  1398             break;
  1349         default:
  1399         default:
  1350 	        {
  1400             {
  1351 	        break;    
  1401             break;
  1352 	        }
  1402             }
  1353         }
  1403         }
  1354         
  1404 
  1355 	if ( uiUtility )
  1405     CleanupStack::PopAndDestroy(uiUtility);
  1356 		{
  1406     }
  1357 		uiUtility->Close();
  1407 
  1358 		}	
       
  1359 	}
       
  1360 	
       
  1361 // ---------------------------------------------------------------------------
  1408 // ---------------------------------------------------------------------------
  1362 // Parse the drive, path & extension from the old uri,
  1409 // Parse the drive, path & extension from the old uri,
  1363 // And return the modified uri by appending the new title
  1410 // And return the modified uri by appending the new title
  1364 // ---------------------------------------------------------------------------
  1411 // ---------------------------------------------------------------------------
  1365 TFileName CGlxMetadataContainer::ParseFileName(const TDesC& aTitleText)
  1412 TFileName CGlxMetadataContainer::ParseFileName(const TDesC& aTitleText)
  1366 	{
  1413     {
  1367 	TRACER("CGlxMetadataContainer::ParseFileName()");
  1414     TRACER("CGlxMetadataContainer::ParseFileName()");
  1368 	const TGlxMedia& media = iItemMediaList->Item(0);
  1415     const TGlxMedia& media = iItemMediaList->Item(0);
  1369 	TParsePtrC parsePtr(media.Uri());
  1416     TParsePtrC parsePtr(media.Uri());
  1370 
  1417 
  1371 	TFileName destinationFileName;
  1418     TFileName destinationFileName;
  1372 	destinationFileName.Append(parsePtr.DriveAndPath());
  1419     destinationFileName.Append(parsePtr.DriveAndPath());
  1373 	destinationFileName.Append(aTitleText);
  1420     destinationFileName.Append(aTitleText);
  1374 	destinationFileName.Append(parsePtr.Ext());
  1421     destinationFileName.Append(parsePtr.Ext());
  1375 
  1422 
  1376 	return destinationFileName;
  1423     return destinationFileName;
  1377 	}
  1424     }
  1378 
  1425 
  1379 // ---------------------------------------------------------------------------
  1426 // ---------------------------------------------------------------------------
  1380 // Refresh MediaList with modified FileName.
  1427 // Refresh MediaList with modified FileName.
  1381 // ---------------------------------------------------------------------------
  1428 // ---------------------------------------------------------------------------
  1382 void CGlxMetadataContainer::RefreshMediaListL(const TDesC& aModifiedUri)
  1429 void CGlxMetadataContainer::RefreshMediaListL(const TDesC& aModifiedUri)
  1383 	{
  1430     {
  1384 	//Refresh media list since media is renamed
  1431     //Refresh media list since media is renamed
  1385     TRACER("CGlxMetadataContainer::RefreshMediaList()");
  1432     TRACER("CGlxMetadataContainer::RefreshMediaListL()");
       
  1433     GLX_LOG_URI("CGlxMetadataContainer::RefreshMediaListL(%S)", &aModifiedUri);
  1386     if (iUri)
  1434     if (iUri)
  1387 		{
  1435         {
  1388 		delete iUri;
  1436         delete iUri;
  1389 		iUri = NULL;
  1437         iUri = NULL;
  1390 		}
  1438         }
  1391 	//always points to current media name
  1439     //always points to current media name
  1392 	iUri = aModifiedUri.AllocL();
  1440     iUri = aModifiedUri.AllocL();
  1393 	CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(*iUri);
  1441     CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(*iUri);
  1394 	CleanupStack::PushL(filter);
  1442     CleanupStack::PushL(filter);
  1395 
  1443 
  1396 	//Update media list's filter
  1444     //Update media list's filter
  1397 	iItemMediaList->SetFilterL(filter);
  1445     iItemMediaList->SetFilterL(filter);
  1398 	CleanupStack::PopAndDestroy(filter);
  1446     CleanupStack::PopAndDestroy(filter);
  1399     }
  1447     }
  1400 
  1448 
  1401 //End of file
  1449 //End of file