photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatacontainer.cpp
branchRCL_3
changeset 24 ea65f74e6de4
parent 18 78ad99c24f08
equal deleted inserted replaced
23:b023a8d2866a 24:ea65f74e6de4
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 /*
       
    18  * glximgvwrmetadatacontainer.cpp
       
    19  *
     8  *
    20  *  Created on: Oct 22, 2009
     9  * Initial Contributors:
    21  *      Author: sourbasu
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Image viewer metadata dialog implementation
    22  */
    15  */
    23 
       
    24 
    16 
    25 #include  "glximgvwrmetadatacontainer.h"
    17 #include  "glximgvwrmetadatacontainer.h"
    26 #include  "glxustringconverter.h"                // converts the symbian types to UString type
    18 #include  "glxustringconverter.h"                // converts the symbian types to UString type
    27 #include  <AknUtils.h>
       
    28 #include  <StringLoader.h>
    19 #include  <StringLoader.h>
    29 #include  <glxmetadatadialog.rsg>
    20 #include  <glxmetadatadialog.rsg>
    30 #include  <glxviewbase.rsg>
       
    31 #include  <glxlog.h>
    21 #include  <glxlog.h>
    32 #include  <glxtracer.h>
    22 #include  <glxtracer.h>
    33 #include  <glxscreenfurniture.h>
    23 #include  <glxscreenfurniture.h>
    34 #include  <glxdetailsmulmodelprovider.h>          //Details data provider
    24 #include  <glxdetailsmulmodelprovider.h>          //Details data provider
    35 #include  <glxdetailsboundcommand.hrh>
    25 #include  <glxdetailsboundcommand.hrh>
    36 #include  <glxcommandhandleraddtocontainer.h>     // For CGlxCommandHandlerAddToContainer
       
    37 #include  <glxcommandhandlers.hrh>                // for command handler id
       
    38 #include  <glxcommandfactory.h>                   //for command factory
       
    39 #include  <mpxcommandgeneraldefs.h>               // Content ID identifying general category of content provided
    26 #include  <mpxcommandgeneraldefs.h>               // Content ID identifying general category of content provided
    40 
       
    41 #include  <glxtextentrypopup.h>    
       
    42 #include  <glxcollectionpluginall.hrh>
       
    43 #include  <glxuistd.h>
       
    44 #include  <glxcollectionplugintags.hrh>           // tag collection plugin uid
       
    45 #include  <glxthumbnailattributeinfo.h>           // KGlxMediaIdThumbnail
       
    46 #include  <glxattributeretriever.h>               // CGlxAttributeReteiver
    27 #include  <glxattributeretriever.h>               // CGlxAttributeReteiver
    47 #include  <aknQueryControl.h>
       
    48 #include  <glxdrmutility.h>                       //For launching DRM details pane
    28 #include  <glxdrmutility.h>                       //For launching DRM details pane
    49 #include  <glxgeneraluiutilities.h>               // General utilties class definition
    29 #include  <glxuiutilities.rsg>
    50 #include  <ExifModify.h>    
       
    51 #include  <glxuiutilities.rsg>                    //For CExifModify
       
    52 #include  <mpxmediadrmdefs.h>
    30 #include  <mpxmediadrmdefs.h>
    53 #include  <glxfilterfactory.h>
    31 #include  <glxfilterfactory.h>
    54 #include <glxcollectionpluginimageviewer.hrh>
    32 #include  <glxcollectionpluginimageviewer.hrh>
    55 
    33 #include  <eikfrlb.h>                              // For marquee 
    56 //marquee
    34 #include  <eikfrlbd.h>                             // For marquee
    57 
    35 
    58 #include <eikfrlb.h>
    36 const TInt KMediaListId = 0x2000D248;
    59 #include <eikfrlbd.h>
    37 const TInt KMarqueeLoopCount = 3;
    60 const TInt KMaxMediaPopupTitleLength = 0x100;
    38 const TInt KMarqueeScrollAmount = 20;
    61 const TInt KMediaListId              = 0x2000D248;
    39 const TInt KMarqueeScrollDelay = 1000000;
    62 const TInt KMarqueeLoopCount         = 3;
    40 const TInt KMarqueeScrollInterval = 200000;
    63 const TInt KMarqueeScrollAmount      = 20;
       
    64 const TInt KMarqueeScrollDelay       = 1000000;
       
    65 const TInt KMarqueeScrollInterval    = 200000;
       
    66 
    41 
    67 // ============================ MEMBER FUNCTIONS ===============================
    42 // ============================ MEMBER FUNCTIONS ===============================
    68 
    43 
    69 // ---------------------------------------------------------
    44 // ---------------------------------------------------------
    70 // NewL
    45 // NewL
    71 // ---------------------------------------------------------
    46 // ---------------------------------------------------------
    72 //  
    47 //  
    73 CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewL( const TRect& aRect,const TDesC& item)
    48 CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewL(
    74     {
    49         const TRect& aRect, const TDesC& item)
    75     TRACER("CGlxImgVwrMetadataContainer::NewL");  
    50     {
    76     CGlxImgVwrMetadataContainer* self = CGlxImgVwrMetadataContainer::NewLC( aRect,item);
    51     TRACER("CGlxImgVwrMetadataContainer::NewL");
       
    52     CGlxImgVwrMetadataContainer* self = CGlxImgVwrMetadataContainer::NewLC(
       
    53             aRect, item);
    77     CleanupStack::Pop(self);
    54     CleanupStack::Pop(self);
    78     return self;
    55     return self;
    79     }
    56     }
    80 
    57 
    81 // ---------------------------------------------------------
    58 // ---------------------------------------------------------
    82 // NewLC
    59 // NewLC
    83 // ---------------------------------------------------------
    60 // ---------------------------------------------------------
    84 //  
    61 //  
    85 CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewLC( const TRect& aRect,const TDesC& aUri)
    62 CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewLC(
    86     {
    63         const TRect& aRect, const TDesC& aUri)
    87     TRACER("CGlxImgVwrMetadataContainer::NewLC"); 
    64     {
    88     CGlxImgVwrMetadataContainer* self = new(ELeave) CGlxImgVwrMetadataContainer(aUri);
    65     TRACER("CGlxImgVwrMetadataContainer::NewLC");
       
    66     CGlxImgVwrMetadataContainer* self =
       
    67             new (ELeave) CGlxImgVwrMetadataContainer(aUri);
    89     CleanupStack::PushL(self);
    68     CleanupStack::PushL(self);
    90     self->ConstructL( aRect);
    69     self->ConstructL(aRect);
    91     return self;
    70     return self;
    92     }
    71     }
    93 
    72 
    94 // ---------------------------------------------------------
    73 // ---------------------------------------------------------
    95 // CGlxImgVwrMetadataContainer
    74 // CGlxImgVwrMetadataContainer
    96 // ---------------------------------------------------------
    75 // ---------------------------------------------------------
    97 //  
    76 //  
    98 CGlxImgVwrMetadataContainer::CGlxImgVwrMetadataContainer(const TDesC& aUri)
    77 CGlxImgVwrMetadataContainer::CGlxImgVwrMetadataContainer(
    99 :iUri(aUri)
    78         const TDesC& aUri) : iUri(aUri)
   100         {
    79     {
   101         // No implementation
    80     // No implementation
   102         }
    81     }
   103 
    82 
   104 // ---------------------------------------------------------
    83 // ---------------------------------------------------------
   105 // CGlxImgVwrMetadataContainer::ConstructL
    84 // CGlxImgVwrMetadataContainer::ConstructL
   106 // ---------------------------------------------------------
    85 // ---------------------------------------------------------
   107 //  
    86 //  
   108 void CGlxImgVwrMetadataContainer::ConstructL( const TRect& /*aRect*/ )
    87 void CGlxImgVwrMetadataContainer::ConstructL(const TRect& /*aRect*/)
   109     {   
    88     {
   110     TRACER("CGlxMetadataContainer::ConstructLL()");
    89     TRACER("CGlxMetadataContainer::ConstructLL()");
   111     //Creating the RBuf texts for all the items except tags & albums
    90     //Creating the RBuf texts for all the items except tags & albums
   112     //which would be updated as whne the item is edited
    91     //which would be updated as whne the item is edited
   113     iTextSetter.CreateL(KMaxFileName);
    92     iTextSetter.CreateL(KMaxFileName);
   114     CreateMediaListForSelectedItemL();
    93     CreateMediaListForSelectedItemL();
   119 // ---------------------------------------------------------
    98 // ---------------------------------------------------------
   120 //  
    99 //  
   121 CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer()
   100 CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer()
   122     {
   101     {
   123     TRACER("CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer");
   102     TRACER("CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer");
   124     if( iItemMediaList ) 
   103     if (iItemMediaList)
   125         {
   104         {
   126         iItemMediaList->RemoveContext(iMainListAttributecontext);
   105         iItemMediaList->RemoveContext(iMainListAttributecontext);
   127         iItemMediaList->RemoveMediaListObserver(this);
   106         iItemMediaList->RemoveMediaListObserver(this);
   128         iItemMediaList->Close();
   107         iItemMediaList->Close();
   129         iItemMediaList = NULL;  
   108         iItemMediaList = NULL;
   130         } 
   109         }
   131     if( iMainListAttributecontext )
   110     if (iMainListAttributecontext)
   132         {
   111         {
   133         delete iMainListAttributecontext;
   112         delete iMainListAttributecontext;
   134         iMainListAttributecontext = NULL;
   113         iMainListAttributecontext = NULL;
   135         }
   114         }
   136     if( IsVisible() )
   115     if (IsVisible())
   137         {
   116         {
   138         MakeVisible(EFalse);
   117         MakeVisible(EFalse);
   139         }
   118         }
   140     iTextSetter.Close();
   119     iTextSetter.Close();
   141     }
   120     }
   145 //-----------------------------------------------------------------------------
   124 //-----------------------------------------------------------------------------
   146 MGlxMediaList& CGlxImgVwrMetadataContainer::MediaList()
   125 MGlxMediaList& CGlxImgVwrMetadataContainer::MediaList()
   147     {
   126     {
   148     TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()");
   127     TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()");
   149     //returns the active medialist.
   128     //returns the active medialist.
   150     return *iItemMediaList;    
   129     return *iItemMediaList;
   151     }
   130     }
   152 
   131 
   153 //-----------------------------------------------------------------------------
   132 //-----------------------------------------------------------------------------
   154 // CGlxImgVwrMetadataContainer::CreateSettingItemL
   133 // CGlxImgVwrMetadataContainer::CreateSettingItemL
   155 //-----------------------------------------------------------------------------
   134 //-----------------------------------------------------------------------------
   156 CAknSettingItem* CGlxImgVwrMetadataContainer::CreateSettingItemL(TInt aResourceId)
   135 CAknSettingItem* CGlxImgVwrMetadataContainer::CreateSettingItemL(
   157     {
   136         TInt aResourceId)
   158     TRACER("CGlxImgVwrMetadataContainer::CreateSettingItemL");      
   137     {
       
   138     TRACER("CGlxImgVwrMetadataContainer::CreateSettingItemL");
   159     CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack
   139     CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack
   160     iTextSetter.Zero();  
   140     iTextSetter.Zero();
   161 
   141 
   162     //Creating a empty Settings list box which will  be populated with metadata in handleattributeavailable
   142     //Creating a empty Settings list box which will  be populated with metadata in handleattributeavailable
   163     switch(aResourceId)
   143     switch (aResourceId)
   164         {
   144         {
   165         case EImgVwrNameItem:
   145         case EImgVwrNameItem:
   166         case EImgVwrDateAndTimeItem:
   146         case EImgVwrDateAndTimeItem:
   167         case EImgVwrDescriptionItem:
   147         case EImgVwrMimeTypeItem:
   168             {
   148         case EImgVwrSizeItem:
   169             settingItem = new (ELeave) CAknTextSettingItem( 
       
   170                     aResourceId, iTextSetter );
       
   171 
       
   172             break;          
       
   173             }
       
   174         case EImgVwrSizeItem:            
       
   175         case EImgVwrResolutionItem:
   149         case EImgVwrResolutionItem:
   176             {
   150             {
   177             settingItem = new (ELeave) CAknTextSettingItem( 
   151             settingItem = new (ELeave) CAknTextSettingItem(aResourceId,
   178                     aResourceId, iTextSetter );
   152                     iTextSetter);
   179 
   153 
   180             break;          
   154             break;
   181             }            
   155             }
   182 
   156 
   183         case EImgVwrlicenseItem:
   157         case EImgVwrlicenseItem:
   184             {
   158             {
   185             settingItem = new (ELeave) CAknTextSettingItem( 
   159             settingItem = new (ELeave) CAknTextSettingItem(aResourceId,
   186                     aResourceId, iTextSetter );
   160                     iTextSetter);
   187             //Hide the item until we get the attributes
   161             //Hide the item until we get the attributes
   188             //where in we check for the usage rights.                                                                                                            
   162             //where in we check for the usage rights.                                                                                                            
   189             settingItem->SetHidden(ETrue);
   163             settingItem->SetHidden(ETrue);
   190             //Required to refresh the listbox when any items visiblity is changed
   164             //Required to refresh the listbox when any items visiblity is changed
   191             this->HandleChangeInItemArrayOrVisibilityL();
   165             this->HandleChangeInItemArrayOrVisibilityL();
   192             }
   166             }
   193             break;
   167             break;
   194 
   168 
   195         default:
   169         default:
   196             {
   170             {
   197             break;    
   171             break;
   198             }
   172             }
   199         }
   173         }
   200     return settingItem;
   174     return settingItem;
   201     }
   175     }
   202 //-----------------------------------------------------------------------------
       
   203 // CGlxImgVwrMetadataContainer::IsItemModifiable
       
   204 //-----------------------------------------------------------------------------
       
   205 TBool CGlxImgVwrMetadataContainer::IsItemModifiable()
       
   206     {
       
   207     TRACER("CGlxMetadataContainer::IsItemModifiable()");
       
   208     //Only items like name , description, tag and albums are modifiable
       
   209     //The check is for the items from ENameItem(0) tille ETagsItem(4)
       
   210     if(ListBox()->CurrentItemIndex()<=ETagsItem)
       
   211         {
       
   212         return EFalse;
       
   213         }
       
   214     //return ETrue to dim the item
       
   215     return ETrue;
       
   216 
       
   217     }
       
   218 
   176 
   219 //-----------------------------------------------------------------------------
   177 //-----------------------------------------------------------------------------
   220 // CGlxImgVwrMetadataContainer::HandleListBoxEventL
   178 // CGlxImgVwrMetadataContainer::HandleListBoxEventL
   221 //-----------------------------------------------------------------------------
   179 //-----------------------------------------------------------------------------
   222 void CGlxImgVwrMetadataContainer::HandleListBoxEventL(CEikListBox*  /*aListBox*/,
   180 void CGlxImgVwrMetadataContainer::HandleListBoxEventL(
   223         TListBoxEvent aEventType)
   181         CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
   224     {
   182     {
   225     TRACER("CGlxMetadataContainer::HandleListBoxEventL()");
   183     TRACER("CGlxImgVwrMetadataContainer::HandleListBoxEventL()");
   226     GLX_LOG_INFO("CGlxImgVwrMetadataContainer::HandleListBoxEventL");         
       
   227     if (aEventType == EEventItemSingleClicked)
   184     if (aEventType == EEventItemSingleClicked)
   228         {
   185         {
   229         if(iItemMediaList->Count() == 0)
   186         if (iItemMediaList->Count() == 0)
   230             {
   187             {
   231             GLX_LOG_INFO("CGlxImgVwrMetadataContainer:: NO Items");         
   188             GLX_LOG_INFO("CGlxImgVwrMetadataContainer:: NO Items");
   232             return;
   189             return;
   233             }
   190             }
   234         TInt index = ListBox()->CurrentItemIndex() ;
   191         TInt index = ListBox()->CurrentItemIndex();
   235         if(EImgVwrlicenseItem == index)
   192         if (EImgVwrlicenseItem == index)
   236             {
   193             {
   237             GLX_LOG_INFO("CGlxImgVwrMetadataContainer::Licence item");         
   194             GLX_LOG_INFO("CGlxImgVwrMetadataContainer::Licence item");
   238             CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL();
   195             CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL();
   239             CleanupClosePushL(*drmUtility);
   196             CleanupClosePushL(*drmUtility);
   240             CreateImageViewerInstanceL();
   197             CreateImageViewerInstanceL();
   241             if(iImageViewerInstance->IsPrivate())
   198             if (iImageViewerInstance->IsPrivate())
   242                 {
   199                 {
   243                 drmUtility->ShowDRMDetailsPaneL(iImageViewerInstance->ImageFileHandle());
   200                 RFile64& fileHandle = iImageViewerInstance->ImageFileHandle();
       
   201                 // check if rights have expired
       
   202                 TBool expired = EFalse;
       
   203                 expired = !drmUtility->ItemRightsValidityCheckL(fileHandle,
       
   204                         ETrue);
       
   205 
       
   206                 if (expired)
       
   207                     {
       
   208                     drmUtility->ShowRightsInfoL(fileHandle);
       
   209                     }
       
   210                 else
       
   211                     {
       
   212                     drmUtility->ShowDRMDetailsPaneL(fileHandle);
       
   213                     }
   244                 }
   214                 }
   245             else
   215             else
   246                 {
   216                 {
   247                 drmUtility->ShowDRMDetailsPaneL(iItemMediaList->Item(0).Uri());
   217                 const TDesC& uri = iItemMediaList->Item(0).Uri();
       
   218                 // check if rights have expired
       
   219                 TBool expired = EFalse;
       
   220                 expired = !drmUtility->ItemRightsValidityCheckL(uri, ETrue);
       
   221 
       
   222                 if (expired)
       
   223                     {
       
   224                     drmUtility->ShowRightsInfoL(uri);
       
   225                     }
       
   226                 else
       
   227                     {
       
   228                     drmUtility->ShowDRMDetailsPaneL(uri);
       
   229                     }
   248                 }
   230                 }
   249             CleanupStack::PopAndDestroy(drmUtility);
   231             CleanupStack::PopAndDestroy(drmUtility);
   250             DeleteImageViewerInstance();
   232             DeleteImageViewerInstance();
   251             }
   233             }
   252         }
   234         }
   253     }
   235     }
   254 
   236 
   255 // ----------------------------------------------------------------------------
       
   256 // CGlxImgVwrMetadataContainer::ViewDynInitMenuPaneL
       
   257 // ----------------------------------------------------------------------------
       
   258 // 
       
   259 void CGlxImgVwrMetadataContainer::ViewDynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane)
       
   260     {
       
   261     TRACER("CGlxMetadataContainer::ViewDynInitMenuPaneL()");
       
   262     if( aMenuId == R_METADATA_MENU )
       
   263             {
       
   264             //Set dim the options based on the utem selected
       
   265             //Viewdetails option will be availble only for the license item
       
   266             aMenuPane->SetItemDimmed(KGlxViewBoundMenuCommandId,IsLicenseItem());
       
   267             }
       
   268     }
       
   269 
       
   270 //Medialist callbacks.    
   237 //Medialist callbacks.    
   271 // ----------------------------------------------------------------------------
   238 // ----------------------------------------------------------------------------
   272 // CGlxImgVwrMetadataContainer::HandleAttributesAvailableL
   239 // CGlxImgVwrMetadataContainer::HandleAttributesAvailableL
   273 // ----------------------------------------------------------------------------
   240 // ----------------------------------------------------------------------------
   274 //
   241 //
   275 void CGlxImgVwrMetadataContainer::HandleAttributesAvailableL( TInt /*aItemIndex*/, 
   242 void CGlxImgVwrMetadataContainer::HandleAttributesAvailableL(
   276         const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList )
   243         TInt /*aItemIndex*/, const RArray<TMPXAttribute>& aAttributes,
       
   244         MGlxMediaList* aList)
   277     {
   245     {
   278     TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()");
   246     TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()");
   279     //generic medialist for the item for all the attributes required other than tags and albums.
   247     //generic medialist for the item for all the attributes required other than tags and albums.
   280     TInt x = aAttributes.Count();
   248     TInt x = aAttributes.Count();
   281     if(aList == iItemMediaList)
   249     if (aList == iItemMediaList)
   282         {
   250         {
   283         // Loop untill it checks for all the avialable attributes
   251         // Loop untill it checks for all the avialable attributes
   284         for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--)
   252         for (TInt i = aAttributes.Count() - 1; i >= 0; i--)
   285             {
   253             {
   286             //set attributes to the items in the container
   254             //set attributes to the items in the container
   287             SetAttributesL(aAttributes[i]);                   
   255             SetAttributesL(aAttributes[i]);
   288             }
   256             }
   289         }
   257         }
   290 
       
   291     }
   258     }
   292 
   259 
   293 // ----------------------------------------------------------------------------
   260 // ----------------------------------------------------------------------------
   294 // HandleItemAddedL
   261 // HandleItemAddedL
   295 // ----------------------------------------------------------------------------
   262 // ----------------------------------------------------------------------------
   296 // 
   263 // 
   297 void CGlxImgVwrMetadataContainer::HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, 
   264 void CGlxImgVwrMetadataContainer::HandleItemAddedL(TInt /*aStartIndex*/,
   298         MGlxMediaList* aList )
   265         TInt /*aEndIndex*/, MGlxMediaList* aList)
   299     {
   266     {
   300     TRACER("CGlxMetadataContainer::HandleItemAddedL()");
   267     TRACER("CGlxMetadataContainer::HandleItemAddedL()");
   301     if(!iMarquee)
   268     if (!iMarquee)
   302         {
   269         {
   303             EnableMarqueingL();
   270         EnableMarqueingL();
   304         }
   271         }
   305     SetDurationLIicenseItemVisibilityL();
   272     SetLicenseItemVisibilityL();
   306     if(aList == iItemMediaList)
   273     if (aList == iItemMediaList)
   307         {
   274         {
   308         if(iItemMediaList->Count())
   275         if (iItemMediaList->Count())
   309             {
   276             {
   310             TGlxMedia item = iItemMediaList->Item(0);
   277             TGlxMedia item = iItemMediaList->Item(0);
   311             CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
   278             CGlxUStringConverter* stringConverter =
   312             CleanupStack::PushL(stringConverter );
   279                     CGlxUStringConverter::NewL();
   313             for(TInt index = 0; index <= EImgVwrlicenseItem; index++)
   280             CleanupStack::PushL(stringConverter);
       
   281             for (TInt index = 0; index <= EImgVwrlicenseItem; index++)
   314                 {
   282                 {
   315                 HBufC* string = NULL;               
   283                 HBufC* string = NULL;
   316 				iTextSetter.Zero();
   284                 iTextSetter.Zero();
   317 
   285 
   318                 if(index == EImgVwrSizeItem)
   286                 if (index == EImgVwrSizeItem)
       
   287                     {
       
   288                     stringConverter->AsStringL(item, KMPXMediaGeneralSize, 0,
       
   289                             string);
       
   290                     }
       
   291                 else if (index == EImgVwrNameItem)
       
   292                     {
       
   293                     stringConverter->AsStringL(item, KMPXMediaGeneralTitle,
       
   294                             0, string);
       
   295                     }
       
   296                 else if (index == EImgVwrDateAndTimeItem)
   319                     {
   297                     {
   320                     stringConverter->AsStringL(item,
   298                     stringConverter->AsStringL(item,
   321                             KMPXMediaGeneralSize,0, string );              
   299                             KGlxMediaGeneralLastModifiedDate,
   322                     }
   300                             R_QTN_DATE_USUAL_WITH_ZERO, string);
   323                 else if(index == EImgVwrNameItem)
   301                     }
       
   302                 else if (index == EImgVwrMimeTypeItem)
   324                     {
   303                     {
   325                     stringConverter->AsStringL(item,
   304                     stringConverter->AsStringL(item,
   326                             KMPXMediaGeneralTitle,0, string );
   305                             KMPXMediaGeneralMimeType, 0, string);
   327                     }
   306                     }
   328                 else if(index == EImgVwrDateAndTimeItem)
   307                 else if (index == EImgVwrResolutionItem)
   329                     {  
       
   330                     stringConverter->AsStringL( item, 
       
   331                             KGlxMediaGeneralLastModifiedDate,
       
   332                             R_QTN_DATE_USUAL_WITH_ZERO,string );
       
   333                     }
       
   334                 else if(index == EImgVwrDescriptionItem)
       
   335                     {
   308                     {
   336                     stringConverter->AsStringL(item,
   309                     stringConverter->AsStringL(item,
   337                             KMPXMediaGeneralComment,0, string ); 
   310                             KGlxMediaGeneralDimensions, 0, string);
   338                     }
   311                     }
   339                 else if(index == EImgVwrResolutionItem)
   312                 else if (index == EImgVwrlicenseItem)
   340                     {
   313                     {
   341                     stringConverter->AsStringL(item,
   314                     // If an item is DRM protected, License field in details
   342                             KGlxMediaGeneralDimensions,0, string );
   315                     // should display "View Details"
   343                     }    
   316                     string = StringLoader::LoadL(
   344                 else if(index == EImgVwrlicenseItem)
   317                             R_GLX_METADATA_VIEW_OPTIONS_VIEW);
   345 					{
   318                     }
   346 					// If an item is DRM protected, License field in details
   319                 else
   347 					// should display "View Details"
       
   348 					string = StringLoader::LoadL(R_GLX_METADATA_VIEW_OPTIONS_VIEW);
       
   349 					}                
       
   350                 else 
       
   351                     {
   320                     {
   352                     //no implementation
   321                     //no implementation
   353                     } 
   322                     }
   354                 if(string)
   323                 if (string)
   355                     {
   324                     {
   356                     iTextSetter.Zero();
   325                     iTextSetter.Zero();
   357                     iTextSetter.Append(*string);
   326                     iTextSetter.Append(*string);
   358                     }
   327                     }
   359                 CleanupStack::PushL( string );
   328                 CleanupStack::PushL(string);
   360                 EditItemL(index,EFalse);   
   329                 EditItemL(index, EFalse);
   361                 CleanupStack::PopAndDestroy(string );           
   330                 CleanupStack::PopAndDestroy(string);
   362                 }
   331                 }
   363             CleanupStack::PopAndDestroy(stringConverter );
   332             CleanupStack::PopAndDestroy(stringConverter);
   364             }   
   333             }
   365         }
   334         }
   366 
   335     }
   367 
   336 
   368     }
       
   369 // ----------------------------------------------------------------------------
   337 // ----------------------------------------------------------------------------
   370 // EnableMarqueingL
   338 // EnableMarqueingL
   371 // ----------------------------------------------------------------------------
   339 // ----------------------------------------------------------------------------
   372 //  
   340 //  
   373 void CGlxImgVwrMetadataContainer::EnableMarqueingL()
   341 void CGlxImgVwrMetadataContainer::EnableMarqueingL()
   374     {
   342     {
   375     TRACER("CGlxImgVwrMetadataContainer::EnableMarqueingL()");    
   343     TRACER("CGlxImgVwrMetadataContainer::EnableMarqueingL()");
   376     iMarquee = ETrue;
   344     iMarquee = ETrue;
   377     ListBox()->UseLogicalToVisualConversion(ETrue);
   345     ListBox()->UseLogicalToVisualConversion(ETrue);
   378     ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams (KMarqueeLoopCount,
   346     ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams(
   379             KMarqueeScrollAmount, KMarqueeScrollDelay, KMarqueeScrollInterval);
   347             KMarqueeLoopCount, KMarqueeScrollAmount, KMarqueeScrollDelay,
       
   348             KMarqueeScrollInterval);
   380     ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
   349     ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
   381     }    
   350     }
       
   351 
   382 // ----------------------------------------------------------------------------
   352 // ----------------------------------------------------------------------------
   383 // HandleCommandCompleteL
   353 // HandleCommandCompleteL
   384 // ----------------------------------------------------------------------------
   354 // ----------------------------------------------------------------------------
   385 // 
   355 // 
   386 void CGlxImgVwrMetadataContainer::HandleCommandCompleteL(TAny* /*aSessionId*/, 
   356 void CGlxImgVwrMetadataContainer::HandleCommandCompleteL(
       
   357         TAny* /*aSessionId*/, CMPXCommand* /*aCommandResult*/,
       
   358         TInt /*aError*/, MGlxMediaList* /*aList*/)
       
   359     {
       
   360     TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()");
       
   361     }
       
   362 
       
   363 // ----------------------------------------------------------------------------
       
   364 // HandleItemRemoved
       
   365 // ----------------------------------------------------------------------------
       
   366 //  
       
   367 void CGlxImgVwrMetadataContainer::HandleItemRemovedL(TInt /*aStartIndex*/,
       
   368         TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
       
   369     {
       
   370     TRACER("CGlxImgVwrMetadataContainer::HandleItemRemovedL()");
       
   371     }
       
   372 
       
   373 // ----------------------------------------------------------------------------
       
   374 // HandleFocusChangedL
       
   375 // ----------------------------------------------------------------------------
       
   376 //  
       
   377 void CGlxImgVwrMetadataContainer::HandleFocusChangedL(
       
   378         NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/,
       
   379         TInt /*aOldIndex*/, MGlxMediaList* /*aList*/)
       
   380     {
       
   381     TRACER("CGlxImgVwrMetadataContainer::HandleFocusChangedL()");
       
   382     }
       
   383 
       
   384 // ----------------------------------------------------------------------------
       
   385 // HandleItemSelected
       
   386 // ----------------------------------------------------------------------------
       
   387 //  
       
   388 void CGlxImgVwrMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/,
       
   389         TBool /*aSelected*/, MGlxMediaList* /*aList*/)
       
   390     {
       
   391     TRACER("CGlxImgVwrMetadataContainer::HandleItemSelectedL");
       
   392     }
       
   393 
       
   394 // ----------------------------------------------------------------------------
       
   395 // HandleMessageL
       
   396 // ----------------------------------------------------------------------------
       
   397 //    
       
   398 void CGlxImgVwrMetadataContainer::HandleMessageL(
       
   399         const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/)
       
   400     {
       
   401     TRACER("CGlxImgVwrMetadataContainer::HandleMessageL()");
       
   402     }
       
   403 
       
   404 // ----------------------------------------------------------------------------
       
   405 // HandleError
       
   406 // ----------------------------------------------------------------------------
       
   407 //
       
   408 void CGlxImgVwrMetadataContainer::HandleError(TInt /*aError*/)
       
   409     {
       
   410     TRACER("CGlxImgVwrMetadataContainer::HandleError()");
       
   411     }
       
   412 
       
   413 // ----------------------------------------------------------------------------
       
   414 // HandleCommandCompleteL
       
   415 // ----------------------------------------------------------------------------
       
   416 //  
       
   417 void CGlxImgVwrMetadataContainer::HandleCommandCompleteL(
   387         CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/)
   418         CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/)
   388     {
   419     {
   389     TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()");
   420     TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()");
   390     }
   421     }
   391 
   422 
   392 // ----------------------------------------------------------------------------
   423 // ----------------------------------------------------------------------------
   393 // HandleItemRemoved
       
   394 // ----------------------------------------------------------------------------
       
   395 //  
       
   396 void CGlxImgVwrMetadataContainer::HandleItemRemovedL(  TInt /*aStartIndex*/, TInt /*aEndIndex*/, 
       
   397         MGlxMediaList* /*aList*/  )
       
   398     {
       
   399     TRACER("CGlxImgVwrMetadataContainer::HandleItemRemovedL()");    
       
   400     }    
       
   401 // ----------------------------------------------------------------------------
       
   402 // HandleFocusChangedL
       
   403 // ----------------------------------------------------------------------------
       
   404 //  
       
   405 void CGlxImgVwrMetadataContainer::HandleFocusChangedL( NGlxListDefs::
       
   406         TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, 
       
   407         MGlxMediaList* /*aList*/ )
       
   408     {
       
   409     TRACER("CGlxImgVwrMetadataContainer::HandleFocusChangedL()");
       
   410     }
       
   411 // ----------------------------------------------------------------------------
       
   412 // HandleItemSelected
       
   413 // ----------------------------------------------------------------------------
       
   414 //  
       
   415 void CGlxImgVwrMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/, 
       
   416         TBool /*aSelected*/, MGlxMediaList* /*aList*/ )
       
   417     {
       
   418     TRACER("CGlxImgVwrMetadataContainer::HandleItemSelectedL");
       
   419     }
       
   420 // ----------------------------------------------------------------------------
       
   421 // HandleMessageL
       
   422 // ----------------------------------------------------------------------------
       
   423 //    
       
   424 void CGlxImgVwrMetadataContainer::HandleMessageL( const CMPXMessage& /*aMessage*/, 
       
   425         MGlxMediaList* /*aList*/ )
       
   426     {
       
   427     TRACER("CGlxImgVwrMetadataContainer::HandleMessageL()");
       
   428     }
       
   429 // ----------------------------------------------------------------------------
       
   430 // HandleError
       
   431 // ----------------------------------------------------------------------------
       
   432 //
       
   433 void CGlxImgVwrMetadataContainer::HandleError( TInt /*aError*/ ) 
       
   434     {
       
   435     TRACER("CGlxImgVwrMetadataContainer::HandleError()");
       
   436     TRAP_IGNORE(HandleErrorL());
       
   437     }
       
   438 
       
   439 // ----------------------------------------------------------------------------
       
   440 // HandleErrorL
       
   441 // ----------------------------------------------------------------------------
       
   442 //
       
   443 void CGlxImgVwrMetadataContainer::HandleErrorL()
       
   444     {
       
   445     TRACER("CGlxImgVwrMetadataContainer::HandleErrorL()");
       
   446     }
       
   447 // ----------------------------------------------------------------------------
       
   448 // HandleCommandCompleteL
       
   449 // ----------------------------------------------------------------------------
       
   450 //  
       
   451 void CGlxImgVwrMetadataContainer::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, 
       
   452         TInt /*aError*/, MGlxMediaList* /*aList*/ )
       
   453     {
       
   454     TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()");
       
   455     }
       
   456 
       
   457 // ----------------------------------------------------------------------------
       
   458 // HandleMediaL
   424 // HandleMediaL
   459 // ----------------------------------------------------------------------------
   425 // ----------------------------------------------------------------------------
   460 //  
   426 //  
   461 void CGlxImgVwrMetadataContainer::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ )
   427 void CGlxImgVwrMetadataContainer::HandleMediaL(TInt /*aListIndex*/,
       
   428         MGlxMediaList* /*aList*/)
   462     {
   429     {
   463     TRACER("CGlxImgVwrMetadataContainer::HandleMediaL()");
   430     TRACER("CGlxImgVwrMetadataContainer::HandleMediaL()");
   464     }
   431     }
   465 
   432 
   466 // ----------------------------------------------------------------------------
   433 // ----------------------------------------------------------------------------
   467 // HandleItemModifiedL
   434 // HandleItemModifiedL
   468 // ----------------------------------------------------------------------------
   435 // ----------------------------------------------------------------------------
   469 //  
   436 //  
   470 void CGlxImgVwrMetadataContainer::HandleItemModifiedL( const RArray<TInt>& /*aItemIndexes*/,
   437 void CGlxImgVwrMetadataContainer::HandleItemModifiedL(
   471         MGlxMediaList* /*aList*/ )
   438         const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/)
   472     {
   439     {
   473     TRACER("CGlxImgVwrMetadataContainer::HandleItemModifiedL()");
   440     TRACER("CGlxImgVwrMetadataContainer::HandleItemModifiedL()");
   474     }
   441     }
       
   442 
   475 // ----------------------------------------------------------------------------
   443 // ----------------------------------------------------------------------------
   476 // ChangeMskL
   444 // ChangeMskL
   477 // ----------------------------------------------------------------------------
   445 // ----------------------------------------------------------------------------    
   478 //     
       
   479 void CGlxImgVwrMetadataContainer::ChangeMskL()
   446 void CGlxImgVwrMetadataContainer::ChangeMskL()
   480     {
   447     {
   481     TRACER("CGlxImgVwrMetadataContainer::ChangeMsk()");
   448     TRACER("CGlxImgVwrMetadataContainer::ChangeMskL()");
   482     TInt index = ListBox()->CurrentItemIndex();
   449     CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
   483     CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();               
   450     CleanupClosePushL(*uiUtility);
   484     switch(index)
   451     switch (ListBox()->CurrentItemIndex())
   485         {
   452         {
   486         case EImgVwrNameItem:        
   453         case EImgVwrNameItem:
   487         case EImgVwrDescriptionItem:
   454         case EImgVwrMimeTypeItem:
   488             {
       
   489             uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition,
       
   490                     EAknSoftkeyEdit,R_GLX_METADATA_MSK_EDIT);
       
   491             }        
       
   492             break;          
       
   493         case EImgVwrDateAndTimeItem:
   455         case EImgVwrDateAndTimeItem:
   494         case EImgVwrSizeItem:
   456         case EImgVwrSizeItem:
   495         case EImgVwrResolutionItem:
   457         case EImgVwrResolutionItem:
   496         case EImgVwrlicenseItem:
   458         case EImgVwrlicenseItem:
   497             {
   459             {
   498             uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   460             uiUtility->ScreenFurniture()->ModifySoftkeyIdL(
   499                     EAknSoftkeyEdit,R_GLX_METADATA_MSK_BLANK);            
   461                     CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   500             }        
   462                     EAknSoftkeyEdit, R_GLX_METADATA_MSK_BLANK);
       
   463             }
   501             break;
   464             break;
   502         default:
   465         default:
   503             {
   466             {
   504             break;    
   467             break;
   505             }
   468             }
   506         }
   469         }
   507 
   470     CleanupStack::PopAndDestroy(uiUtility);
   508     if ( uiUtility )
       
   509         {
       
   510         uiUtility->Close();
       
   511         }   
       
   512     }
   471     }
   513 
   472 
   514 //-----------------------------------------------------------------------------
   473 //-----------------------------------------------------------------------------
   515 // CGlxImgVwrMetadataContainer::CreateMediaListForSelectedItemL
   474 // CGlxImgVwrMetadataContainer::CreateMediaListForSelectedItemL
   516 //-----------------------------------------------------------------------------
   475 //-----------------------------------------------------------------------------
   518     {
   477     {
   519     TRACER("CGlxMetadataContainer::CreateMediaListForSelectedItemL");
   478     TRACER("CGlxMetadataContainer::CreateMediaListForSelectedItemL");
   520 
   479 
   521     //create the collection path for the medialist to be created
   480     //create the collection path for the medialist to be created
   522     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
   481     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
   523     CleanupStack::PushL( path );
   482     CleanupStack::PushL(path);
   524     //set the all collection path as the details dialog can be launched from any of the grid views and filter with URI
   483     // Set the Image viewer collection path as the details dialog 
   525     path->AppendL(/*KGlxCollectionPluginAllImplementationUid*/KGlxCollectionPluginImageViewerImplementationUid);
   484     // can be launched from private or user data path
       
   485     path->AppendL(KGlxCollectionPluginImageViewerImplementationUid);
   526     //create the filter with the URI
   486     //create the filter with the URI
   527     CMPXFilter* filter  = TGlxFilterFactory::CreateURIFilterL(iUri);  
   487     CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(iUri);
   528     CleanupStack::PushL( filter );
   488     CleanupStack::PushL(filter);
   529     //create the medialist   
   489     //create the medialist   
   530     iItemMediaList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(KMediaListId),filter);   
   490     iItemMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId(
       
   491             KMediaListId), filter);
   531 
   492 
   532     //Add the attributes which are required to be displayed.
   493     //Add the attributes which are required to be displayed.
   533     iMainListAttributecontext = new (ELeave) CGlxAttributeContext(&iSelectionIterator);
   494     iMainListAttributecontext = new (ELeave) CGlxAttributeContext(
       
   495             &iSelectionIterator);
   534     iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected);
   496     iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected);
   535     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize);
   497     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize);
   536     iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions); 
   498     iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions);
   537     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralTitle);
   499     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralTitle);
   538     iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralLastModifiedDate);
   500     iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralLastModifiedDate);
   539     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralComment); 
   501     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralMimeType);
   540 
   502 
   541     //Add Context so that we get the handleattributes call once the medialist is populated with above mentioned attributes.
   503     //Add Context so that we get the handleattributes call once the medialist is populated with above mentioned attributes.
   542     iItemMediaList->AddContextL( iMainListAttributecontext,
   504     iItemMediaList->AddContextL(iMainListAttributecontext,
   543             KGlxFetchContextPriorityBlocking );
   505             KGlxFetchContextPriorityBlocking);
   544 
   506 
   545     //add to observer for callbacks.
   507     //add to observer for callbacks.
   546     iItemMediaList->AddMediaListObserverL(this);
   508     iItemMediaList->AddMediaListObserverL(this);
   547 
   509 
   548     CleanupStack::PopAndDestroy( filter );
   510     CleanupStack::PopAndDestroy(filter);
   549     CleanupStack::PopAndDestroy( path ); 
   511     CleanupStack::PopAndDestroy(path);
   550     }
   512     }
   551 // ----------------------------------------------------------------------------
   513 
   552 // CGlxImgVwrMetadataContainer::SetAttributes
   514 // ----------------------------------------------------------------------------
       
   515 // CGlxImgVwrMetadataContainer::SetAttributesL
   553 // ----------------------------------------------------------------------------
   516 // ----------------------------------------------------------------------------
   554 //
   517 //
   555 void CGlxImgVwrMetadataContainer::SetAttributesL(TMPXAttribute attribute)
   518 void CGlxImgVwrMetadataContainer::SetAttributesL(TMPXAttribute attribute)
   556     {
   519     {
   557     TRACER("CGlxImgVwrMetadataContainer::SetAttributesL");    
   520     TRACER("CGlxImgVwrMetadataContainer::SetAttributesL");
   558 
   521 
   559     if(!iSetVisible)
   522     if (!iSetVisible)
   560         {
   523         {
   561         iSetVisible = ETrue;
   524         iSetVisible = ETrue;
   562         SetDurationLIicenseItemVisibilityL();
   525         SetLicenseItemVisibilityL();
   563         }
   526         }
   564     TGlxMedia item = iItemMediaList->Item(0);
   527     TGlxMedia item = iItemMediaList->Item(0);
   565     //Create the string convertor instance 
   528     //Create the string convertor instance 
   566     //String convertor class with provide the specific format for date,location and duration and size.
   529     //String convertor class with provide the specific format for date,location and duration and size.
   567     CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
   530     CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
   568     CleanupStack::PushL(stringConverter );
   531     CleanupStack::PushL(stringConverter);
   569     HBufC* string = NULL;    
   532     HBufC* string = NULL;
   570 
   533 
   571     //if attribute is date and time we need to pass the format it as R_QTN_DATE_USUAL_WITH_ZERO else null
   534     //if attribute is date and time we need to pass the format it as R_QTN_DATE_USUAL_WITH_ZERO else null
   572     if(attribute == KGlxMediaGeneralLastModifiedDate)
   535     if (attribute == KGlxMediaGeneralLastModifiedDate)
   573         {
   536         {
   574         stringConverter->AsStringL(item, 
   537         stringConverter->AsStringL(item, attribute,
   575                 attribute,
   538                 R_QTN_DATE_USUAL_WITH_ZERO, string);
   576                 R_QTN_DATE_USUAL_WITH_ZERO, string );
   539         }
   577         }    
       
   578     else
   540     else
   579         {
   541         {
   580         stringConverter->AsStringL(item,
   542         stringConverter->AsStringL(item, attribute, 0, string);
   581                 attribute,0, string );
       
   582         }
   543         }
   583     //get the settings item based on the attribute and set the text.
   544     //get the settings item based on the attribute and set the text.
   584     if ( string )
   545     if (string)
   585         {
   546         {
   586         iTextSetter.Zero();
   547         iTextSetter.Zero();
   587         iTextSetter.Append(*string);
   548         iTextSetter.Append(*string);
   588         if(attribute == KMPXMediaGeneralSize)
   549         if (attribute == KMPXMediaGeneralSize)
   589             {
   550             {
   590             EditItemL(EImgVwrSizeItem,EFalse);
   551             EditItemL(EImgVwrSizeItem, EFalse);
   591             }    
   552             }
   592         else if(attribute == KMPXMediaGeneralTitle)
   553         else if (attribute == KMPXMediaGeneralTitle)
   593             {
   554             {
   594             EditItemL(EImgVwrNameItem,EFalse);
   555             EditItemL(EImgVwrNameItem, EFalse);
   595             }
   556             }
   596         else if(attribute == KGlxMediaGeneralLastModifiedDate)
   557         else if (attribute == KGlxMediaGeneralLastModifiedDate)
   597             {  
   558             {
   598             EditItemL(EImgVwrDateAndTimeItem,EFalse);
   559             EditItemL(EImgVwrDateAndTimeItem, EFalse);
   599             }
   560             }
   600         else if(attribute == KMPXMediaGeneralComment)
   561         else if (attribute == KMPXMediaGeneralMimeType)
   601             {
   562             {
   602             EditItemL(EImgVwrDescriptionItem,EFalse);
   563             EditItemL(EImgVwrMimeTypeItem, EFalse);
   603             }
   564             }
   604         else if(attribute == KGlxMediaGeneralDimensions)
   565         else if (attribute == KGlxMediaGeneralDimensions)
   605             {
   566             {
   606             EditItemL(EImgVwrResolutionItem,EFalse);
   567             EditItemL(EImgVwrResolutionItem, EFalse);
   607             }/*
   568             }
   608         else if(attribute == KMPXMediaDrmProtected)
   569         else if(attribute == KMPXMediaDrmProtected)
   609             {
   570             {
   610             EditItemL(EImgVwrlicenseItem,EFalse);
   571             EditItemL(EImgVwrlicenseItem, EFalse);
   611             }*/
   572             }
   612         else
   573         else
   613             {
   574             {
   614             
   575             //no implementation
   615             } 
   576             }
   616         delete string;
   577         delete string;
   617         string = NULL;
   578         string = NULL;
   618         }
   579         }
   619     CleanupStack::PopAndDestroy(stringConverter );
   580     CleanupStack::PopAndDestroy(stringConverter);
   620     }
   581     }
   621 
   582 
   622 // ----------------------------------------------------------------------------
   583 // ----------------------------------------------------------------------------
   623 // CGlxMetadataContainer::EditItemL
   584 // CGlxMetadataContainer::EditItemL
   624 // ----------------------------------------------------------------------------
   585 // ----------------------------------------------------------------------------
   625 //
   586 //
   626 void CGlxImgVwrMetadataContainer::EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/)
   587 void CGlxImgVwrMetadataContainer::EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/)
   627     {
   588     {
   628     TRACER("CGlxImgVwrMetadataContainer::EditItemL");   
   589     TRACER("CGlxImgVwrMetadataContainer::EditItemL");
   629     CAknSettingItem* settingsitem = NULL;
   590     CAknSettingItem* settingsitem = NULL;
   630     settingsitem = (*SettingItemArray())[aIndex];
   591     settingsitem = (*SettingItemArray())[aIndex];
   631     settingsitem->LoadL();
   592     settingsitem->LoadL();
   632     settingsitem->UpdateListBoxTextL();
   593     settingsitem->UpdateListBoxTextL();
   633     settingsitem->StoreL();
   594     settingsitem->StoreL();
   634     ListBox()->DrawNow();
   595     ListBox()->DrawNow();
   635     }
   596     }
   636 
   597 
   637 
   598 // ----------------------------------------------------------------------------
   638 
   599 // CGlxImgVwrMetadataContainer::SetLicenseItemVisibilityL()
   639 // ----------------------------------------------------------------------------
   600 // ----------------------------------------------------------------------------
   640 // CGlxMetadataContainer::SetAttributes
   601 void CGlxImgVwrMetadataContainer::SetLicenseItemVisibilityL()
   641 // ----------------------------------------------------------------------------
   602     {
   642 //
   603     TRACER("CGlxMetadataContainer::SetLicenseItemVisibilityL()");
   643 void CGlxImgVwrMetadataContainer::SetNameDescriptionL(TInt aItem)
       
   644     {
       
   645     TRACER("CGlxImgVwrMetadataContainer::SetNameDescriptionL");   
       
   646     //This function is commn for updatng both name and description once modified    
       
   647     //get the item handle to be modified       
       
   648     CAknSettingItem* settingsitem = (*SettingItemArray())[aItem]; 
       
   649     HBufC* textBuf = HBufC::NewLC( KMaxMediaPopupTitleLength );
       
   650     (textBuf->Des()).Copy((settingsitem->SettingTextL()));
       
   651     TPtr textPtr = textBuf->Des();
       
   652     TBuf<KMaxMediaPopupTitleLength> titleText(*textBuf);
       
   653     HBufC *buf = NULL;
       
   654     if(aItem == ENameItem)
       
   655         {
       
   656         buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_TITLE_NSERIES);
       
   657         }
       
   658     else
       
   659         {
       
   660         buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_DESCRIPTION_NSERIES);
       
   661         }
       
   662 
       
   663     //Launch the text entry editor.
       
   664     CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *buf, textPtr );
       
   665     CleanupStack::PopAndDestroy(buf);
       
   666     if(aItem == EImgVwrDescriptionItem)
       
   667         {
       
   668         popup->SetLeftSoftKeyL(ETrue);
       
   669         }
       
   670     
       
   671     //action upon selecting ok from the editor 
       
   672     if ( popup->ExecuteLD() == EEikBidOk )
       
   673     {
       
   674       if(0 != (titleText.Compare(*textBuf)))
       
   675       {
       
   676         //Modify the MDS and setting list only if the entry is different from previous Item value
       
   677         iTextSetter.Zero();
       
   678         iTextSetter.Copy(*textBuf);
       
   679         EditItemL(aItem,EFalse);
       
   680         if( iItemMediaList->Count() > 0 )
       
   681         {
       
   682           iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item
       
   683           CMPXCollectionPath* path = iItemMediaList->PathLC();
       
   684           CMPXCommand* command = NULL;
       
   685           //Create the glx command based on the item
       
   686           if(aItem == ENameItem)
       
   687               {
       
   688               command = TGlxCommandFactory::RenameCommandLC(settingsitem->SettingTextL(),
       
   689      *path); 
       
   690               }
       
   691           else
       
   692               {
       
   693               command = TGlxCommandFactory::SetDescriptionCommandLC(settingsitem->SettingTextL(),
       
   694      *path);
       
   695               }              
       
   696           command->SetTObjectValueL<TAny*>(KMPXCommandGeneralSessionId, static_cast<TAny*>(this));
       
   697           //issue command to the medialist which further calls data source to update MDS
       
   698           iItemMediaList->CommandL(*command);
       
   699           CleanupStack::PopAndDestroy(command);
       
   700           CleanupStack::PopAndDestroy(path);
       
   701           }
       
   702       }         
       
   703     }
       
   704     CleanupStack::PopAndDestroy( textBuf );
       
   705      
       
   706     }
       
   707 // ----------------------------------------------------------------------------
       
   708 // CGlxImgVwrMetadataContainer::SetDurationLIicenseItemVisibilityL()
       
   709 // ----------------------------------------------------------------------------
       
   710 // 
       
   711 void CGlxImgVwrMetadataContainer::SetDurationLIicenseItemVisibilityL()
       
   712     {
       
   713     TRACER("CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL()");
       
   714     //get the media item.
   604     //get the media item.
   715     const TGlxMedia& item = iItemMediaList->Item(0);
   605     const TGlxMedia& item = iItemMediaList->Item(0);
   716     const CGlxMedia* media = item.Properties();
   606     const CGlxMedia* media = item.Properties();
   717 
   607 
   718     //in order to check for video category and drm rights
   608     // Check for DRM protection
   719    
   609     if (media && media->IsSupported(KMPXMediaDrmProtected))
   720     CAknSettingItem* hiddenItem = NULL;
   610         {
   721         
   611         if (item.IsDrmProtected())
   722      if( media && media->IsSupported(KMPXMediaDrmProtected))
   612             {
   723         {
   613             CAknSettingItem* hiddenItem =
   724          if(item.IsDrmProtected())
   614                     (*SettingItemArray())[EImgVwrlicenseItem];
   725              {
   615             //Set the License item visible
   726              hiddenItem = (*SettingItemArray())[EImgVwrlicenseItem];
   616             hiddenItem->SetHidden(EFalse);
   727              //Set the License item visible
   617             //Refresh the listbox when any items visiblity is changed
   728              hiddenItem->SetHidden(EFalse);             
   618             this->HandleChangeInItemArrayOrVisibilityL();
   729              //Required to refresh the listbox when any items visiblity is changed
   619             }
   730              this->HandleChangeInItemArrayOrVisibilityL();
   620         }
   731              }
       
   732         }
       
   733     }
       
   734 //-----------------------------------------------------------------------------
       
   735 // CGlxImgVwrMetadataContainer::IsLicenseItem
       
   736 //-----------------------------------------------------------------------------
       
   737 TBool CGlxImgVwrMetadataContainer::IsLicenseItem()
       
   738     {
       
   739     TRACER("CGlxMetadataContainer::IsLicenseItem()");
       
   740     //Checks the item for DRMProtection.
       
   741     if((ListBox()->CurrentItemIndex()== EImgVwrlicenseItem))
       
   742         {
       
   743         return EFalse;
       
   744         }
       
   745     return ETrue;
       
   746     }
   621     }
   747 
   622 
   748 // -----------------------------------------------------------------------------
   623 // -----------------------------------------------------------------------------
   749 // CreateImageViewerInstanceL
   624 // CreateImageViewerInstanceL
   750 // -----------------------------------------------------------------------------
   625 // -----------------------------------------------------------------------------
   751 //
   626 //
   752 void CGlxImgVwrMetadataContainer::CreateImageViewerInstanceL()
   627 void CGlxImgVwrMetadataContainer::CreateImageViewerInstanceL()
   753     {
   628     {
   754     TRACER("CGlxImgVwrMetadataContainer::CreateImageViewerInstanceL");
   629     TRACER("CGlxImgVwrMetadataContainer::CreateImageViewerInstanceL");
   755     iImageViewerInstance = CGlxImageViewerManager::InstanceL();    
   630     iImageViewerInstance = CGlxImageViewerManager::InstanceL();
   756     __ASSERT_ALWAYS(iImageViewerInstance, Panic(EGlxPanicNullPointer));
   631     __ASSERT_ALWAYS(iImageViewerInstance, Panic(EGlxPanicNullPointer));
   757     }
   632     }
   758 
   633 
   759 // -----------------------------------------------------------------------------
   634 // -----------------------------------------------------------------------------
   760 // DeleteImageViewerInstance
   635 // DeleteImageViewerInstance
   761 // -----------------------------------------------------------------------------
   636 // -----------------------------------------------------------------------------
   762 //
   637 //
   763 void CGlxImgVwrMetadataContainer::DeleteImageViewerInstance()
   638 void CGlxImgVwrMetadataContainer::DeleteImageViewerInstance()
   764     {
   639     {
   765     TRACER("CGlxImgVwrMetadataContainer::DeleteImageViewerInstance");
   640     TRACER("CGlxImgVwrMetadataContainer::DeleteImageViewerInstance");
   766     if ( iImageViewerInstance )
   641     if (iImageViewerInstance)
   767         {
   642         {
   768         iImageViewerInstance->DeleteInstance();
   643         iImageViewerInstance->DeleteInstance();
   769         }
   644         }
   770     }
   645     }
   771 
   646 
   772 
       
   773 //End of file
   647 //End of file