photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatacontainer.cpp
branchRCL_3
changeset 75 01504893d9cb
parent 60 5b3385a43d68
--- a/photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatacontainer.cpp	Wed Sep 15 12:13:06 2010 +0300
+++ b/photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatacontainer.cpp	Wed Oct 13 14:32:09 2010 +0300
@@ -1,43 +1,68 @@
 /*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+/*
+ * glximgvwrmetadatacontainer.cpp
  *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Image viewer metadata dialog implementation
+ *  Created on: Oct 22, 2009
+ *      Author: sourbasu
  */
 
+
 #include  "glximgvwrmetadatacontainer.h"
 #include  "glxustringconverter.h"                // converts the symbian types to UString type
+#include  <AknUtils.h>
 #include  <StringLoader.h>
 #include  <glxmetadatadialog.rsg>
+#include  <glxviewbase.rsg>
 #include  <glxlog.h>
 #include  <glxtracer.h>
 #include  <glxscreenfurniture.h>
 #include  <glxdetailsmulmodelprovider.h>          //Details data provider
 #include  <glxdetailsboundcommand.hrh>
+#include  <glxcommandhandleraddtocontainer.h>     // For CGlxCommandHandlerAddToContainer
+#include  <glxcommandhandlers.hrh>                // for command handler id
+#include  <glxcommandfactory.h>                   //for command factory
 #include  <mpxcommandgeneraldefs.h>               // Content ID identifying general category of content provided
+
+#include  <glxtextentrypopup.h>    
+#include  <glxcollectionpluginall.hrh>
+#include  <glxuistd.h>
+#include  <glxcollectionplugintags.hrh>           // tag collection plugin uid
+#include  <glxthumbnailattributeinfo.h>           // KGlxMediaIdThumbnail
 #include  <glxattributeretriever.h>               // CGlxAttributeReteiver
+#include  <aknQueryControl.h>
 #include  <glxdrmutility.h>                       //For launching DRM details pane
-#include  <glxuiutilities.rsg>
+#include  <glxgeneraluiutilities.h>               // General utilties class definition
+#include  <ExifModify.h>    
+#include  <glxuiutilities.rsg>                    //For CExifModify
 #include  <mpxmediadrmdefs.h>
 #include  <glxfilterfactory.h>
-#include  <glxcollectionpluginimageviewer.hrh>
-#include  <eikfrlb.h>                              // For marquee 
-#include  <eikfrlbd.h>                             // For marquee
+#include <glxcollectionpluginimageviewer.hrh>
+
+//marquee
 
-const TInt KMediaListId = 0x2000D248;
-const TInt KMarqueeLoopCount = 3;
-const TInt KMarqueeScrollAmount = 20;
-const TInt KMarqueeScrollDelay = 1000000;
-const TInt KMarqueeScrollInterval = 200000;
+#include <eikfrlb.h>
+#include <eikfrlbd.h>
+const TInt KMaxMediaPopupTitleLength = 0x100;
+const TInt KMediaListId              = 0x2000D248;
+const TInt KMarqueeLoopCount         = 3;
+const TInt KMarqueeScrollAmount      = 20;
+const TInt KMarqueeScrollDelay       = 1000000;
+const TInt KMarqueeScrollInterval    = 200000;
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -45,12 +70,10 @@
 // NewL
 // ---------------------------------------------------------
 //  
-CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewL(
-        const TRect& aRect, const TDesC& item)
+CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewL( const TRect& aRect,const TDesC& item)
     {
-    TRACER("CGlxImgVwrMetadataContainer::NewL");
-    CGlxImgVwrMetadataContainer* self = CGlxImgVwrMetadataContainer::NewLC(
-            aRect, item);
+    TRACER("CGlxImgVwrMetadataContainer::NewL");  
+    CGlxImgVwrMetadataContainer* self = CGlxImgVwrMetadataContainer::NewLC( aRect,item);
     CleanupStack::Pop(self);
     return self;
     }
@@ -59,14 +82,12 @@
 // NewLC
 // ---------------------------------------------------------
 //  
-CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewLC(
-        const TRect& aRect, const TDesC& aUri)
+CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewLC( const TRect& aRect,const TDesC& aUri)
     {
-    TRACER("CGlxImgVwrMetadataContainer::NewLC");
-    CGlxImgVwrMetadataContainer* self =
-            new (ELeave) CGlxImgVwrMetadataContainer(aUri);
+    TRACER("CGlxImgVwrMetadataContainer::NewLC"); 
+    CGlxImgVwrMetadataContainer* self = new(ELeave) CGlxImgVwrMetadataContainer(aUri);
     CleanupStack::PushL(self);
-    self->ConstructL(aRect);
+    self->ConstructL( aRect);
     return self;
     }
 
@@ -74,18 +95,18 @@
 // CGlxImgVwrMetadataContainer
 // ---------------------------------------------------------
 //  
