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