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