-CGlxImgVwrMetadataContainer::CGlxImgVwrMetadataContainer(
-        const TDesC& aUri) : iUri(aUri)
-    {
-    // No implementation
-    }
+CGlxImgVwrMetadataContainer::CGlxImgVwrMetadataContainer(const TDesC& aUri)
+:iUri(aUri)
+        {
+        // No implementation
+        }
 
 // ---------------------------------------------------------
 // CGlxImgVwrMetadataContainer::ConstructL
 // ---------------------------------------------------------
 //  
-void CGlxImgVwrMetadataContainer::ConstructL(const TRect& /*aRect*/)
-    {
+void CGlxImgVwrMetadataContainer::ConstructL( const TRect& /*aRect*/ )
+    {   
     TRACER("CGlxMetadataContainer::ConstructLL()");
     //Creating the RBuf texts for all the items except tags & albums
     //which would be updated as whne the item is edited
@@ -100,19 +121,19 @@
 CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer()
     {
     TRACER("CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer");
-    if (iItemMediaList)
+    if( iItemMediaList ) 
         {
         iItemMediaList->RemoveContext(iMainListAttributecontext);
         iItemMediaList->RemoveMediaListObserver(this);
         iItemMediaList->Close();
-        iItemMediaList = NULL;
-        }
-    if (iMainListAttributecontext)
+        iItemMediaList = NULL;  
+        } 
+    if( iMainListAttributecontext )
         {
         delete iMainListAttributecontext;
         iMainListAttributecontext = NULL;
         }
-    if (IsVisible())
+    if( IsVisible() )
         {
         MakeVisible(EFalse);
         }
@@ -126,38 +147,43 @@
     {
     TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()");
     //returns the active medialist.
-    return *iItemMediaList;
+    return *iItemMediaList;    
     }
 
 //-----------------------------------------------------------------------------
 // CGlxImgVwrMetadataContainer::CreateSettingItemL
 //-----------------------------------------------------------------------------
-CAknSettingItem* CGlxImgVwrMetadataContainer::CreateSettingItemL(
-        TInt aResourceId)
+CAknSettingItem* CGlxImgVwrMetadataContainer::CreateSettingItemL(TInt aResourceId)
     {
-    TRACER("CGlxImgVwrMetadataContainer::CreateSettingItemL");
+    TRACER("CGlxImgVwrMetadataContainer::CreateSettingItemL");      
     CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack
-    iTextSetter.Zero();
+    iTextSetter.Zero();  
 
     //Creating a empty Settings list box which will  be populated with metadata in handleattributeavailable
-    switch (aResourceId)
+    switch(aResourceId)
         {
         case EImgVwrNameItem:
         case EImgVwrDateAndTimeItem:
-        case EImgVwrMimeTypeItem:
-        case EImgVwrSizeItem:
+        case EImgVwrDescriptionItem:
+            {
+            settingItem = new (ELeave) CAknTextSettingItem( 
+                    aResourceId, iTextSetter );
+
+            break;          
+            }
+        case EImgVwrSizeItem:            
         case EImgVwrResolutionItem:
             {
-            settingItem = new (ELeave) CAknTextSettingItem(aResourceId,
-                    iTextSetter);
+            settingItem = new (ELeave) CAknTextSettingItem( 
+                    aResourceId, iTextSetter );
 
-            break;
-            }
+            break;          
+            }            
 
         case EImgVwrlicenseItem:
             {
-            settingItem = new (ELeave) CAknTextSettingItem(aResourceId,
-                    iTextSetter);
+            settingItem = new (ELeave) CAknTextSettingItem( 
+                    aResourceId, iTextSetter );
             //Hide the item until we get the attributes
             //where in we check for the usage rights.                                                                                                            
             settingItem->SetHidden(ETrue);
@@ -168,65 +194,57 @@
 
         default:
             {
-            break;
+            break;    
             }
         }
     return settingItem;
     }
+//-----------------------------------------------------------------------------
+// CGlxImgVwrMetadataContainer::IsItemModifiable
+//-----------------------------------------------------------------------------
+TBool CGlxImgVwrMetadataContainer::IsItemModifiable()
+    {
+    TRACER("CGlxMetadataContainer::IsItemModifiable()");
+    //Only items like name , description, tag and albums are modifiable
+    //The check is for the items from ENameItem(0) tille ETagsItem(4)
+    if(ListBox()->CurrentItemIndex()<=ETagsItem)
+        {
+        return EFalse;
+        }
+    //return ETrue to dim the item
+    return ETrue;
+
+    }
 
 //-----------------------------------------------------------------------------
 // CGlxImgVwrMetadataContainer::HandleListBoxEventL
 //-----------------------------------------------------------------------------
-void CGlxImgVwrMetadataContainer::HandleListBoxEventL(
-        CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+void CGlxImgVwrMetadataContainer::HandleListBoxEventL(CEikListBox*  /*aListBox*/,
+        TListBoxEvent aEventType)
     {
-    TRACER("CGlxImgVwrMetadataContainer::HandleListBoxEventL()");
+    TRACER("CGlxMetadataContainer::HandleListBoxEventL()");
+    GLX_LOG_INFO("CGlxImgVwrMetadataContainer::HandleListBoxEventL");         
     if (aEventType == EEventItemSingleClicked)
         {
-        if (iItemMediaList->Count() == 0)
+        if(iItemMediaList->Count() == 0)
             {
-            GLX_LOG_INFO("CGlxImgVwrMetadataContainer:: NO Items");
+            GLX_LOG_INFO("CGlxImgVwrMetadataContainer:: NO Items");         
             return;
             }
-        TInt index = ListBox()->CurrentItemIndex();
-        if (EImgVwrlicenseItem == index)
+        TInt index = ListBox()->CurrentItemIndex() ;
+        if(EImgVwrlicenseItem == index)
             {
-            GLX_LOG_INFO("CGlxImgVwrMetadataContainer::Licence item");
+            GLX_LOG_INFO("CGlxImgVwrMetadataContainer::Licence item");         
             CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL();
             CleanupClosePushL(*drmUtility);
             CreateImageViewerInstanceL();
-            if (iImageViewerInstance->IsPrivate())
+            if(iImageViewerInstance->IsPrivate())
                 {
-                RFile64& fileHandle = iImageViewerInstance->ImageFileHandle();
-                // check if rights have expired
-                TBool expired = EFalse;
-                expired = !drmUtility->ItemRightsValidityCheckL(fileHandle,
-                        ETrue);
-
-                if (expired)
-                    {
-                    drmUtility->ShowRightsInfoL(fileHandle);
-                    }
-                else
-                    {
-                    drmUtility->ShowDRMDetailsPaneL(fileHandle);
-                    }
+                drmUtility->ShowDRMDetailsPaneL(iImageViewerInstance->ImageFileHandle());
                 }
             else
                 {
-                const TDesC& uri = iItemMediaList->Item(0).Uri();
-                // check if rights have expired
-                TBool expired = EFalse;
-                expired = !drmUtility->ItemRightsValidityCheckL(uri, ETrue);
-
-                if (expired)
-                    {
-                    drmUtility->ShowRightsInfoL(uri);
-                    }
-                else
-                    {
-                    drmUtility->ShowDRMDetailsPaneL(uri);
-                    }
+                drmUtility->ShowDRMDetailsPaneL(iItemMediaList->Item(0).Uri());
                 }
             CleanupStack::PopAndDestroy(drmUtility);
             DeleteImageViewerInstance();
@@ -234,128 +252,139 @@
         }
     }
 
+// ----------------------------------------------------------------------------
+// CGlxImgVwrMetadataContainer::ViewDynInitMenuPaneL
+// ----------------------------------------------------------------------------
+// 
+void CGlxImgVwrMetadataContainer::ViewDynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane)
+    {
+    TRACER("CGlxMetadataContainer::ViewDynInitMenuPaneL()");
+    if( aMenuId == R_METADATA_MENU )
+            {
+            //Set dim the options based on the utem selected
+            //Viewdetails option will be availble only for the license item
+            aMenuPane->SetItemDimmed(KGlxViewBoundMenuCommandId,IsLicenseItem());
+            }
+    }
+
 //Medialist callbacks.    
 // ----------------------------------------------------------------------------
 // CGlxImgVwrMetadataContainer::HandleAttributesAvailableL
 // ----------------------------------------------------------------------------
 //
-void CGlxImgVwrMetadataContainer::HandleAttributesAvailableL(
-        TInt /*aItemIndex*/, const RArray<TMPXAttribute>& aAttributes,
-        MGlxMediaList* aList)
+void CGlxImgVwrMetadataContainer::HandleAttributesAvailableL( TInt /*aItemIndex*/, 
+        const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList )
     {
     TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()");
     //generic medialist for the item for all the attributes required other than tags and albums.
     TInt x = aAttributes.Count();
-    if (aList == iItemMediaList)
+    if(aList == iItemMediaList)
         {
         // Loop untill it checks for all the avialable attributes
-        for (TInt i = aAttributes.Count() - 1; i >= 0; i--)
+        for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--)
             {
             //set attributes to the items in the container
-            SetAttributesL(aAttributes[i]);
+            SetAttributesL(aAttributes[i]);                   
             }
         }
+
     }
 
 // ----------------------------------------------------------------------------
 // HandleItemAddedL
 // ----------------------------------------------------------------------------
 // 
-void CGlxImgVwrMetadataContainer::HandleItemAddedL(TInt /*aStartIndex*/,
-        TInt /*aEndIndex*/, MGlxMediaList* aList)
+void CGlxImgVwrMetadataContainer::HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, 
+        MGlxMediaList* aList )
     {
     TRACER("CGlxMetadataContainer::HandleItemAddedL()");
-    if (!iMarquee)
+    if(!iMarquee)
         {
-        EnableMarqueingL();
+            EnableMarqueingL();
         }
-    SetLicenseItemVisibilityL();
-    if (aList == iItemMediaList)
+    SetDurationLIicenseItemVisibilityL();
+    if(aList == iItemMediaList)
         {
-        if (iItemMediaList->Count())
+        if(iItemMediaList->Count())
             {
             TGlxMedia item = iItemMediaList->Item(0);
-            CGlxUStringConverter* stringConverter =
-                    CGlxUStringConverter::NewL();
-            CleanupStack::PushL(stringConverter);
-            for (TInt index = 0; index <= EImgVwrlicenseItem; index++)
+            CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
+            CleanupStack::PushL(stringConverter );
+            for(TInt index = 0; index <= EImgVwrlicenseItem; index++)
                 {
-                HBufC* string = NULL;
-                iTextSetter.Zero();
+                HBufC* string = NULL;               
+				iTextSetter.Zero();
 
-                if (index == EImgVwrSizeItem)
+                if(index == EImgVwrSizeItem)
                     {
-                    stringConverter->AsStringL(item, KMPXMediaGeneralSize, 0,
-                            string);
+                    stringConverter->AsStringL(item,
+                            KMPXMediaGeneralSize,0, string );              
                     }
-                else if (index == EImgVwrNameItem)
-                    {
-                    stringConverter->AsStringL(item, KMPXMediaGeneralTitle,
-                            0, string);
-                    }
-                else if (index == EImgVwrDateAndTimeItem)
+                else if(index == EImgVwrNameItem)
                     {
                     stringConverter->AsStringL(item,
-                            KGlxMediaGeneralLastModifiedDate,
-                            R_QTN_DATE_USUAL_WITH_ZERO, string);
+                            KMPXMediaGeneralTitle,0, string );
                     }
-                else if (index == EImgVwrMimeTypeItem)
-                    {
-                    stringConverter->AsStringL(item,
-                            KMPXMediaGeneralMimeType, 0, string);
+                else if(index == EImgVwrDateAndTimeItem)
+                    {  
+                    stringConverter->AsStringL( item, 
+                            KGlxMediaGeneralLastModifiedDate,
+                            R_QTN_DATE_USUAL_WITH_ZERO,string );
                     }
-                else if (index == EImgVwrResolutionItem)
+                else if(index == EImgVwrDescriptionItem)
                     {
                     stringConverter->AsStringL(item,
-                            KGlxMediaGeneralDimensions, 0, string);
+                            KMPXMediaGeneralComment,0, string ); 
                     }
-                else if (index == EImgVwrlicenseItem)
+                else if(index == EImgVwrResolutionItem)
                     {
-                    // If an item is DRM protected, License field in details
-                    // should display "View Details"
-                    string = StringLoader::LoadL(
-                            R_GLX_METADATA_VIEW_OPTIONS_VIEW);
-                    }
-                else
+                    stringConverter->AsStringL(item,
+                            KGlxMediaGeneralDimensions,0, string );
+                    }    
+                else if(index == EImgVwrlicenseItem)
+					{
+					// If an item is DRM protected, License field in details
+					// should display "View Details"
+					string = StringLoader::LoadL(R_GLX_METADATA_VIEW_OPTIONS_VIEW);
+					}                
+                else 
                     {
                     //no implementation
-                    }
-                if (string)
+                    } 
+                if(string)
                     {
                     iTextSetter.Zero();
                     iTextSetter.Append(*string);
                     }
-                CleanupStack::PushL(string);
-                EditItemL(index, EFalse);
-                CleanupStack::PopAndDestroy(string);
+                CleanupStack::PushL( string );
+                EditItemL(index,EFalse);   
+                CleanupStack::PopAndDestroy(string );           
                 }
-            CleanupStack::PopAndDestroy(stringConverter);
-            }
+            CleanupStack::PopAndDestroy(stringConverter );
+            }   
         }
