photosgallery/viewframework/views/metadatadialog/src/glxmetadatacontainer.cpp
branchRCL_3
changeset 9 6b87b143d312
parent 3 9a9c174934f5
child 13 71da52165949
equal deleted inserted replaced
5:f7f0874bfe7d 9:6b87b143d312
   143 // ---------------------------------------------------------
   143 // ---------------------------------------------------------
   144 //	
   144 //	
   145 CGlxMetadataContainer::~CGlxMetadataContainer()
   145 CGlxMetadataContainer::~CGlxMetadataContainer()
   146 	{
   146 	{
   147 	TRACER("CGlxMetadataContainer::~CGlxMetadataContainer");
   147 	TRACER("CGlxMetadataContainer::~CGlxMetadataContainer");
   148 	 if( iItemMediaList ) 
   148 	if( iItemMediaList ) 
   149     {
   149 		{
   150     iItemMediaList->RemoveContext(iMainListAttributecontext);
   150 		iItemMediaList->RemoveContext(iMainListAttributecontext);
   151     iItemMediaList->RemoveMediaListObserver(this);
   151 		iItemMediaList->RemoveMediaListObserver(this);
   152     iItemMediaList->Close();
   152 		iItemMediaList->Close();
   153     iItemMediaList = NULL;  
   153 		iItemMediaList = NULL;  
   154     } 
   154 		} 
   155     if ( iTagMediaList ) 
   155     if ( iTagMediaList ) 
   156     {
   156 		{
   157     iTagMediaList->RemoveContext(iTagContext);
   157 		iTagMediaList->RemoveContext(iTagContext);
   158     iTagMediaList->RemoveMediaListObserver(this); 
   158 		iTagMediaList->RemoveMediaListObserver(this); 
   159     iTagMediaList->Close();
   159 		iTagMediaList->Close();
   160     iTagMediaList = NULL;
   160 		iTagMediaList = NULL;
   161     }
   161 		}
   162     if ( iAlbumMediaList ) 
   162     if ( iAlbumMediaList ) 
   163     {
   163 		{
   164     iAlbumMediaList->RemoveContext(iAlbumContext);
   164 		iAlbumMediaList->RemoveContext(iAlbumContext);
   165     iAlbumMediaList->RemoveMediaListObserver(this); 
   165 		iAlbumMediaList->RemoveMediaListObserver(this); 
   166     iAlbumMediaList->Close();
   166 		iAlbumMediaList->Close();
   167     iAlbumMediaList = NULL;
   167 		iAlbumMediaList = NULL;
   168     }
   168 		}
   169     if( iTagContext )
   169     if( iTagContext )
   170     {
   170 		{
   171         delete iTagContext;
   171         delete iTagContext;
   172         iTagContext = NULL;
   172         iTagContext = NULL;
   173     }    
   173 		}    
   174     if( iAlbumContext )
   174     if( iAlbumContext )
   175     {
   175 		{
   176         delete iAlbumContext;
   176         delete iAlbumContext;
   177         iAlbumContext = NULL;
   177         iAlbumContext = NULL;
   178     }
   178 		}
   179     if( iMainListAttributecontext )
   179     if( iMainListAttributecontext )
   180        {
   180         {
   181        delete iMainListAttributecontext;
   181         delete iMainListAttributecontext;
   182        iMainListAttributecontext = NULL;
   182         iMainListAttributecontext = NULL;
   183        }       
   183         }       
   184     if( IsVisible() )
   184     if( IsVisible() )
   185 	    {
   185 	    {
   186 	    MakeVisible(EFalse);
   186 	    MakeVisible(EFalse);
   187 	    }
   187 	    }
   188     iTextSetter.Close();
   188     iTextSetter.Close();
   312     if(ListBox()->CurrentItemIndex()== ELocationItem)
   312     if(ListBox()->CurrentItemIndex()== ELocationItem)
   313         {
   313         {
   314         const TGlxMedia& item = iItemMediaList->Item(0);
   314         const TGlxMedia& item = iItemMediaList->Item(0);
   315         TCoordinate coordinate;
   315         TCoordinate coordinate;
   316         if(item.GetCoordinate(coordinate))
   316         if(item.GetCoordinate(coordinate))
   317                     {
   317 			{
   318                     return EFalse;
   318 			return EFalse;
   319                     }
   319 			}
   320         return ETrue;        
   320         return ETrue;        
   321         }
   321         }
   322     //return ETrue to dim the item
   322     //return ETrue to dim the item
   323     return ETrue;    
   323     return ETrue;    
   324     }
   324     }
   357             {
   357             {
   358             SetNameDescriptionL(index);
   358             SetNameDescriptionL(index);
   359             break;
   359             break;
   360             }
   360             }
   361         case ETagsItem:
   361         case ETagsItem:
   362         {
   362 			{
   363         //Set the focus of the item	
   363 			//Set the focus of the item	
   364         iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);
   364 			iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);
   365         //Launch add to container commandhandler via dialog observer.
   365 			//Launch add to container commandhandler via dialog observer.
   366         iDialogObesrver.AddTagL();
   366 			iDialogObesrver.AddTagL();
   367         break;         
   367 			break;         
   368         }
   368 			}
   369         case EAlbumsItem:
   369         case EAlbumsItem:
   370         {
   370 			{
   371         //Set the focus of the item	
   371 			//Set the focus of the item	
   372         iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);
   372 			iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);
   373         //Launch add to container commandhandler via dialog observer.
   373 			//Launch add to container commandhandler via dialog observer.
   374         iDialogObesrver.AddAlbumL();
   374 			iDialogObesrver.AddAlbumL();
   375         break;          
   375 			break;          
   376         }
   376 			}
       
   377 		case ELocationItem:
       
   378 			{
       
   379 			// Get the Media Item
       
   380 			const TGlxMedia& media = iItemMediaList->Item(0);    
       
   381 			// Test to see if the Coordinate is Present
       
   382 			TCoordinate coordinate;
       
   383 			if( !media.GetCoordinate(coordinate) )
       
   384 				{
       
   385 				HBufC *noLocationBuf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_INFO_NO_LOCATION);
       
   386 				GlxGeneralUiUtilities::ShowInfoNoteL(*noLocationBuf,ETrue);
       
   387 				CleanupStack::PopAndDestroy(noLocationBuf);
       
   388 				}
       
   389 			break;
       
   390 			}
   377         case EDurationItem:
   391         case EDurationItem:
   378         {
   392 			{
   379         //This is conditionis useful when the license item is selected for a image file
   393 			//This is condition is useful when the license item is selected for a image file
   380         if(iVideo)
   394 			if(iVideo)
   381             {
   395 				{
   382             break;
   396 				break;
   383             }
   397 				}
   384         }
   398 			}
   385         case ElicenseItem:
   399         case ElicenseItem:
   386         {
   400 			{
   387         //Create DRM utility
   401 			//Create DRM utility
   388         CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL();
   402 			CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL();
   389         CleanupClosePushL(*drmUtility);
   403 			CleanupClosePushL(*drmUtility);
   390         drmUtility->ShowDRMDetailsPaneL(iItemMediaList->Item(0).Uri());
   404 			drmUtility->ShowDRMDetailsPaneL(iItemMediaList->Item(0).Uri());
   391         CleanupStack::PopAndDestroy(drmUtility);
   405 			CleanupStack::PopAndDestroy(drmUtility);
   392         }  
   406 			}  
   393         break;
   407 			break;
   394         default:
   408         default:
   395         {
   409 			{
   396         break;    
   410 			break;    
   397         }
   411 			}
   398         }
   412         }
   399     }
   413     }
   400 //-----------------------------------------------------------------------------
   414 //-----------------------------------------------------------------------------
   401 // CGlxMetadataContainer::CreateMediaListForSelectedItemL
   415 // CGlxMetadataContainer::CreateMediaListForSelectedItemL
   402 //-----------------------------------------------------------------------------
   416 //-----------------------------------------------------------------------------
   615                 CExifModify* exifWriter = NULL;
   629                 CExifModify* exifWriter = NULL;
   616                 TRAPD(err,exifWriter = CExifModify::NewL( imageData->Des()));
   630                 TRAPD(err,exifWriter = CExifModify::NewL( imageData->Des()));
   617                 CleanupStack::PushL( exifWriter );
   631                 CleanupStack::PushL( exifWriter );
   618                 if(err == KErrNone)
   632                 if(err == KErrNone)
   619                     {
   633                     {
   620                 //Removes the specified IFD structure and all its tags from the Exif data
   634 					//Removes the specified IFD structure and all its tags from the Exif data
   621                 exifWriter->DeleteIfd  ( EIfdGps  );
   635 					exifWriter->DeleteIfd  ( EIfdGps  );
   622                 
   636                 
   623                 HBufC8* modifiedExif = exifWriter->WriteDataL( imageData->Des() );  //Modified Image Data
   637 					HBufC8* modifiedExif = exifWriter->WriteDataL( imageData->Des() );  //Modified Image Data
   624                 CleanupStack::PushL( modifiedExif );
   638 					CleanupStack::PushL( modifiedExif );
   625                 
   639                 
   626                 const TUint32 fileSize = modifiedExif->Des().Length();  //Size of Modified File
   640 					const TUint32 fileSize = modifiedExif->Des().Length();  //Size of Modified File
   627                 TInt oldSize;
   641 					TInt oldSize;
   628                 rFile.Size( oldSize );
   642 					rFile.Size( oldSize );
   629                 // set position to begin of file & write the Modified data (Without Location Information)
   643 					// set position to begin of file & write the Modified data (Without Location Information)
   630                 TInt pos = 0;
   644 					TInt pos = 0;
   631                 User::LeaveIfError( rFile.Seek( ESeekStart, pos ) );
   645 					User::LeaveIfError( rFile.Seek( ESeekStart, pos ) );
   632                 User::LeaveIfError( rFile.Write( modifiedExif->Des(), fileSize ) );
   646 					User::LeaveIfError( rFile.Write( modifiedExif->Des(), fileSize ) );
   633 
   647 
   634                 TTime lastModified;
   648 					TTime lastModified;
   635                 lastModified.UniversalTime();   
   649 					lastModified.UniversalTime();   
   636                 User::LeaveIfError( rFile.SetModified( lastModified ) );    //Change the Modified Time
   650 					User::LeaveIfError( rFile.SetModified( lastModified ) );    //Change the Modified Time
   637 
   651 
   638                 CleanupStack::PopAndDestroy( modifiedExif);
   652 					CleanupStack::PopAndDestroy( modifiedExif);
   639                     }
   653                     }
   640                 CleanupStack::PopAndDestroy( exifWriter);
   654                 CleanupStack::PopAndDestroy( exifWriter);
   641                 CleanupStack::PopAndDestroy( imageData );
   655                 CleanupStack::PopAndDestroy( imageData );
   642                 CleanupStack::PopAndDestroy( &rFile );
   656                 CleanupStack::PopAndDestroy( &rFile );
   643                 CleanupStack::PopAndDestroy( &rFs );
   657                 CleanupStack::PopAndDestroy( &rFs );
   673 // ----------------------------------------------------------------------------
   687 // ----------------------------------------------------------------------------
   674 // CGlxMetadataContainer::SetAttributes
   688 // CGlxMetadataContainer::SetAttributes
   675 // ----------------------------------------------------------------------------
   689 // ----------------------------------------------------------------------------
   676 //
   690 //
   677 void CGlxMetadataContainer::SetAttributesL(TMPXAttribute attribute)
   691 void CGlxMetadataContainer::SetAttributesL(TMPXAttribute attribute)
   678 {
   692 	{
   679     TRACER("CGlxMetadataContainer::SetAttributesL");    
   693     TRACER("CGlxMetadataContainer::SetAttributesL");    
   680     
   694     
   681     //create the tags and albums medialist once the item medialist is populated
   695     //create the tags and albums medialist once the item medialist is populated
   682     //Tags and albums medialist can be created only with media ID.
   696     //Tags and albums medialist can be created only with media ID.
   683     if(!iTagMediaList)
   697     if(!iTagMediaList)
   684     {
   698 		{
   685     CreateTagsMediaListL();
   699 		CreateTagsMediaListL();
   686     }		
   700 		}		
   687     if(!iAlbumMediaList)
   701     if(!iAlbumMediaList)
   688     {
   702 		{
   689     CreateAlbumsMediaListL();	
   703 		CreateAlbumsMediaListL();	
   690     }
   704 		}
   691     if(!iSetVisible)
   705     if(!iSetVisible)
   692     {
   706 		{
   693     iSetVisible = ETrue;
   707 		iSetVisible = ETrue;
   694     SetDurationLIicenseItemVisibilityL();
   708 		SetDurationLIicenseItemVisibilityL();
   695     }
   709 		}
   696     TGlxMedia item = iItemMediaList->Item(0);
   710     TGlxMedia item = iItemMediaList->Item(0);
   697     //Create the string convertor instance 
   711     //Create the string convertor instance 
   698     //String convertor class with provide the specific format for date,location and duration and size.
   712     //String convertor class with provide the specific format for date,location and duration and size.
   699     CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
   713     CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
   700     CleanupStack::PushL(stringConverter );
   714     CleanupStack::PushL(stringConverter );
   712         stringConverter->AsStringL(item,
   726         stringConverter->AsStringL(item,
   713                                    attribute,0, string );
   727                                    attribute,0, string );
   714         }
   728         }
   715     //get the settings item based on the attribute and set the text.
   729     //get the settings item based on the attribute and set the text.
   716     if ( string )
   730     if ( string )
   717     {
   731 		{
   718     iTextSetter.Copy(KGlxTextSetter);
   732 		iTextSetter.Copy(KGlxTextSetter);
   719     iTextSetter.Append(*string);
   733 		iTextSetter.Append(*string);
   720     if(attribute == KMPXMediaGeneralSize)
   734 		if(attribute == KMPXMediaGeneralSize)
   721     {
   735 			{
   722     EditItemL(ESizeItem,EFalse);
   736 			EditItemL(ESizeItem,EFalse);
   723     }
   737 			}
   724     else if(attribute == KMPXMediaGeneralDuration)
   738 		else if(attribute == KMPXMediaGeneralDuration)
   725     {
   739 			{
   726     EditItemL(EDurationItem,EFalse);
   740 			EditItemL(EDurationItem,EFalse);
   727     }
   741 			}
   728     else if(attribute == KMPXMediaGeneralTitle)
   742 		else if(attribute == KMPXMediaGeneralTitle)
   729     {
   743 			{
   730     EditItemL(ENameItem,EFalse);
   744 			EditItemL(ENameItem,EFalse);
   731     }
   745 			}
   732     else if(attribute == KMPXMediaGeneralDate)
   746 		else if(attribute == KMPXMediaGeneralDate)
   733     {  
   747 			{  
   734     EditItemL(EDateAndTimeItem,EFalse);
   748 			EditItemL(EDateAndTimeItem,EFalse);
   735     }
   749 			}
   736     else if(attribute == KMPXMediaGeneralComment)
   750 		else if(attribute == KMPXMediaGeneralComment)
   737     {
   751 			{
   738     EditItemL(EDescriptionItem,EFalse);
   752 			EditItemL(EDescriptionItem,EFalse);
   739     }
   753 			}
   740     else if(attribute == KGlxMediaGeneralLocation)
   754 		else if(attribute == KGlxMediaGeneralLocation)
   741     {
   755 			{
   742     EditItemL(ELocationItem,EFalse);
   756 			EditItemL(ELocationItem,EFalse);
   743     }
   757 			}
   744     else if(attribute == KGlxMediaGeneralDimensions)
   758 		else if(attribute == KGlxMediaGeneralDimensions)
   745     {
   759 			{
   746     EditItemL(EResolutionItem,EFalse);
   760 			EditItemL(EResolutionItem,EFalse);
   747     }    
   761 			}    
   748     else
   762 		else
   749     {
   763 			{
   750     
   764     
   751     } 
   765 			} 
   752     delete string;
   766 		delete string;
   753     string = NULL;
   767 		string = NULL;
   754     }
   768 		}
   755     CleanupStack::PopAndDestroy(stringConverter );
   769     CleanupStack::PopAndDestroy(stringConverter );
   756 }
   770 	}
   757 
   771 
   758 // ----------------------------------------------------------------------------
   772 // ----------------------------------------------------------------------------
   759 // CGlxMetadataContainer::SetNameDescriptionL
   773 // CGlxMetadataContainer::SetNameDescriptionL
   760 // ----------------------------------------------------------------------------
   774 // ----------------------------------------------------------------------------
   761 //
   775 //
   843                              (*SettingItemArray())[ETagsItem]; 
   857                              (*SettingItemArray())[ETagsItem]; 
   844                              //Set the tag setter to empty string before filling in the data.                                                
   858                              //Set the tag setter to empty string before filling in the data.                                                
   845      iTagSetter.Copy(KGlxTextSetter);
   859      iTagSetter.Copy(KGlxTextSetter);
   846      //Loop to appened all the tags to the iTagSetter.
   860      //Loop to appened all the tags to the iTagSetter.
   847      for( TInt index = 0 ; index < iTagMediaList->Count() ; index++ )
   861      for( TInt index = 0 ; index < iTagMediaList->Count() ; index++ )
   848                  {
   862 		{
   849                  if(iTagSetter.Length())
   863 		if(iTagSetter.Length())
   850                     {
   864 			{
   851                      iTagSetter.Append(KGlxComma);
   865 			iTagSetter.Append(KGlxComma);
   852                     }
   866 			}
   853                  const TGlxMedia&  item = iTagMediaList->Item( index );
   867 		const TGlxMedia&  item = iTagMediaList->Item( index );
   854                  const TDesC& title = item.Title();
   868 		const TDesC& title = item.Title();
   855                  iTagSetter.Append(title);
   869 		iTagSetter.Append(title);
   856                  }    
   870 		}    
   857      EditItemL(ETagsItem,EFalse);
   871      EditItemL(ETagsItem,EFalse);
   858      }
   872      }
   859 // ----------------------------------------------------------------------------
   873 // ----------------------------------------------------------------------------
   860 // CGlxMetadataContainer::UpdateAlbumsL()
   874 // CGlxMetadataContainer::UpdateAlbumsL()
   861 // ----------------------------------------------------------------------------
   875 // ----------------------------------------------------------------------------
   862 // 
   876 // 
   863 void CGlxMetadataContainer::UpdateAlbumsL()
   877 void CGlxMetadataContainer::UpdateAlbumsL()
   864     {
   878     {
   865     //Get the tag setting item handle to set the text
   879     //Get the tag setting item handle to set the text
   866      CAknSettingItem* settingsitem = 
   880     CAknSettingItem* settingsitem = 
   867                          (*SettingItemArray())[EAlbumsItem];     
   881                         (*SettingItemArray())[EAlbumsItem];     
   868      //Set the tag setter to empty string before filling in the data.
   882     //Set the tag setter to empty string before filling in the data.
   869      iAlbumSetter.Copy(KGlxTextSetter);
   883     iAlbumSetter.Copy(KGlxTextSetter);
   870      //Loop to appened all the tags to the iAlbumSetter.
   884     //Loop to appened all the tags to the iAlbumSetter.
   871      for( TInt index = 0 ; index < iAlbumMediaList->Count() ; index++ )
   885     for( TInt index = 0 ; index < iAlbumMediaList->Count() ; index++ )
   872      {
   886 		{
   873          if(iAlbumSetter.Length())
   887         if(iAlbumSetter.Length())
   874          {
   888 			{
   875          iAlbumSetter.Append(KGlxComma);
   889 			iAlbumSetter.Append(KGlxComma);
   876          }
   890 			}
   877          const TGlxMedia&  item = iAlbumMediaList->Item( index );
   891 		const TGlxMedia&  item = iAlbumMediaList->Item( index );
   878          const TDesC& title = item.Title();
   892 		const TDesC& title = item.Title();
   879          iAlbumSetter.Append(title);
   893 		iAlbumSetter.Append(title);
   880      }
   894 		}
   881      EditItemL(EAlbumsItem,EFalse);
   895 	EditItemL(EAlbumsItem,EFalse);
   882     }
   896     }
   883 // ----------------------------------------------------------------------------
   897 // ----------------------------------------------------------------------------
   884 // CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL()
   898 // CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL()
   885 // ----------------------------------------------------------------------------
   899 // ----------------------------------------------------------------------------
   886 // 
   900 // 
   905         this->HandleChangeInItemArrayOrVisibilityL();
   919         this->HandleChangeInItemArrayOrVisibilityL();
   906         iVideo = ETrue;
   920         iVideo = ETrue;
   907         }    
   921         }    
   908      if( media && media->IsSupported(KMPXMediaDrmProtected))
   922      if( media && media->IsSupported(KMPXMediaDrmProtected))
   909         {
   923         {
   910          if(item.IsDrmProtected())
   924 		if(item.IsDrmProtected())
   911              {
   925 			{
   912              hiddenItem = (*SettingItemArray())[ElicenseItem];
   926 			hiddenItem = (*SettingItemArray())[ElicenseItem];
   913              //Set the License item visible
   927 			//Set the License item visible
   914              hiddenItem->SetHidden(EFalse);             
   928 			hiddenItem->SetHidden(EFalse);             
   915              //Required to refresh the listbox when any items visiblity is changed
   929 			//Required to refresh the listbox when any items visiblity is changed
   916              this->HandleChangeInItemArrayOrVisibilityL();
   930 			this->HandleChangeInItemArrayOrVisibilityL();
   917              }
   931 			}
   918         }
   932         }
   919     }   
   933     }   
   920 //Medialist callbacks.    
   934 //Medialist callbacks.    
   921 // ----------------------------------------------------------------------------
   935 // ----------------------------------------------------------------------------
   922 // CGlxMetadataContainer::HandleAttributesAvailableL
   936 // CGlxMetadataContainer::HandleAttributesAvailableL
   927     {
   941     {
   928     TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()");
   942     TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()");
   929     //generic medialist for the item for all the attributes required other than tags and albums.
   943     //generic medialist for the item for all the attributes required other than tags and albums.
   930     if(aList == iItemMediaList)
   944     if(aList == iItemMediaList)
   931         {
   945         {
   932          // Loop untill it checks for all the avialable attributes
   946 		// Loop untill it checks for all the avialable attributes
   933          for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--)
   947 		for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--)
   934              {
   948 			{
   935              //set attributes to the items in the container
   949 			//set attributes to the items in the container
   936              SetAttributesL(aAttributes[i]);                   
   950 			SetAttributesL(aAttributes[i]);                   
   937              }
   951 			}
   938         }
   952         }
   939     //updation of tags and albums list based on the medialist callback.
   953     //updation of tags and albums list based on the medialist callback.
   940     if(aList == iTagMediaList ||  aList == iAlbumMediaList)
   954     if(aList == iTagMediaList ||  aList == iAlbumMediaList)
   941         {
   955         {
   942         for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--)
   956         for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--)
   945             for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--)
   959             for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--)
   946                 { 
   960                 { 
   947                 if( titleAtrribute == aAttributes[i] )
   961                 if( titleAtrribute == aAttributes[i] )
   948                     {
   962                     {
   949                     if(aList == iTagMediaList)
   963                     if(aList == iTagMediaList)
   950                             {     
   964 						{     
   951                             UpdateTagsL();
   965 						UpdateTagsL();
   952                             }
   966 						}
   953                         else if(aList == iAlbumMediaList)
   967 					else if(aList == iAlbumMediaList)
   954                             {
   968 						{
   955                             UpdateAlbumsL();
   969 						UpdateAlbumsL();
   956                             }          
   970 						}          
   957                     }           
   971                     }           
   958                 }
   972                 }
   959           
   973           
   960             }
   974             }
   961         }
   975         }
   970      MGlxMediaList* aList )
   984      MGlxMediaList* aList )
   971     {
   985     {
   972     TRACER("CGlxMetadataContainer::HandleItemAddedL()");
   986     TRACER("CGlxMetadataContainer::HandleItemAddedL()");
   973     
   987     
   974     if(!iTagMediaList)
   988     if(!iTagMediaList)
   975     {
   989 		{
   976         CreateTagsMediaListL();
   990         CreateTagsMediaListL();
   977     }       
   991 		}       
   978     if(!iAlbumMediaList)
   992     if(!iAlbumMediaList)
   979     {
   993 		{
   980         CreateAlbumsMediaListL();   
   994         CreateAlbumsMediaListL();   
   981     }
   995 		}
   982     if(!iMarquee)
   996     if(!iMarquee)
   983     {
   997 		{
   984         EnableMarqueingL();
   998         EnableMarqueingL();
   985     }
   999 		}
   986     SetDurationLIicenseItemVisibilityL();
  1000     SetDurationLIicenseItemVisibilityL();
   987     if(aList == iTagMediaList)
  1001     if(aList == iTagMediaList)
   988            {     
  1002 		{     
   989            UpdateTagsL();
  1003 		UpdateTagsL();
   990            }
  1004 		}
   991        else if(aList == iAlbumMediaList)
  1005 	else if(aList == iAlbumMediaList)
   992            {
  1006 		{
   993            UpdateAlbumsL();
  1007 		UpdateAlbumsL();
   994            }
  1008 		}
   995     if(aList == iItemMediaList)
  1009     if(aList == iItemMediaList)
   996         {
  1010         {
   997         if(iItemMediaList->Count())
  1011         if(iItemMediaList->Count())
   998            {
  1012 			{
   999            TGlxMedia item = iItemMediaList->Item(0);
  1013 			TGlxMedia item = iItemMediaList->Item(0);
  1000            CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
  1014 			CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
  1001            CleanupStack::PushL(stringConverter );
  1015 			CleanupStack::PushL(stringConverter );
  1002            for(TInt index = 0; index <= 9; index++)
  1016 			for(TInt index = 0; index <= 9; index++)
  1003                {
  1017 				{
  1004                   HBufC* string = NULL;               
  1018 				HBufC* string = NULL;               
  1005   
  1019   
  1006                   if(index == ESizeItem)
  1020 				if(index == ESizeItem)
  1007                   {
  1021 					{
  1008                   stringConverter->AsStringL(item,
  1022 					stringConverter->AsStringL(item,
  1009                                              KMPXMediaGeneralSize,0, string );              
  1023 							KMPXMediaGeneralSize,0, string );              
  1010                   }
  1024 					}
  1011                   else if(index == EDurationItem)
  1025 				else if(index == EDurationItem)
  1012                   {
  1026 					{
  1013                   stringConverter->AsStringL(item, 
  1027 					stringConverter->AsStringL(item, 
  1014                                              KMPXMediaGeneralDuration,0, string );
  1028 							KMPXMediaGeneralDuration,0, string );
  1015                   }
  1029 					}
  1016                   else if(index == ENameItem)
  1030 				else if(index == ENameItem)
  1017                   {
  1031 					{
  1018                   stringConverter->AsStringL(item,
  1032 					stringConverter->AsStringL(item,
  1019                                              KMPXMediaGeneralTitle,0, string );
  1033 							KMPXMediaGeneralTitle,0, string );
  1020                   }
  1034 					}
  1021                   else if(index == EDateAndTimeItem)
  1035 				else if(index == EDateAndTimeItem)
  1022                   {  
  1036 					{  
  1023                   stringConverter->AsStringL( item, 
  1037 					stringConverter->AsStringL( item, 
  1024                                               KMPXMediaGeneralDate,
  1038 							KMPXMediaGeneralDate,
  1025                                               R_QTN_DATE_USUAL_WITH_ZERO,string );
  1039 							R_QTN_DATE_USUAL_WITH_ZERO,string );
  1026                   }
  1040 					}
  1027                   else if(index == EDescriptionItem)
  1041 				else if(index == EDescriptionItem)
  1028                   {
  1042 					{
  1029                   stringConverter->AsStringL(item,
  1043 					stringConverter->AsStringL(item,
  1030                                              KMPXMediaGeneralComment,0, string ); 
  1044 							KMPXMediaGeneralComment,0, string ); 
  1031                   }
  1045 					}
  1032                   else if(index == ELocationItem)
  1046 				else if(index == ELocationItem)
  1033                   {
  1047 					{
  1034                   stringConverter->AsStringL(item,
  1048 					stringConverter->AsStringL(item,
  1035                                              KGlxMediaGeneralLocation,0, string );
  1049 							KGlxMediaGeneralLocation,0, string );
  1036                   }
  1050 					}
  1037                   else if(index == EResolutionItem)
  1051 				else if(index == EResolutionItem)
  1038                   {
  1052 					{
  1039                   stringConverter->AsStringL(item,
  1053 					stringConverter->AsStringL(item,
  1040                                              KGlxMediaGeneralDimensions,0, string );
  1054 							KGlxMediaGeneralDimensions,0, string );
  1041                   }    
  1055 					}    
  1042                   else
  1056 				else
  1043                   {
  1057 					{
  1044                   //no implementation
  1058 					//no implementation
  1045                   } 
  1059 					} 
  1046                   if(string)
  1060 				if(string)
  1047                       {
  1061 					{
  1048                       iTextSetter.Copy(KGlxTextSetter);
  1062 					iTextSetter.Copy(KGlxTextSetter);
  1049                       iTextSetter.Append(*string);
  1063 					iTextSetter.Append(*string);
  1050                      }
  1064 					}
  1051                   EditItemL(index,EFalse);                 
  1065 				EditItemL(index,EFalse);                 
  1052                   delete string;
  1066 				delete string;
  1053                   string = NULL;
  1067 				string = NULL;
  1054                }
  1068 				}
  1055            CleanupStack::PopAndDestroy(stringConverter );
  1069 			CleanupStack::PopAndDestroy(stringConverter );
  1056            }   
  1070 			}   
  1057         }
  1071         }
  1058     }
  1072     }
  1059 // ----------------------------------------------------------------------------
  1073 // ----------------------------------------------------------------------------
  1060 // EnableMarqueingL
  1074 // EnableMarqueingL
  1061 // ----------------------------------------------------------------------------
  1075 // ----------------------------------------------------------------------------
  1066     iMarquee = ETrue;
  1080     iMarquee = ETrue;
  1067     ListBox()->UseLogicalToVisualConversion(ETrue);
  1081     ListBox()->UseLogicalToVisualConversion(ETrue);
  1068     ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams (KMarqueeLoopCount,
  1082     ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams (KMarqueeLoopCount,
  1069             KMarqueeScrollAmount, KMarqueeScrollDelay, KMarqueeScrollInterval);
  1083             KMarqueeScrollAmount, KMarqueeScrollDelay, KMarqueeScrollInterval);
  1070     ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
  1084     ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
       
  1085 
       
  1086 	//Fetch the current item index
       
  1087     TInt index = ListBox()->CurrentItemIndex();
       
  1088 
       
  1089 	//Reset the disable marquee flag, so that marquee effect can continue (this is normally reset by 
       
  1090 	//base class of glxmetaDatadialog::HandlePointerEventL()
       
  1091     ListBox()->ItemDrawer()->ClearFlags(CListItemDrawer::EDisableMarquee);
       
  1092 	
       
  1093 	//This is the function which actually starts marquee effect. It is anyway being called from base
       
  1094 	//implementation of OfferKeyEventL(), but for pointer event, we have to call
       
  1095 	//this function
       
  1096     ListBox()->DrawItem(index);
  1071     }    
  1097     }    
  1072 // ----------------------------------------------------------------------------
  1098 // ----------------------------------------------------------------------------
  1073 // HandleCommandCompleteL
  1099 // HandleCommandCompleteL
  1074 // ----------------------------------------------------------------------------
  1100 // ----------------------------------------------------------------------------
  1075 // 
  1101 // 
  1108 			}
  1134 			}
  1109 		}
  1135 		}
  1110     //To update the location information once the delete operation is successful.
  1136     //To update the location information once the delete operation is successful.
  1111     if(aList == iItemMediaList && iLocationinfo 
  1137     if(aList == iItemMediaList && iLocationinfo 
  1112             && static_cast<TAny*>( this ) == aSessionId)
  1138             && static_cast<TAny*>( this ) == aSessionId)
  1113       {
  1139 		{
  1114       TGlxMedia media = iItemMediaList->Item(0) ;
  1140 		TGlxMedia media = iItemMediaList->Item(0) ;
  1115       media.DeleteLocationAttribute();
  1141 		media.DeleteLocationAttribute();
  1116       iLocationinfo = EFalse;      
  1142 		iLocationinfo = EFalse;      
  1117             if ( aError == KErrNone )
  1143 		if ( aError == KErrNone )
  1118                 {
  1144 			{
  1119                  iTextSetter.Copy(KGlxTextSetter);
  1145 			iTextSetter.Copy(KGlxTextSetter);
  1120                  EditItemL(ELocationItem,EFalse);
  1146 			EditItemL(ELocationItem,EFalse);
  1121                 }
  1147 			}
  1122        }
  1148 		}
  1123      }
  1149 	}
  1124           
  1150           
  1125 // ----------------------------------------------------------------------------
  1151 // ----------------------------------------------------------------------------
  1126 // HandleItemRemoved
  1152 // HandleItemRemoved
  1127 // ----------------------------------------------------------------------------
  1153 // ----------------------------------------------------------------------------
  1128 //  
  1154 //  
  1152     }
  1178     }
  1153 // ----------------------------------------------------------------------------
  1179 // ----------------------------------------------------------------------------
  1154 // HandleMessageL
  1180 // HandleMessageL
  1155 // ----------------------------------------------------------------------------
  1181 // ----------------------------------------------------------------------------
  1156 //    
  1182 //    
  1157  void CGlxMetadataContainer::HandleMessageL( const CMPXMessage& /*aMessage*/, 
  1183 void CGlxMetadataContainer::HandleMessageL( const CMPXMessage& /*aMessage*/, 
  1158     MGlxMediaList* /*aList*/ )
  1184     MGlxMediaList* /*aList*/ )
  1159     {
  1185     {
  1160     TRACER("CGlxMetadataContainer::HandleMessageL()");
  1186     TRACER("CGlxMetadataContainer::HandleMessageL()");
  1161     }
  1187     }
  1162 // ----------------------------------------------------------------------------
  1188 // ----------------------------------------------------------------------------
  1241 	        break;    
  1267 	        break;    
  1242 	        }
  1268 	        }
  1243         }
  1269         }
  1244         
  1270         
  1245 	if ( uiUtility )
  1271 	if ( uiUtility )
  1246 	        {
  1272 		{
  1247 	        uiUtility->Close();
  1273 		uiUtility->Close();
  1248 	        }	
  1274 		}	
  1249 	}
  1275 	}
  1250 	
  1276 	
  1251 // ---------------------------------------------------------------------------
  1277 // ---------------------------------------------------------------------------
  1252 // Parse the drive, path & extension from the old uri,
  1278 // Parse the drive, path & extension from the old uri,
  1253 // And return the modified uri by appending the new title
  1279 // And return the modified uri by appending the new title
  1277 	    iItemMediaList->RemoveContext(iMainListAttributecontext);
  1303 	    iItemMediaList->RemoveContext(iMainListAttributecontext);
  1278 	    iItemMediaList->RemoveMediaListObserver(this);
  1304 	    iItemMediaList->RemoveMediaListObserver(this);
  1279 	    iItemMediaList->Close();
  1305 	    iItemMediaList->Close();
  1280 	    iItemMediaList = NULL;
  1306 	    iItemMediaList = NULL;
  1281 	    if( iMainListAttributecontext )
  1307 	    if( iMainListAttributecontext )
  1282 	       {
  1308 			{
  1283 	       delete iMainListAttributecontext;
  1309 			delete iMainListAttributecontext;
  1284 	       iMainListAttributecontext = NULL;
  1310 			iMainListAttributecontext = NULL;
  1285 	       }
  1311 			}
  1286 	    CreateMediaListForSelectedItemL(ETrue);
  1312 	    CreateMediaListForSelectedItemL(ETrue);
  1287 	    }
  1313 	    }
  1288 	}
  1314 	}
  1289 
  1315 
  1290 // ---------------------------------------------------------------------------
  1316 // ---------------------------------------------------------------------------