diff -r b023a8d2866a -r ea65f74e6de4 photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatacontainer.cpp --- a/photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatacontainer.cpp Thu Jul 15 18:39:01 2010 +0300 +++ b/photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatacontainer.cpp Thu Aug 19 09:55:03 2010 +0300 @@ -1,68 +1,43 @@ /* -* 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 + * 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". * - * Created on: Oct 22, 2009 - * Author: sourbasu + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Image viewer metadata dialog implementation */ - #include "glximgvwrmetadatacontainer.h" #include "glxustringconverter.h" // converts the symbian types to UString type -#include #include #include -#include #include #include #include #include //Details data provider #include -#include // For CGlxCommandHandlerAddToContainer -#include // for command handler id -#include //for command factory #include // Content ID identifying general category of content provided - -#include -#include -#include -#include // tag collection plugin uid -#include // KGlxMediaIdThumbnail #include // CGlxAttributeReteiver -#include #include //For launching DRM details pane -#include // General utilties class definition -#include -#include //For CExifModify +#include #include #include -#include - -//marquee +#include +#include // For marquee +#include // For marquee -#include -#include -const TInt KMaxMediaPopupTitleLength = 0x100; -const TInt KMediaListId = 0x2000D248; -const TInt KMarqueeLoopCount = 3; -const TInt KMarqueeScrollAmount = 20; -const TInt KMarqueeScrollDelay = 1000000; -const TInt KMarqueeScrollInterval = 200000; +const TInt KMediaListId = 0x2000D248; +const TInt KMarqueeLoopCount = 3; +const TInt KMarqueeScrollAmount = 20; +const TInt KMarqueeScrollDelay = 1000000; +const TInt KMarqueeScrollInterval = 200000; // ============================ MEMBER FUNCTIONS =============================== @@ -70,10 +45,12 @@ // 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; } @@ -82,12 +59,14 @@ // 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; } @@ -95,18 +74,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 @@ -121,19 +100,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); } @@ -147,43 +126,38 @@ { 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 EImgVwrDescriptionItem: - { - settingItem = new (ELeave) CAknTextSettingItem( - aResourceId, iTextSetter ); - - break; - } - case EImgVwrSizeItem: + case EImgVwrMimeTypeItem: + 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); @@ -194,57 +168,65 @@ 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("CGlxMetadataContainer::HandleListBoxEventL()"); - GLX_LOG_INFO("CGlxImgVwrMetadataContainer::HandleListBoxEventL"); + TRACER("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()) { - drmUtility->ShowDRMDetailsPaneL(iImageViewerInstance->ImageFileHandle()); + 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); + } } else { - drmUtility->ShowDRMDetailsPaneL(iItemMediaList->Item(0).Uri()); + 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); + } } CleanupStack::PopAndDestroy(drmUtility); DeleteImageViewerInstance(); @@ -252,139 +234,128 @@ } } -// ---------------------------------------------------------------------------- -// 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& aAttributes, MGlxMediaList* aList ) +void CGlxImgVwrMetadataContainer::HandleAttributesAvailableL( + TInt /*aItemIndex*/, const RArray& 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(); } - SetDurationLIicenseItemVisibilityL(); - if(aList == iItemMediaList) + SetLicenseItemVisibilityL(); + 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) + else if (index == EImgVwrNameItem) + { + stringConverter->AsStringL(item, KMPXMediaGeneralTitle, + 0, string); + } + else if (index == EImgVwrDateAndTimeItem) { stringConverter->AsStringL(item, - KMPXMediaGeneralTitle,0, string ); + KGlxMediaGeneralLastModifiedDate, + R_QTN_DATE_USUAL_WITH_ZERO, string); } - else if(index == EImgVwrDateAndTimeItem) - { - stringConverter->AsStringL( item, - KGlxMediaGeneralLastModifiedDate, - R_QTN_DATE_USUAL_WITH_ZERO,string ); + else if (index == EImgVwrMimeTypeItem) + { + stringConverter->AsStringL(item, + KMPXMediaGeneralMimeType, 0, string); } - else if(index == EImgVwrDescriptionItem) + else if (index == EImgVwrResolutionItem) { stringConverter->AsStringL(item, - KMPXMediaGeneralComment,0, string ); + KGlxMediaGeneralDimensions, 0, string); } - else if(index == EImgVwrResolutionItem) + else if (index == EImgVwrlicenseItem) { - 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 + // 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()"); } @@ -393,63 +364,58 @@ // 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()"); } @@ -458,7 +424,8 @@ // HandleMediaL // ---------------------------------------------------------------------------- // -void CGlxImgVwrMetadataContainer::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) +void CGlxImgVwrMetadataContainer::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) { TRACER("CGlxImgVwrMetadataContainer::HandleMediaL()"); } @@ -467,48 +434,40 @@ // HandleItemModifiedL // ---------------------------------------------------------------------------- // -void CGlxImgVwrMetadataContainer::HandleItemModifiedL( const RArray& /*aItemIndexes*/, - MGlxMediaList* /*aList*/ ) +void CGlxImgVwrMetadataContainer::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/) { TRACER("CGlxImgVwrMetadataContainer::HandleItemModifiedL()"); } + // ---------------------------------------------------------------------------- // ChangeMskL -// ---------------------------------------------------------------------------- -// +// ---------------------------------------------------------------------------- void CGlxImgVwrMetadataContainer::ChangeMskL() { - TRACER("CGlxImgVwrMetadataContainer::ChangeMsk()"); - TInt index = ListBox()->CurrentItemIndex(); - CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); - switch(index) + TRACER("CGlxImgVwrMetadataContainer::ChangeMskL()"); + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + CleanupClosePushL(*uiUtility); + switch (ListBox()->CurrentItemIndex()) { - case EImgVwrNameItem: - case EImgVwrDescriptionItem: - { - uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, - EAknSoftkeyEdit,R_GLX_METADATA_MSK_EDIT); - } - break; + case EImgVwrNameItem: + case EImgVwrMimeTypeItem: 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; } } - - if ( uiUtility ) - { - uiUtility->Close(); - } + CleanupStack::PopAndDestroy(uiUtility); } //----------------------------------------------------------------------------- @@ -520,103 +479,105 @@ //create the collection path for the medialist to be created CMPXCollectionPath* path = CMPXCollectionPath::NewL(); - 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); + 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); //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(KMPXMediaGeneralComment); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralMimeType); //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::SetAttributes +// CGlxImgVwrMetadataContainer::SetAttributesL // ---------------------------------------------------------------------------- // void CGlxImgVwrMetadataContainer::SetAttributesL(TMPXAttribute attribute) { - TRACER("CGlxImgVwrMetadataContainer::SetAttributesL"); + TRACER("CGlxImgVwrMetadataContainer::SetAttributesL"); - if(!iSetVisible) + if (!iSetVisible) { iSetVisible = ETrue; - SetDurationLIicenseItemVisibilityL(); + SetLicenseItemVisibilityL(); } 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(EImgVwrSizeItem, EFalse); + } + else if (attribute == KMPXMediaGeneralTitle) { - EditItemL(EImgVwrNameItem,EFalse); + EditItemL(EImgVwrNameItem, EFalse); } - else if(attribute == KGlxMediaGeneralLastModifiedDate) - { - EditItemL(EImgVwrDateAndTimeItem,EFalse); + else if (attribute == KGlxMediaGeneralLastModifiedDate) + { + EditItemL(EImgVwrDateAndTimeItem, EFalse); } - else if(attribute == KMPXMediaGeneralComment) + else if (attribute == KMPXMediaGeneralMimeType) { - EditItemL(EImgVwrDescriptionItem,EFalse); + EditItemL(EImgVwrMimeTypeItem, 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); } // ---------------------------------------------------------------------------- @@ -625,7 +586,7 @@ // void CGlxImgVwrMetadataContainer::EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/) { - TRACER("CGlxImgVwrMetadataContainer::EditItemL"); + TRACER("CGlxImgVwrMetadataContainer::EditItemL"); CAknSettingItem* settingsitem = NULL; settingsitem = (*SettingItemArray())[aIndex]; settingsitem->LoadL(); @@ -634,116 +595,30 @@ ListBox()->DrawNow(); } - - -// ---------------------------------------------------------------------------- -// CGlxMetadataContainer::SetAttributes // ---------------------------------------------------------------------------- -// -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 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 ) +// CGlxImgVwrMetadataContainer::SetLicenseItemVisibilityL() +// ---------------------------------------------------------------------------- +void CGlxImgVwrMetadataContainer::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(KMPXCommandGeneralSessionId, static_cast(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()"); + TRACER("CGlxMetadataContainer::SetLicenseItemVisibilityL()"); //get the media item. const TGlxMedia& item = iItemMediaList->Item(0); const CGlxMedia* media = item.Properties(); - //in order to check for video category and drm rights - - CAknSettingItem* hiddenItem = NULL; - - if( media && media->IsSupported(KMPXMediaDrmProtected)) + // Check for DRM protection + if (media && media->IsSupported(KMPXMediaDrmProtected)) { - 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(); - } + 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(); + } } } -//----------------------------------------------------------------------------- -// CGlxImgVwrMetadataContainer::IsLicenseItem -//----------------------------------------------------------------------------- -TBool CGlxImgVwrMetadataContainer::IsLicenseItem() - { - TRACER("CGlxMetadataContainer::IsLicenseItem()"); - //Checks the item for DRMProtection. - if((ListBox()->CurrentItemIndex()== EImgVwrlicenseItem)) - { - return EFalse; - } - return ETrue; - } // ----------------------------------------------------------------------------- // CreateImageViewerInstanceL @@ -752,7 +627,7 @@ void CGlxImgVwrMetadataContainer::CreateImageViewerInstanceL() { TRACER("CGlxImgVwrMetadataContainer::CreateImageViewerInstanceL"); - iImageViewerInstance = CGlxImageViewerManager::InstanceL(); + iImageViewerInstance = CGlxImageViewerManager::InstanceL(); __ASSERT_ALWAYS(iImageViewerInstance, Panic(EGlxPanicNullPointer)); } @@ -763,11 +638,10 @@ void CGlxImgVwrMetadataContainer::DeleteImageViewerInstance() { TRACER("CGlxImgVwrMetadataContainer::DeleteImageViewerInstance"); - if ( iImageViewerInstance ) + if (iImageViewerInstance) { iImageViewerInstance->DeleteInstance(); } } - //End of file