+
+
     }
-
 // ----------------------------------------------------------------------------
 // EnableMarqueingL
 // ----------------------------------------------------------------------------
 //  
 void CGlxImgVwrMetadataContainer::EnableMarqueingL()
     {
-    TRACER("CGlxImgVwrMetadataContainer::EnableMarqueingL()");
+    TRACER("CGlxImgVwrMetadataContainer::EnableMarqueingL()");    
     iMarquee = ETrue;
     ListBox()->UseLogicalToVisualConversion(ETrue);
-    ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams(
-            KMarqueeLoopCount, KMarqueeScrollAmount, KMarqueeScrollDelay,
-            KMarqueeScrollInterval);
+    ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams (KMarqueeLoopCount,
+            KMarqueeScrollAmount, KMarqueeScrollDelay, KMarqueeScrollInterval);
     ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
-    }
-
+    }    
 // ----------------------------------------------------------------------------
 // HandleCommandCompleteL
 // ----------------------------------------------------------------------------
 // 
-void CGlxImgVwrMetadataContainer::HandleCommandCompleteL(
-        TAny* /*aSessionId*/, CMPXCommand* /*aCommandResult*/,
-        TInt /*aError*/, MGlxMediaList* /*aList*/)
+void CGlxImgVwrMetadataContainer::HandleCommandCompleteL(TAny* /*aSessionId*/, 
+        CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/)
     {
     TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()");
     }
