37 #include <AknUtils.h> |
37 #include <AknUtils.h> |
38 #include <aknlayoutscalable_avkon.cdl.h> |
38 #include <aknlayoutscalable_avkon.cdl.h> |
39 #include <coemain.h> |
39 #include <coemain.h> |
40 #include <aknappui.h> |
40 #include <aknappui.h> |
41 #include <bautils.h> |
41 #include <bautils.h> |
42 #include <apgcli.h> |
|
43 |
42 |
44 #include <vcxhgmyvideosicons.mbg> |
43 #include <vcxhgmyvideosicons.mbg> |
45 #include <myvideosindicator.h> |
44 #include <myvideosindicator.h> |
46 #include <vcxhgmyvideos.rsg> |
45 #include <vcxhgmyvideos.rsg> |
47 #include <vcxmyvideosdefs.h> |
46 #include <vcxmyvideosdefs.h> |
67 CVcxHgMyVideosModel& aModel, |
66 CVcxHgMyVideosModel& aModel, |
68 CHgScroller& aScroller ) |
67 CHgScroller& aScroller ) |
69 { |
68 { |
70 CVcxHgMyVideosCategoryModelHandler* self = |
69 CVcxHgMyVideosCategoryModelHandler* self = |
71 new (ELeave) CVcxHgMyVideosCategoryModelHandler( aModel, aScroller ); |
70 new (ELeave) CVcxHgMyVideosCategoryModelHandler( aModel, aScroller ); |
72 CleanupStack::PushL( self ); |
71 |
73 self->ConstructL(); |
|
74 CleanupStack::Pop( self ); |
|
75 return self; |
72 return self; |
76 } |
73 } |
77 |
74 |
78 |
75 |
79 // ----------------------------------------------------------------------------- |
76 // ----------------------------------------------------------------------------- |
85 : iModel( aModel ), |
82 : iModel( aModel ), |
86 iScroller( aScroller ), |
83 iScroller( aScroller ), |
87 iTnManager( aModel.ThumbnailManager() ), |
84 iTnManager( aModel.ThumbnailManager() ), |
88 iTnRequestId( KErrNotFound ) |
85 iTnRequestId( KErrNotFound ) |
89 { |
86 { |
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CVcxHgMyVideosCategoryModelHandler::ConstructL() |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 void CVcxHgMyVideosCategoryModelHandler::ConstructL() |
|
97 { |
|
98 CheckIfExtraItemsExistsL(); |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CVcxHgMyVideosCategoryModelHandler::CheckIfExtraItemsExistsL() |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CVcxHgMyVideosCategoryModelHandler::CheckIfExtraItemsExistsL() |
|
106 { |
|
107 TInt value = 0; |
|
108 TBuf<KMyVideosTitleUrlMaxLength> url; |
|
109 // Check that cenrep exists and has some valid data |
|
110 iModel.GetMyVideosCustomizationString( KCRVideoPlayerExtraItem2Url, url ); // ignore error code |
|
111 if ( url.Length() == 0 ) |
|
112 { |
|
113 TInt err = iModel.GetMyVideosCustomizationInt( KCRVideoPlayerExtraItem2Uid, value ); |
|
114 if ( err == KErrNone && value != 0 ) |
|
115 { |
|
116 if ( AppExistsL( TUid::Uid( value ) ) ) |
|
117 { |
|
118 iExtraItem2Exists = ETrue; |
|
119 } |
|
120 } |
|
121 } |
|
122 else |
|
123 { |
|
124 iExtraItem2Exists = ETrue; |
|
125 } |
|
126 |
|
127 value = 0; |
|
128 url.Zero(); |
|
129 iModel.GetMyVideosCustomizationString( KCRVideoPlayerExtraItem3Url, url ); // ignore error code |
|
130 if ( url.Length() == 0 ) |
|
131 { |
|
132 TInt err = iModel.GetMyVideosCustomizationInt( KCRVideoPlayerExtraItem3Uid, value ); |
|
133 if ( err == KErrNone && value != 0 ) |
|
134 { |
|
135 if ( AppExistsL( TUid::Uid( value ) ) ) |
|
136 { |
|
137 iExtraItem3Exists = ETrue; |
|
138 } |
|
139 } |
|
140 } |
|
141 else |
|
142 { |
|
143 iExtraItem3Exists = ETrue; |
|
144 } |
|
145 |
|
146 } |
87 } |
147 |
88 |
148 // ----------------------------------------------------------------------------- |
89 // ----------------------------------------------------------------------------- |
149 // CVcxHgMyVideosCategoryModelHandler::~CVcxHgMyVideosCategoryModelHandler() |
90 // CVcxHgMyVideosCategoryModelHandler::~CVcxHgMyVideosCategoryModelHandler() |
150 // ----------------------------------------------------------------------------- |
91 // ----------------------------------------------------------------------------- |
725 // |
666 // |
726 void CVcxHgMyVideosCategoryModelHandler::UpdateCategoryListL() |
667 void CVcxHgMyVideosCategoryModelHandler::UpdateCategoryListL() |
727 { |
668 { |
728 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # UpdateCategoryListL() - Enter" ); |
669 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # UpdateCategoryListL() - Enter" ); |
729 |
670 |
730 MakeCategoryIdArrayL(); |
671 MakeCategoryIdArray(); |
731 |
672 |
732 if ( iCategoryIdArray.Count() != iScroller.ItemCount() ) |
673 if ( iCategoryIdArray.Count() != iScroller.ItemCount() ) |
733 { |
674 { |
734 iScroller.ResizeL( iCategoryIdArray.Count() ); |
675 iScroller.ResizeL( iCategoryIdArray.Count() ); |
735 } |
676 } |
815 } |
756 } |
816 return ret; |
757 return ret; |
817 } |
758 } |
818 |
759 |
819 // ----------------------------------------------------------------------------- |
760 // ----------------------------------------------------------------------------- |
820 // CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArrayL() |
761 // CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArray() |
821 // ----------------------------------------------------------------------------- |
762 // ----------------------------------------------------------------------------- |
822 // |
763 // |
823 void CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArrayL() |
764 void CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArray() |
824 { |
765 { |
825 IPTVLOGSTRING_LOW_LEVEL("CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArrayL"); |
766 IPTVLOGSTRING_LOW_LEVEL("CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArray"); |
826 |
767 |
827 iCategoryIdArray.Reset(); |
768 iCategoryIdArray.Reset(); |
828 |
769 |
829 TInt error = KErrNone; |
770 TInt error = KErrNone; |
830 TInt value = KErrNotFound; |
771 TInt value = KErrNotFound; |
833 // Check that cenrep exists and has some valid data |
774 // Check that cenrep exists and has some valid data |
834 error = iModel.GetMyVideosCustomizationInt( KCRVideoPlayerItemLocation1, value ); |
775 error = iModel.GetMyVideosCustomizationInt( KCRVideoPlayerItemLocation1, value ); |
835 |
776 |
836 if ( error == KErrNone && value > EMyVideosListItemTypeEmpty ) |
777 if ( error == KErrNone && value > EMyVideosListItemTypeEmpty ) |
837 { |
778 { |
838 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # MakeCategoryIdArrayL() Getting category items from cenrep" ); |
779 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # MakeCategoryIdArray() Getting category items from cenrep" ); |
839 |
780 |
840 for ( TInt i=KCRVideoPlayerItemLocation1; i<=KCRVideoPlayerItemLocation7; i++ ) |
781 for ( TInt i=KCRVideoPlayerItemLocation1; i<=KCRVideoPlayerItemLocation7; i++ ) |
841 { |
782 { |
842 error = iModel.GetMyVideosCustomizationInt( i , value ); |
783 error = iModel.GetMyVideosCustomizationInt( i , value ); |
843 if ( error == KErrNone && value != EMyVideosListItemTypeEmpty ) |
784 if ( error == KErrNone && value != EMyVideosListItemTypeEmpty ) |
870 break; |
811 break; |
871 } |
812 } |
872 |
813 |
873 if ( AcceptCategory( categoryId ) ) |
814 if ( AcceptCategory( categoryId ) ) |
874 { |
815 { |
875 iCategoryIdArray.AppendL( categoryId ); |
816 iCategoryIdArray.Append( categoryId ); |
876 } |
817 } |
877 } |
818 } |
878 } |
819 } |
879 } |
820 } |
880 else |
821 else |
881 { |
822 { |
882 iCategoryIdArray.AppendL( KCategoryIdLastWatched ); |
823 iCategoryIdArray.Append( KCategoryIdLastWatched ); |
883 iCategoryIdArray.AppendL( KVcxMvcCategoryIdCaptured ); |
824 iCategoryIdArray.Append( KVcxMvcCategoryIdCaptured ); |
884 iCategoryIdArray.AppendL( KVcxMvcCategoryIdOther ); |
825 iCategoryIdArray.Append( KVcxMvcCategoryIdOther ); |
885 iCategoryIdArray.AppendL( KCategoryIdExtraItem1 ); |
826 iCategoryIdArray.Append( KCategoryIdExtraItem1 ); |
886 } |
827 } |
887 } |
828 } |
888 |
829 |
889 // ----------------------------------------------------------------------------- |
830 // ----------------------------------------------------------------------------- |
890 // CVcxHgMyVideosCategoryModelHandler::AcceptCategory() |
831 // CVcxHgMyVideosCategoryModelHandler::AcceptCategory() |
898 case KVcxMvcCategoryIdAll: |
839 case KVcxMvcCategoryIdAll: |
899 case KVcxMvcCategoryIdCaptured: |
840 case KVcxMvcCategoryIdCaptured: |
900 case KVcxMvcCategoryIdOther: |
841 case KVcxMvcCategoryIdOther: |
901 case KCategoryIdLastWatched: |
842 case KCategoryIdLastWatched: |
902 case KCategoryIdExtraItem1: |
843 case KCategoryIdExtraItem1: |
|
844 case KCategoryIdExtraItem2: |
|
845 case KCategoryIdExtraItem3: |
903 IPTVLOGSTRING2_LOW_LEVEL( |
846 IPTVLOGSTRING2_LOW_LEVEL( |
904 "MPX My Videos UI # AcceptCategory() Accepted category: %d", aCategoryId ); |
847 "MPX My Videos UI # AcceptCategory() Accepted category: %d", aCategoryId ); |
905 ret = ETrue; |
848 ret = ETrue; |
906 break; |
|
907 case KCategoryIdExtraItem2: |
|
908 ret = iExtraItem2Exists; |
|
909 IPTVLOGSTRING2_LOW_LEVEL( |
|
910 "MPX My Videos UI # AcceptCategory() extra item 2 accepted: %d", ret ); |
|
911 break; |
|
912 case KCategoryIdExtraItem3: |
|
913 ret = iExtraItem3Exists; |
|
914 IPTVLOGSTRING2_LOW_LEVEL( |
|
915 "MPX My Videos UI # AcceptCategory() extra item 3 accepted: %d", ret ); |
|
916 break; |
849 break; |
917 default: |
850 default: |
918 IPTVLOGSTRING2_LOW_LEVEL( |
851 IPTVLOGSTRING2_LOW_LEVEL( |
919 "MPX My Videos UI # AcceptCategory() Unknown category: %d", aCategoryId ); |
852 "MPX My Videos UI # AcceptCategory() Unknown category: %d", aCategoryId ); |
920 break; |
853 break; |
1313 else |
1246 else |
1314 { |
1247 { |
1315 return EFalse; |
1248 return EFalse; |
1316 } |
1249 } |
1317 } |
1250 } |
1318 |
|
1319 // ------------------------------------------------------------------------------ |
|
1320 // CVcxHgMyVideosVideoModelHandler::AppExistsL() |
|
1321 // ------------------------------------------------------------------------------ |
|
1322 // |
|
1323 TBool CVcxHgMyVideosCategoryModelHandler::AppExistsL( const TUid& aAppUid ) |
|
1324 { |
|
1325 IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::AppExistsL()" ); |
|
1326 TBool retVal( EFalse ); |
|
1327 RApaLsSession appArcSession; |
|
1328 User::LeaveIfError( appArcSession.Connect() ); |
|
1329 CleanupClosePushL( appArcSession ); |
|
1330 |
|
1331 TApaAppInfo appInfo; |
|
1332 TInt err = appArcSession.GetAppInfo( appInfo, aAppUid ); |
|
1333 if ( err == KErrNone ) |
|
1334 { |
|
1335 IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::AppExistsL(): return TRUE" ); |
|
1336 retVal = ETrue; |
|
1337 } |
|
1338 CleanupStack::PopAndDestroy( &appArcSession ); |
|
1339 return retVal; |
|
1340 } |
|