diff -r befca0ec475f -r f87e8c4ac026 videocollection/hgmyvideos/src/vcxhgmyvideoscategorymodelhandler.cpp --- a/videocollection/hgmyvideos/src/vcxhgmyvideoscategorymodelhandler.cpp Wed Sep 01 12:30:28 2010 +0100 +++ b/videocollection/hgmyvideos/src/vcxhgmyvideoscategorymodelhandler.cpp Tue Sep 14 21:23:06 2010 +0300 @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -68,7 +69,9 @@ { CVcxHgMyVideosCategoryModelHandler* self = new (ELeave) CVcxHgMyVideosCategoryModelHandler( aModel, aScroller ); - + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); return self; } @@ -87,6 +90,62 @@ } // ----------------------------------------------------------------------------- +// CVcxHgMyVideosCategoryModelHandler::ConstructL() +// ----------------------------------------------------------------------------- +// +void CVcxHgMyVideosCategoryModelHandler::ConstructL() + { + CheckIfExtraItemsExistsL(); + } + +// ----------------------------------------------------------------------------- +// CVcxHgMyVideosCategoryModelHandler::CheckIfExtraItemsExistsL() +// ----------------------------------------------------------------------------- +// +void CVcxHgMyVideosCategoryModelHandler::CheckIfExtraItemsExistsL() + { + TInt value = 0; + TBuf url; + // Check that cenrep exists and has some valid data + iModel.GetMyVideosCustomizationString( KCRVideoPlayerExtraItem2Url, url ); // ignore error code + if ( url.Length() == 0 ) + { + TInt err = iModel.GetMyVideosCustomizationInt( KCRVideoPlayerExtraItem2Uid, value ); + if ( err == KErrNone && value != 0 ) + { + if ( AppExistsL( TUid::Uid( value ) ) ) + { + iExtraItem2Exists = ETrue; + } + } + } + else + { + iExtraItem2Exists = ETrue; + } + + value = 0; + url.Zero(); + iModel.GetMyVideosCustomizationString( KCRVideoPlayerExtraItem3Url, url ); // ignore error code + if ( url.Length() == 0 ) + { + TInt err = iModel.GetMyVideosCustomizationInt( KCRVideoPlayerExtraItem3Uid, value ); + if ( err == KErrNone && value != 0 ) + { + if ( AppExistsL( TUid::Uid( value ) ) ) + { + iExtraItem3Exists = ETrue; + } + } + } + else + { + iExtraItem3Exists = ETrue; + } + + } + +// ----------------------------------------------------------------------------- // CVcxHgMyVideosCategoryModelHandler::~CVcxHgMyVideosCategoryModelHandler() // ----------------------------------------------------------------------------- // @@ -668,7 +727,7 @@ { IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # UpdateCategoryListL() - Enter" ); - MakeCategoryIdArray(); + MakeCategoryIdArrayL(); if ( iCategoryIdArray.Count() != iScroller.ItemCount() ) { @@ -758,12 +817,12 @@ } // ----------------------------------------------------------------------------- -// CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArray() +// CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArrayL() // ----------------------------------------------------------------------------- // -void CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArray() +void CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArrayL() { - IPTVLOGSTRING_LOW_LEVEL("CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArray"); + IPTVLOGSTRING_LOW_LEVEL("CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArrayL"); iCategoryIdArray.Reset(); @@ -776,7 +835,7 @@ if ( error == KErrNone && value > EMyVideosListItemTypeEmpty ) { - IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # MakeCategoryIdArray() Getting category items from cenrep" ); + IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # MakeCategoryIdArrayL() Getting category items from cenrep" ); for ( TInt i=KCRVideoPlayerItemLocation1; i<=KCRVideoPlayerItemLocation7; i++ ) { @@ -813,17 +872,17 @@ if ( AcceptCategory( categoryId ) ) { - iCategoryIdArray.Append( categoryId ); + iCategoryIdArray.AppendL( categoryId ); } } } } else { - iCategoryIdArray.Append( KCategoryIdLastWatched ); - iCategoryIdArray.Append( KVcxMvcCategoryIdCaptured ); - iCategoryIdArray.Append( KVcxMvcCategoryIdOther ); - iCategoryIdArray.Append( KCategoryIdExtraItem1 ); + iCategoryIdArray.AppendL( KCategoryIdLastWatched ); + iCategoryIdArray.AppendL( KVcxMvcCategoryIdCaptured ); + iCategoryIdArray.AppendL( KVcxMvcCategoryIdOther ); + iCategoryIdArray.AppendL( KCategoryIdExtraItem1 ); } } @@ -841,12 +900,20 @@ case KVcxMvcCategoryIdOther: case KCategoryIdLastWatched: case KCategoryIdExtraItem1: - case KCategoryIdExtraItem2: - case KCategoryIdExtraItem3: IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # AcceptCategory() Accepted category: %d", aCategoryId ); ret = ETrue; break; + case KCategoryIdExtraItem2: + ret = iExtraItem2Exists; + IPTVLOGSTRING2_LOW_LEVEL( + "MPX My Videos UI # AcceptCategory() extra item 2 accepted: %d", ret ); + break; + case KCategoryIdExtraItem3: + ret = iExtraItem3Exists; + IPTVLOGSTRING2_LOW_LEVEL( + "MPX My Videos UI # AcceptCategory() extra item 3 accepted: %d", ret ); + break; default: IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # AcceptCategory() Unknown category: %d", aCategoryId ); @@ -1248,3 +1315,26 @@ return EFalse; } } + +// ------------------------------------------------------------------------------ +// CVcxHgMyVideosVideoModelHandler::AppExistsL() +// ------------------------------------------------------------------------------ +// +TBool CVcxHgMyVideosCategoryModelHandler::AppExistsL( const TUid& aAppUid ) + { + IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::AppExistsL()" ); + TBool retVal( EFalse ); + RApaLsSession appArcSession; + User::LeaveIfError( appArcSession.Connect() ); + CleanupClosePushL( appArcSession ); + + TApaAppInfo appInfo; + TInt err = appArcSession.GetAppInfo( appInfo, aAppUid ); + if ( err == KErrNone ) + { + IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::AppExistsL(): return TRUE" ); + retVal = ETrue; + } + CleanupStack::PopAndDestroy( &appArcSession ); + return retVal; + }