@@ -364,58 +393,63 @@
 // HandleItemRemoved
 // ----------------------------------------------------------------------------
 //  
-void CGlxImgVwrMetadataContainer::HandleItemRemovedL(TInt /*aStartIndex*/,
-        TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
+void CGlxImgVwrMetadataContainer::HandleItemRemovedL(  TInt /*aStartIndex*/, TInt /*aEndIndex*/, 
+        MGlxMediaList* /*aList*/  )
     {
-    TRACER("CGlxImgVwrMetadataContainer::HandleItemRemovedL()");
-    }
-
+    TRACER("CGlxImgVwrMetadataContainer::HandleItemRemovedL()");    
+    }    
 // ----------------------------------------------------------------------------
 // HandleFocusChangedL
 // ----------------------------------------------------------------------------
 //  
-void CGlxImgVwrMetadataContainer::HandleFocusChangedL(
-        NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/,
-        TInt /*aOldIndex*/, MGlxMediaList* /*aList*/)
+void CGlxImgVwrMetadataContainer::HandleFocusChangedL( NGlxListDefs::
+        TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, 
+        MGlxMediaList* /*aList*/ )
     {
     TRACER("CGlxImgVwrMetadataContainer::HandleFocusChangedL()");
     }
-
 // ----------------------------------------------------------------------------
 // HandleItemSelected
 // ----------------------------------------------------------------------------
 //  
