# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284488586 -10800 # Node ID f87e8c4ac0267eeed2b6b57a5b561f30666c4cfd # Parent befca0ec475fba42436f67afc310c55ce5cf4d87 Revision: 201033 Kit: 201035 diff -r befca0ec475f -r f87e8c4ac026 videocollection/hgmyvideos/inc/vcxhgmyvideoscategorymodelhandler.h --- a/videocollection/hgmyvideos/inc/vcxhgmyvideoscategorymodelhandler.h Wed Sep 01 12:30:28 2010 +0100 +++ b/videocollection/hgmyvideos/inc/vcxhgmyvideoscategorymodelhandler.h Tue Sep 14 21:23:06 2010 +0300 @@ -271,7 +271,7 @@ * Goes through given number of categories and * fills iCategoryIdArray from the accepted ones */ - void MakeCategoryIdArray(); + void MakeCategoryIdArrayL(); /** * Checks if the given category is accepted or not. @@ -351,6 +351,24 @@ * @return ETrue if the preloaded does exist, otherwise EFalse */ TBool PreloadedExistsL(); + + /** + * Check if given application exists. + * + * @param aAppUid Application UID + * @return ETrue if application exists in the system, EFalse otherwise. + */ + TBool AppExistsL( const TUid& aAppUid ); + + /** + * Check if extra item applications 2 and 3 exists in the system. + */ + void CheckIfExtraItemsExistsL(); + + /** + * 2nd phase constructor. + */ + void ConstructL(); private: @@ -394,6 +412,16 @@ * Video indicator class instance. Own. */ CMyVideosIndicator* iVideoIndicator; + + /** + * ETrue if extra item 2 exists, i.e. URL available or valid application UID. + */ + TBool iExtraItem2Exists; + + /** + * ETrue if extra item 3 exists, i.e. URL available or valid application UID. + */ + TBool iExtraItem3Exists; }; #endif // VCXHGMYVIDEOSCATEGORYMODELHANDLER_H 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; + } diff -r befca0ec475f -r f87e8c4ac026 videocollection/mpxmyvideoscollection/src/vcxmyvideosasyncfileoperations.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosasyncfileoperations.cpp Wed Sep 01 12:30:28 2010 +0100 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosasyncfileoperations.cpp Tue Sep 14 21:23:06 2010 +0300 @@ -602,9 +602,20 @@ if ( iIsMoveOperation ) { MPX_DEBUG2("CVcxMyVideosAsyncFileOperations:: move operation failed %d", aErr ); - MPX_DEBUG1("CVcxMyVideosAsyncFileOperations:: setting media path back in MDS" ); - iMediaForMoveOp->SetTextValueL( KMPXMediaGeneralUri, iSourcePath ); - iCollection.SetVideoL( *iMediaForMoveOp ); + + if ( ! BaflUtils::FileExists( iCollection.iFs, iSourcePath ) ) + { + MPX_DEBUG1("CVcxMyVideosAsyncFileOperations:: mmc removed, deleting the old media" ); + iCollection.iMyVideosMdsDb->RemoveVideo( iMediaForMoveOp->ValueTObjectL( + KMPXMediaGeneralId ).iId1 ); + } + else + { + MPX_DEBUG1("CVcxMyVideosAsyncFileOperations:: setting media path back in MDS" ); + iMediaForMoveOp->SetTextValueL( KMPXMediaGeneralUri, iSourcePath ); + iCollection.SetVideoL( *iMediaForMoveOp ); + } + MPX_DEBUG1("CVcxMyVideosAsyncFileOperations:: deleting target file"); TInt delErr = BaflUtils::DeleteFile( iCollection.iFs, iTargetPath ); if ( delErr != KErrNone )