-void CGlxImgVwrMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/,
-        TBool /*aSelected*/, MGlxMediaList* /*aList*/)
+void CGlxImgVwrMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/, 
+        TBool /*aSelected*/, MGlxMediaList* /*aList*/ )
     {
     TRACER("CGlxImgVwrMetadataContainer::HandleItemSelectedL");
     }
-
 // ----------------------------------------------------------------------------
 // HandleMessageL
 // ----------------------------------------------------------------------------
 //    
-void CGlxImgVwrMetadataContainer::HandleMessageL(
-        const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/)
+void CGlxImgVwrMetadataContainer::HandleMessageL( const CMPXMessage& /*aMessage*/, 
+        MGlxMediaList* /*aList*/ )
     {
     TRACER("CGlxImgVwrMetadataContainer::HandleMessageL()");
     }
-
 // ----------------------------------------------------------------------------
 // HandleError
 // ----------------------------------------------------------------------------
 //
-void CGlxImgVwrMetadataContainer::HandleError(TInt /*aError*/)
+void CGlxImgVwrMetadataContainer::HandleError( TInt /*aError*/ ) 
     {
     TRACER("CGlxImgVwrMetadataContainer::HandleError()");
+    TRAP_IGNORE(HandleErrorL());
     }
 
 // ----------------------------------------------------------------------------
+// HandleErrorL
+// ----------------------------------------------------------------------------
+//
+void CGlxImgVwrMetadataContainer::HandleErrorL()
+    {
+    TRACER("CGlxImgVwrMetadataContainer::HandleErrorL()");
+    }
+// ----------------------------------------------------------------------------
 // HandleCommandCompleteL
 // ----------------------------------------------------------------------------
 //  
-void CGlxImgVwrMetadataContainer::HandleCommandCompleteL(
-        CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/)
+void CGlxImgVwrMetadataContainer::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, 
+        TInt /*aError*/, MGlxMediaList* /*aList*/ )
     {
     TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()");
     }
@@ -424,8 +458,7 @@
 // HandleMediaL
 // ----------------------------------------------------------------------------
 //  
-void CGlxImgVwrMetadataContainer::HandleMediaL(TInt /*aListIndex*/,
-        MGlxMediaList* /*aList*/)
+void CGlxImgVwrMetadataContainer::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ )
     {
     TRACER("CGlxImgVwrMetadataContainer::HandleMediaL()");
     }
@@ -434,40 +467,48 @@
 // HandleItemModifiedL
 // ----------------------------------------------------------------------------
 //  
-void CGlxImgVwrMetadataContainer::HandleItemModifiedL(
-        const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/)
+void CGlxImgVwrMetadataContainer::HandleItemModifiedL( const RArray<TInt>& /*aItemIndexes*/,
+        MGlxMediaList* /*aList*/ )
     {
     TRACER("CGlxImgVwrMetadataContainer::HandleItemModifiedL()");
     }
-
 // ----------------------------------------------------------------------------
 // ChangeMskL
-// ----------------------------------------------------------------------------    
+// ----------------------------------------------------------------------------
+//     
 void CGlxImgVwrMetadataContainer::ChangeMskL()
     {
-    TRACER("CGlxImgVwrMetadataContainer::ChangeMskL()");
-    CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
-    CleanupClosePushL(*uiUtility);
-    switch (ListBox()->CurrentItemIndex())
+    TRACER("CGlxImgVwrMetadataContainer::ChangeMsk()");
+    TInt index = ListBox()->CurrentItemIndex();
+    CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();               
+    switch(index)
         {
-        case EImgVwrNameItem:
-        case EImgVwrMimeTypeItem:
+        case EImgVwrNameItem:        
+        case EImgVwrDescriptionItem:
+            {
+            uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+                    EAknSoftkeyEdit,R_GLX_METADATA_MSK_EDIT);
+            }        
+            break;          
         case EImgVwrDateAndTimeItem:
         case EImgVwrSizeItem:
         case EImgVwrResolutionItem:
         case EImgVwrlicenseItem:
             {
-            uiUtility->ScreenFurniture()->ModifySoftkeyIdL(
-                    CEikButtonGroupContainer::EMiddleSoftkeyPosition,
-                    EAknSoftkeyEdit, R_GLX_METADATA_MSK_BLANK);
-            }
+            uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+                    EAknSoftkeyEdit,R_GLX_METADATA_MSK_BLANK);            
+            }        
             break;
         default:
             {
-            break;
+            break;    
             }
         }
-    CleanupStack::PopAndDestroy(uiUtility);
+
+    if ( uiUtility )
+        {
+        uiUtility->Close();
+        }   
     }
 
 //-----------------------------------------------------------------------------
@@ -479,105 +520,103 @@
 
     //create the collection path for the medialist to be created
     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
-    CleanupStack::PushL(path);
-    // Set the Image viewer collection path as the details dialog 
-    // can be launched from private or user data path
-    path->AppendL(KGlxCollectionPluginImageViewerImplementationUid);
+    CleanupStack::PushL( path );
+    //set the all collection path as the details dialog can be launched from any of the grid views and filter with URI
+    path->AppendL(/*KGlxCollectionPluginAllImplementationUid*/KGlxCollectionPluginImageViewerImplementationUid);
     //create the filter with the URI
-    CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(iUri);
-    CleanupStack::PushL(filter);
+    CMPXFilter* filter  = TGlxFilterFactory::CreateURIFilterL(iUri);  
+    CleanupStack::PushL( filter );
     //create the medialist   
-    iItemMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId(
-            KMediaListId), filter);
+    iItemMediaList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(KMediaListId),filter);   
 
     //Add the attributes which are required to be displayed.
-    iMainListAttributecontext = new (ELeave) CGlxAttributeContext(
-            &iSelectionIterator);
+    iMainListAttributecontext = new (ELeave) CGlxAttributeContext(&iSelectionIterator);
     iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected);
     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize);
-    iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions);
+    iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions); 
     iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralTitle);
     iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralLastModifiedDate);
-    iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralMimeType);
+    iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralComment); 
 
     //Add Context so that we get the handleattributes call once the medialist is populated with above mentioned attributes.
-    iItemMediaList->AddContextL(iMainListAttributecontext,
-            KGlxFetchContextPriorityBlocking);
+    iItemMediaList->AddContextL( iMainListAttributecontext,
+            KGlxFetchContextPriorityBlocking );
 
     //add to observer for callbacks.
     iItemMediaList->AddMediaListObserverL(this);
 
-    CleanupStack::PopAndDestroy(filter);
-    CleanupStack::PopAndDestroy(path);
+    CleanupStack::PopAndDestroy( filter );
+    CleanupStack::PopAndDestroy( path ); 
     }
-
 // ----------------------------------------------------------------------------
-// CGlxImgVwrMetadataContainer::SetAttributesL
+// CGlxImgVwrMetadataContainer::SetAttributes
 // ----------------------------------------------------------------------------
 //
 void CGlxImgVwrMetadataContainer::SetAttributesL(TMPXAttribute attribute)
     {
-    TRACER("CGlxImgVwrMetadataContainer::SetAttributesL");
+    TRACER("CGlxImgVwrMetadataContainer::SetAttributesL");    
 
-    if (!iSetVisible)
+    if(!iSetVisible)
         {
         iSetVisible = ETrue;
-        SetLicenseItemVisibilityL();
+        SetDurationLIicenseItemVisibilityL();
         }
     TGlxMedia item = iItemMediaList->Item(0);
     //Create the string convertor instance 
     //String convertor class with provide the specific format for date,location and duration and size.
     CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL();
-    CleanupStack::PushL(stringConverter);
-    HBufC* string = NULL;
+    CleanupStack::PushL(stringConverter );
+    HBufC* string = NULL;    
 
     //if attribute is date and time we need to pass the format it as R_QTN_DATE_USUAL_WITH_ZERO else null
-    if (attribute == KGlxMediaGeneralLastModifiedDate)
+    if(attribute == KGlxMediaGeneralLastModifiedDate)
         {
-        stringConverter->AsStringL(item, attribute,
-                R_QTN_DATE_USUAL_WITH_ZERO, string);
-        }
+        stringConverter->AsStringL(item, 
+                attribute,
+                R_QTN_DATE_USUAL_WITH_ZERO, string );
+        }    
     else
         {
-        stringConverter->AsStringL(item, attribute, 0, string);
+        stringConverter->AsStringL(item,
+                attribute,0, string );
         }
     //get the settings item based on the attribute and set the text.
-    if (string)
+    if ( string )
         {
         iTextSetter.Zero();
         iTextSetter.Append(*string);
-        if (attribute == KMPXMediaGeneralSize)
+        if(attribute == KMPXMediaGeneralSize)
             {
-            EditItemL(EImgVwrSizeItem, EFalse);
-            }
-        else if (attribute == KMPXMediaGeneralTitle)
-            {
-            EditItemL(EImgVwrNameItem, EFalse);
-            }
-        else if (attribute == KGlxMediaGeneralLastModifiedDate)
+            EditItemL(EImgVwrSizeItem,EFalse);
+            }    
+        else if(attribute == KMPXMediaGeneralTitle)
             {
-            EditItemL(EImgVwrDateAndTimeItem, EFalse);
+            EditItemL(EImgVwrNameItem,EFalse);
             }
-        else if (attribute == KMPXMediaGeneralMimeType)
+        else if(attribute == KGlxMediaGeneralLastModifiedDate)
+            {  
+            EditItemL(EImgVwrDateAndTimeItem,EFalse);
+            }
+        else if(attribute == KMPXMediaGeneralComment)
             {
-            EditItemL(EImgVwrMimeTypeItem, EFalse);
+            EditItemL(EImgVwrDescriptionItem,EFalse);
             }
-        else if (attribute == KGlxMediaGeneralDimensions)
+        else if(attribute == KGlxMediaGeneralDimensions)
             {
-            EditItemL(EImgVwrResolutionItem, EFalse);
-            }
+            EditItemL(EImgVwrResolutionItem,EFalse);
+            }/*
         else if(attribute == KMPXMediaDrmProtected)
             {
-            EditItemL(EImgVwrlicenseItem, EFalse);
-            }
+            EditItemL(EImgVwrlicenseItem,EFalse);
+            }*/
         else
             {
-            //no implementation
-            }
+            
+            } 
         delete string;
         string = NULL;
         }
-    CleanupStack::PopAndDestroy(stringConverter);
+    CleanupStack::PopAndDestroy(stringConverter );
     }
 
 // ----------------------------------------------------------------------------
@@ -586,7 +625,7 @@
 //
 void CGlxImgVwrMetadataContainer::EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/)
     {
-    TRACER("CGlxImgVwrMetadataContainer::EditItemL");
+    TRACER("CGlxImgVwrMetadataContainer::EditItemL");   
     CAknSettingItem* settingsitem = NULL;
     settingsitem = (*SettingItemArray())[aIndex];
     settingsitem->LoadL();
@@ -595,30 +634,116 @@
     ListBox()->DrawNow();
     }
 
+
+
 // ----------------------------------------------------------------------------
-// CGlxImgVwrMetadataContainer::SetLicenseItemVisibilityL()
+// CGlxMetadataContainer::SetAttributes
 // ----------------------------------------------------------------------------
-void CGlxImgVwrMetadataContainer::SetLicenseItemVisibilityL()
+//
+void CGlxImgVwrMetadataContainer::SetNameDescriptionL(TInt aItem)
+    {
+    TRACER("CGlxImgVwrMetadataContainer::SetNameDescriptionL");   
+    //This function is commn for updatng both name and description once modified    
+    //get the item handle to be modified       
+    CAknSettingItem* settingsitem = (*SettingItemArray())[aItem]; 
+    HBufC* textBuf = HBufC::NewLC( KMaxMediaPopupTitleLength );
+    (textBuf->Des()).Copy((settingsitem->SettingTextL()));
+    TPtr textPtr = textBuf->Des();
+    TBuf<KMaxMediaPopupTitleLength> titleText(*textBuf);
+    HBufC *buf = NULL;
+    if(aItem == ENameItem)
+        {
+        buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_TITLE_NSERIES);
+        }
+    else
+        {
+        buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_DESCRIPTION_NSERIES);
+        }
+
+    //Launch the text entry editor.
+    CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *buf, textPtr );
+    CleanupStack::PopAndDestroy(buf);
+    if(aItem == EImgVwrDescriptionItem)
+        {
+        popup->SetLeftSoftKeyL(ETrue);
+        }
+    
+    //action upon selecting ok from the editor 
+    if ( popup->ExecuteLD() == EEikBidOk )
     {
-    TRACER("CGlxMetadataContainer::SetLicenseItemVisibilityL()");
+      if(0 != (titleText.Compare(*textBuf)))
+      {
+        //Modify the MDS and setting list only if the entry is different from previous Item value
+        iTextSetter.Zero();
+        iTextSetter.Copy(*textBuf);
+        EditItemL(aItem,EFalse);
+        if( iItemMediaList->Count() > 0 )
+        {
+          iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item
+          CMPXCollectionPath* path = iItemMediaList->PathLC();
+          CMPXCommand* command = NULL;
+          //Create the glx command based on the item
+          if(aItem == ENameItem)
+              {
+              command = TGlxCommandFactory::RenameCommandLC(settingsitem->SettingTextL(),
+     *path); 
+              }
+          else
+              {
+              command = TGlxCommandFactory::SetDescriptionCommandLC(settingsitem->SettingTextL(),
+     *path);
+              }              
+          command->SetTObjectValueL<TAny*>(KMPXCommandGeneralSessionId, static_cast<TAny*>(this));
+          //issue command to the medialist which further calls data source to update MDS
+          iItemMediaList->CommandL(*command);
+          CleanupStack::PopAndDestroy(command);
+          CleanupStack::PopAndDestroy(path);
+          }
+      }         
+    }
+    CleanupStack::PopAndDestroy( textBuf );
+     
+    }
+// ----------------------------------------------------------------------------
+// CGlxImgVwrMetadataContainer::SetDurationLIicenseItemVisibilityL()
+// ----------------------------------------------------------------------------
+// 
+void CGlxImgVwrMetadataContainer::SetDurationLIicenseItemVisibilityL()
+    {
+    TRACER("CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL()");
     //get the media item.
     const TGlxMedia& item = iItemMediaList->Item(0);
     const CGlxMedia* media = item.Properties();
 
-    // Check for DRM protection
-    if (media && media->IsSupported(KMPXMediaDrmProtected))
+    //in order to check for video category and drm rights
+   
+    CAknSettingItem* hiddenItem = NULL;
+        
+     if( media && media->IsSupported(KMPXMediaDrmProtected))
         {
-        if (item.IsDrmProtected())
-            {
-            CAknSettingItem* hiddenItem =
-                    (*SettingItemArray())[EImgVwrlicenseItem];
-            //Set the License item visible
-            hiddenItem->SetHidden(EFalse);
-            //Refresh the listbox when any items visiblity is changed
-            this->HandleChangeInItemArrayOrVisibilityL();
-            }
+         if(item.IsDrmProtected())
+             {
+             hiddenItem = (*SettingItemArray())[EImgVwrlicenseItem];
+             //Set the License item visible
+             hiddenItem->SetHidden(EFalse);             
+             //Required to refresh the listbox when any items visiblity is changed
+             this->HandleChangeInItemArrayOrVisibilityL();
+             }
         }
     }
+//-----------------------------------------------------------------------------
+// CGlxImgVwrMetadataContainer::IsLicenseItem
+//-----------------------------------------------------------------------------
+TBool CGlxImgVwrMetadataContainer::IsLicenseItem()
+    {
+    TRACER("CGlxMetadataContainer::IsLicenseItem()");
+    //Checks the item for DRMProtection.
+    if((ListBox()->CurrentItemIndex()== EImgVwrlicenseItem))
+        {
+        return EFalse;
+        }
+    return ETrue;
+    }
 
 // -----------------------------------------------------------------------------
 // CreateImageViewerInstanceL
@@ -627,7 +752,7 @@
 void CGlxImgVwrMetadataContainer::CreateImageViewerInstanceL()
     {
     TRACER("CGlxImgVwrMetadataContainer::CreateImageViewerInstanceL");
-    iImageViewerInstance = CGlxImageViewerManager::InstanceL();
+    iImageViewerInstance = CGlxImageViewerManager::InstanceL();    
     __ASSERT_ALWAYS(iImageViewerInstance, Panic(EGlxPanicNullPointer));
     }
 
@@ -638,10 +763,11 @@
 void CGlxImgVwrMetadataContainer::DeleteImageViewerInstance()
     {
     TRACER("CGlxImgVwrMetadataContainer::DeleteImageViewerInstance");
-    if (iImageViewerInstance)
+    if ( iImageViewerInstance )
         {
         iImageViewerInstance->DeleteInstance();
         }
     }
 
+
 //End of file