185 CPeriodic* iUpdateProgressInfoTimer; |
191 CPeriodic* iUpdateProgressInfoTimer; |
186 |
192 |
187 /* |
193 /* |
188 * callback function for the UpdateProgressInfo |
194 * callback function for the UpdateProgressInfo |
189 */ |
195 */ |
190 static TInt UpdateProgressInfoCallback(TAny* aPtr); |
196 static TInt UpdateProgressInfoCallback(TAny* aPtr); |
191 }; |
197 }; |
192 |
198 |
193 |
199 |
194 |
200 |
195 NONSHARABLE_CLASS( CDownloadsListExecuter ) : public CActive |
201 NONSHARABLE_CLASS( CDownloadsListExecuter ) : public CActive |
196 { |
202 { |
197 public: // Constructors and destructor |
203 public: // Constructors and destructor |
198 |
204 |
199 /** |
205 /** |
200 * Two-phased constructor. |
206 * Two-phased constructor. |
201 */ |
207 */ |
202 static CDownloadsListExecuter* NewL( CDownloadMgrUiDownloadsList& aDownloadsList, |
208 static CDownloadsListExecuter* NewL( CDownloadMgrUiDownloadsList& aDownloadsList, |
203 CDownloadsListExecuter** aReferer ); |
209 CDownloadsListExecuter** aReferer ); |
204 |
210 |
205 /** |
211 /** |
206 * Two-phased constructor. |
212 * Two-phased constructor. |
207 */ |
213 */ |
208 static CDownloadsListExecuter* NewL( CDownloadMgrUiDownloadsList& aDownloadsList, |
214 static CDownloadsListExecuter* NewL( CDownloadMgrUiDownloadsList& aDownloadsList, |
209 CDownloadsListExecuter** aReferer, |
215 CDownloadsListExecuter** aReferer, |
210 RHttpDownload& aHighlightDl ); |
216 RHttpDownload& aHighlightDl ); |
211 |
217 |
212 /** |
218 /** |
213 * Destructor. |
219 * Destructor. |
214 */ |
220 */ |
215 virtual ~CDownloadsListExecuter(); |
221 virtual ~CDownloadsListExecuter(); |
216 |
222 |
217 public: // New |
223 public: // New |
218 |
224 |
219 /** |
225 /** |
220 * Invoke RunL. |
226 * Invoke RunL. |
221 */ |
227 */ |
222 void Start(); |
228 void Start(); |
223 |
229 |
224 /** |
230 /** |
225 * Check if the dialog already exists. |
231 * Check if the dialog already exists. |
226 */ |
232 */ |
227 TBool DialogExists() const; |
233 TBool DialogExists() const; |
228 |
234 |
229 /** |
235 /** |
230 * Get a reference. Panics if null! |
236 * Get a reference. Panics if null! |
231 */ |
237 */ |
232 CDownloadsListDlg& Dialog() const; |
238 CDownloadsListDlg& Dialog() const; |
233 |
239 |
234 /** |
240 /** |
235 * Execute the dialog now (wait dialog). |
241 * Execute the dialog now (wait dialog). |
236 */ |
242 */ |
237 void ExecuteLD(); |
243 void ExecuteLD(); |
238 |
244 |
239 private: // Constructors |
245 private: // Constructors |
240 |
246 |
241 /** |
247 /** |
242 * C++ default constructor. |
248 * C++ default constructor. |
243 */ |
249 */ |
244 CDownloadsListExecuter( CDownloadMgrUiDownloadsList& aDownloadsList, |
250 CDownloadsListExecuter( CDownloadMgrUiDownloadsList& aDownloadsList, |
245 CDownloadsListExecuter** aReferer, RHttpDownload* aHighlightDl ); |
251 CDownloadsListExecuter** aReferer, RHttpDownload* aHighlightDl ); |
246 |
252 |
247 /** |
253 /** |
248 * By default Symbian 2nd phase constructor is private. |
254 * By default Symbian 2nd phase constructor is private. |
249 */ |
255 */ |
262 CDownloadsListDlg* iDialog; ///< Not owned - only reference. |
268 CDownloadsListDlg* iDialog; ///< Not owned - only reference. |
263 CDownloadsListExecuter** iReferer; |
269 CDownloadsListExecuter** iReferer; |
264 RHttpDownload* iHighlightDl; ///< Not owned. |
270 RHttpDownload* iHighlightDl; ///< Not owned. |
265 TBool iProgressiveDownload; |
271 TBool iProgressiveDownload; |
266 }; |
272 }; |
267 |
273 |
268 |
274 |
269 |
275 |
270 // ----------------------------------------------------------------------------- |
276 // ----------------------------------------------------------------------------- |
271 // CDownloadsListExecuter::CDownloadsListExecuter |
277 // CDownloadsListExecuter::CDownloadsListExecuter |
272 // ----------------------------------------------------------------------------- |
278 // ----------------------------------------------------------------------------- |
273 // |
279 // |
274 CDownloadsListExecuter::CDownloadsListExecuter |
280 CDownloadsListExecuter::CDownloadsListExecuter |
275 ( CDownloadMgrUiDownloadsList& aDownloadsList, |
281 ( CDownloadMgrUiDownloadsList& aDownloadsList, |
276 CDownloadsListExecuter** aReferer, |
282 CDownloadsListExecuter** aReferer, |
277 RHttpDownload* aHighlightDl ) |
283 RHttpDownload* aHighlightDl ) |
278 : CActive( CActive::EPriorityHigh ), // EPriorityHigh to be visible ASAP. |
284 : CActive( CActive::EPriorityHigh ), // EPriorityHigh to be visible ASAP. |
279 iDownloadsList( aDownloadsList ), |
285 iDownloadsList( aDownloadsList ), |
280 iReferer( aReferer ), |
286 iReferer( aReferer ), |
281 iHighlightDl( aHighlightDl ) |
287 iHighlightDl( aHighlightDl ) |
282 { |
288 { |
283 CActiveScheduler::Add( this ); |
289 CActiveScheduler::Add( this ); |
284 } |
290 } |
451 // ----------------------------------------------------------------------------- |
457 // ----------------------------------------------------------------------------- |
452 // |
458 // |
453 TInt CDownloadsListExecuter::RunError(TInt /*aError*/) |
459 TInt CDownloadsListExecuter::RunError(TInt /*aError*/) |
454 { |
460 { |
455 CLOG_ENTERFN("CDownloadsListExecuter::RunError"); |
461 CLOG_ENTERFN("CDownloadsListExecuter::RunError"); |
456 |
462 |
457 // Reset owner pointer to this object. |
463 // Reset owner pointer to this object. |
458 if ( iReferer ) |
464 if ( iReferer ) |
459 { |
465 { |
460 *iReferer = 0; |
466 *iReferer = 0; |
461 } |
467 } |
462 delete this; |
468 delete this; |
463 |
469 |
464 CLOG_LEAVEFN("CDownloadsListExecuter::RunError"); |
470 CLOG_LEAVEFN("CDownloadsListExecuter::RunError"); |
465 return 0; |
471 return 0; |
466 } |
472 } |
467 |
473 |
468 // ============================ MEMBER FUNCTIONS =============================== |
474 // ============================ MEMBER FUNCTIONS =============================== |
469 |
475 |
470 // ----------------------------------------------------------------------------- |
476 // ----------------------------------------------------------------------------- |
471 // CDownloadsListExtension::CDownloadsListExtension |
477 // CDownloadsListExtension::CDownloadsListExtension |
472 // ----------------------------------------------------------------------------- |
478 // ----------------------------------------------------------------------------- |
473 // |
479 // |
474 CDownloadsListExtension::CDownloadsListExtension |
480 CDownloadsListExtension::CDownloadsListExtension |
475 ( CDownloadMgrUiDownloadsList& aDownloadsList ) |
481 ( CDownloadMgrUiDownloadsList& aDownloadsList ) |
476 : iDownloadsList( aDownloadsList ), |
482 : iDownloadsList( aDownloadsList ), |
477 iIapId( 0 ), |
483 iIapId( 0 ), |
478 iIapIdGotAndSet( ETrue ) |
484 iIapIdGotAndSet( ETrue ) |
479 { |
485 { |
480 } |
486 } |
743 CLOG_WRITE(" iEventHandlerArray"); |
749 CLOG_WRITE(" iEventHandlerArray"); |
744 iIsTimerStarted = EFalse; |
750 iIsTimerStarted = EFalse; |
745 iProgressiveDownload = EFalse; |
751 iProgressiveDownload = EFalse; |
746 iRegistryModel.DownloadMgr().GetBoolAttribute(EDlMgrProgressiveDownload, iProgressiveDownload); |
752 iRegistryModel.DownloadMgr().GetBoolAttribute(EDlMgrProgressiveDownload, iProgressiveDownload); |
747 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::ConstructL"); |
753 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::ConstructL"); |
748 |
754 |
749 //whether the platform supports gallery app or not; defined in browser_platfrom_variant.hrh |
755 //whether the platform supports gallery app or not; defined in browser_platfrom_variant.hrh |
750 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
756 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
751 iPlatformSupportsGallery = ETrue; |
757 iPlatformSupportsGallery = ETrue; |
752 #endif |
758 #endif |
753 |
759 |
754 } |
760 } |
755 |
761 |
756 // ----------------------------------------------------------------------------- |
762 // ----------------------------------------------------------------------------- |
757 // CDownloadMgrUiDownloadsList::NewL |
763 // CDownloadMgrUiDownloadsList::NewL |
758 // ----------------------------------------------------------------------------- |
764 // ----------------------------------------------------------------------------- |
759 // |
765 // |
760 CDownloadMgrUiDownloadsList* CDownloadMgrUiDownloadsList::NewL |
766 CDownloadMgrUiDownloadsList* CDownloadMgrUiDownloadsList::NewL |
761 ( CDownloadMgrUiLibRegistry& aRegistryModel ) |
767 ( CDownloadMgrUiLibRegistry& aRegistryModel ) |
762 { |
768 { |
763 CDownloadMgrUiDownloadsList* self = |
769 CDownloadMgrUiDownloadsList* self = |
764 new ( ELeave ) CDownloadMgrUiDownloadsList( aRegistryModel ); |
770 new ( ELeave ) CDownloadMgrUiDownloadsList( aRegistryModel ); |
765 CleanupStack::PushL( self ); |
771 CleanupStack::PushL( self ); |
766 self->ConstructL(); |
772 self->ConstructL(); |
767 CleanupStack::Pop(); |
773 CleanupStack::Pop(); |
768 return self; |
774 return self; |
791 CLOG_WRITE(" iDownloadMenu"); |
797 CLOG_WRITE(" iDownloadMenu"); |
792 // iExtension should be the last deleted. |
798 // iExtension should be the last deleted. |
793 delete iExtension; |
799 delete iExtension; |
794 iExtension = 0; |
800 iExtension = 0; |
795 CLOG_WRITE(" iExtension"); |
801 CLOG_WRITE(" iExtension"); |
796 delete iAIWServiceHandler; |
802 delete iAIWServiceHandler; |
797 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::~CDownloadMgrUiDownloadsList"); |
803 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::~CDownloadMgrUiDownloadsList"); |
798 } |
804 } |
799 |
805 |
800 // ----------------------------------------------------------------------------- |
806 // ----------------------------------------------------------------------------- |
801 // CDownloadMgrUiDownloadsList::DownloadMenu |
807 // CDownloadMgrUiDownloadsList::DownloadMenu |
802 // ----------------------------------------------------------------------------- |
808 // ----------------------------------------------------------------------------- |
803 // |
809 // |
804 EXPORT_C |
810 EXPORT_C |
805 CDownloadMgrUiDownloadMenu& CDownloadMgrUiDownloadsList::DownloadMenu() const |
811 CDownloadMgrUiDownloadMenu& CDownloadMgrUiDownloadsList::DownloadMenu() const |
806 { |
812 { |
807 __ASSERT_DEBUG( iDownloadMenu, Panic( EUiLibPanNull ) ); |
813 __ASSERT_DEBUG( iDownloadMenu, Panic( EUiLibPanNull ) ); |
808 return(*iDownloadMenu); |
814 return(*iDownloadMenu); |
809 } |
815 } |
810 |
816 |
811 // ----------------------------------------------------------------------------- |
817 // ----------------------------------------------------------------------------- |
812 // CDownloadMgrUiDownloadsList::DisplayDownloadsListL |
818 // CDownloadMgrUiDownloadsList::DisplayDownloadsListL |
813 // ----------------------------------------------------------------------------- |
819 // ----------------------------------------------------------------------------- |
814 // |
820 // |
815 EXPORT_C |
821 EXPORT_C |
816 void CDownloadMgrUiDownloadsList::DisplayDownloadsListL() |
822 void CDownloadMgrUiDownloadsList::DisplayDownloadsListL() |
817 { |
823 { |
818 CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DisplayDownloadsListL"); |
824 CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DisplayDownloadsListL"); |
819 |
825 |
820 long noMediaDls = 0; |
826 long noMediaDls = 0; |
821 iRegistryModel.DownloadMgr().GetIntAttribute( EDlMgrNoMediaDls, noMediaDls ); |
827 iRegistryModel.DownloadMgr().GetIntAttribute( EDlMgrNoMediaDls, noMediaDls ); |
822 TInt dlCount = iRegistryModel.DownloadMgr().CurrentDownloads().Count(); |
828 TInt dlCount = iRegistryModel.DownloadMgr().CurrentDownloads().Count(); |
823 |
829 |
824 if (dlCount > noMediaDls) |
830 if (dlCount > noMediaDls) |
825 iExtension->DisplayDownloadsListAsynchronouslyL(); |
831 iExtension->DisplayDownloadsListAsynchronouslyL(); |
826 |
832 |
827 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DisplayDownloadsListL"); |
833 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DisplayDownloadsListL"); |
828 } |
834 } |
829 |
835 |
830 // ----------------------------------------------------------------------------- |
836 // ----------------------------------------------------------------------------- |
831 // CDownloadMgrUiDownloadsList::DisplayDownloadsListL |
837 // CDownloadMgrUiDownloadsList::DisplayDownloadsListL |
856 |
862 |
857 // ----------------------------------------------------------------------------- |
863 // ----------------------------------------------------------------------------- |
858 // CDownloadMgrUiDownloadsList::IsVisible |
864 // CDownloadMgrUiDownloadsList::IsVisible |
859 // ----------------------------------------------------------------------------- |
865 // ----------------------------------------------------------------------------- |
860 // |
866 // |
861 EXPORT_C |
867 EXPORT_C |
862 TBool CDownloadMgrUiDownloadsList::IsVisible() const |
868 TBool CDownloadMgrUiDownloadsList::IsVisible() const |
863 { |
869 { |
864 return iExtension->IsDialogVisible(); |
870 return iExtension->IsDialogVisible(); |
865 } |
871 } |
866 |
872 |
867 // ----------------------------------------------------------------------------- |
873 // ----------------------------------------------------------------------------- |
868 // CDownloadMgrUiDownloadsList::Count |
874 // CDownloadMgrUiDownloadsList::Count |
869 // ----------------------------------------------------------------------------- |
875 // ----------------------------------------------------------------------------- |
870 // |
876 // |
871 EXPORT_C |
877 EXPORT_C |
872 TInt CDownloadMgrUiDownloadsList::Count() const |
878 TInt CDownloadMgrUiDownloadsList::Count() const |
873 { |
879 { |
874 return ((iListModel!=NULL)?iListModel->Count():0); |
880 return ((iListModel!=NULL)?iListModel->Count():0); |
875 } |
881 } |
876 |
882 |
877 // Not yet supported functions |
883 // Not yet supported functions |
878 EXPORT_C |
884 EXPORT_C |
879 void CDownloadMgrUiDownloadsList::GetIntAttributeL( const TUint /*aAttribute*/, TInt32& /*aValue*/ ) |
885 void CDownloadMgrUiDownloadsList::GetIntAttributeL( const TUint /*aAttribute*/, TInt32& /*aValue*/ ) |
880 { |
886 { |
881 User::Leave( KErrNotSupported ); |
887 User::Leave( KErrNotSupported ); |
882 } |
888 } |
883 |
889 |
884 EXPORT_C |
890 EXPORT_C |
885 void CDownloadMgrUiDownloadsList::GetBoolAttributeL( const TUint /*aAttribute*/, TBool& /*aValue*/ ) |
891 void CDownloadMgrUiDownloadsList::GetBoolAttributeL( const TUint /*aAttribute*/, TBool& /*aValue*/ ) |
886 { |
892 { |
887 User::Leave( KErrNotSupported ); |
893 User::Leave( KErrNotSupported ); |
888 } |
894 } |
889 |
895 |
890 EXPORT_C |
896 EXPORT_C |
891 void CDownloadMgrUiDownloadsList::GetStringAttributeL( const TUint /*aAttribute*/, TDes16& /*aValue*/ ) |
897 void CDownloadMgrUiDownloadsList::GetStringAttributeL( const TUint /*aAttribute*/, TDes16& /*aValue*/ ) |
892 { |
898 { |
893 User::Leave( KErrNotSupported ); |
899 User::Leave( KErrNotSupported ); |
894 } |
900 } |
895 |
901 |
896 EXPORT_C |
902 EXPORT_C |
897 void CDownloadMgrUiDownloadsList::GetStringAttributeL( const TUint /*aAttribute*/, TDes8& /*aValue*/ ) |
903 void CDownloadMgrUiDownloadsList::GetStringAttributeL( const TUint /*aAttribute*/, TDes8& /*aValue*/ ) |
898 { |
904 { |
899 User::Leave( KErrNotSupported ); |
905 User::Leave( KErrNotSupported ); |
900 } |
906 } |
901 |
907 |
902 EXPORT_C |
908 EXPORT_C |
903 void CDownloadMgrUiDownloadsList::SetIntAttributeL( const TUint /*aAttribute*/, TInt32 /*aValue*/ ) |
909 void CDownloadMgrUiDownloadsList::SetIntAttributeL( const TUint /*aAttribute*/, TInt32 /*aValue*/ ) |
904 { |
910 { |
905 User::Leave( KErrNotSupported ); |
911 User::Leave( KErrNotSupported ); |
906 } |
912 } |
907 |
913 |
908 EXPORT_C |
914 EXPORT_C |
909 void CDownloadMgrUiDownloadsList::SetBoolAttributeL( const TUint /*aAttribute*/, TBool /*aValue*/ ) |
915 void CDownloadMgrUiDownloadsList::SetBoolAttributeL( const TUint /*aAttribute*/, TBool /*aValue*/ ) |
910 { |
916 { |
911 User::Leave( KErrNotSupported ); |
917 User::Leave( KErrNotSupported ); |
912 } |
918 } |
913 |
919 |
914 EXPORT_C |
920 EXPORT_C |
915 void CDownloadMgrUiDownloadsList::SetStringAttributeL( const TUint /*aAttribute*/, const TDesC16& /*aValue*/ ) |
921 void CDownloadMgrUiDownloadsList::SetStringAttributeL( const TUint /*aAttribute*/, const TDesC16& /*aValue*/ ) |
916 { |
922 { |
917 User::Leave( KErrNotSupported ); |
923 User::Leave( KErrNotSupported ); |
918 } |
924 } |
919 |
925 |
920 EXPORT_C |
926 EXPORT_C |
921 void CDownloadMgrUiDownloadsList::SetStringAttributeL( const TUint /*aAttribute*/, const TDesC8& /*aValue*/ ) |
927 void CDownloadMgrUiDownloadsList::SetStringAttributeL( const TUint /*aAttribute*/, const TDesC8& /*aValue*/ ) |
922 { |
928 { |
923 User::Leave( KErrNotSupported ); |
929 User::Leave( KErrNotSupported ); |
924 } |
930 } |
925 |
931 |
926 // ----------------------------------------------------------------------------- |
932 // ----------------------------------------------------------------------------- |
927 // CDownloadMgrUiDownloadsList::AddDownloadsToListModelL |
933 // CDownloadMgrUiDownloadsList::AddDownloadsToListModelL |
928 // ----------------------------------------------------------------------------- |
934 // ----------------------------------------------------------------------------- |
929 // |
935 // |
930 void CDownloadMgrUiDownloadsList::AddDownloadsToListModelL |
936 void CDownloadMgrUiDownloadsList::AddDownloadsToListModelL |
931 ( CDownloadsListArray& aLBModel, RHttpDownloadMgr& aDownloadMgr ) |
937 ( CDownloadsListArray& aLBModel, RHttpDownloadMgr& aDownloadMgr ) |
932 { |
938 { |
933 TInt downloads = aDownloadMgr.CurrentDownloads().Count(); |
939 TInt downloads = aDownloadMgr.CurrentDownloads().Count(); |
934 for ( TInt i = 0; i < downloads; ++i ) |
940 for ( TInt i = 0; i < downloads; ++i ) |
935 { |
941 { |
936 RHttpDownload* download = |
942 RHttpDownload* download = |
937 (RHttpDownload*)(aDownloadMgr.CurrentDownloads().At(i)); |
943 (RHttpDownload*)(aDownloadMgr.CurrentDownloads().At(i)); |
938 // Extract the necessary information from 'download' and |
944 // Extract the necessary information from 'download' and |
939 // add a list box item. |
945 // add a list box item. |
940 (void)AddDownloadToListModelL( aLBModel, *download ); |
946 (void)AddDownloadToListModelL( aLBModel, *download ); |
941 } |
947 } |
942 } |
948 } |
943 |
949 |
944 // ----------------------------------------------------------------------------- |
950 // ----------------------------------------------------------------------------- |
945 // CDownloadMgrUiDownloadsList::AddDownloadToListModelL |
951 // CDownloadMgrUiDownloadsList::AddDownloadToListModelL |
946 // This is a very expensive method, so when updating list box items, |
952 // This is a very expensive method, so when updating list box items, |
947 // call the less expensive 'update' methods! |
953 // call the less expensive 'update' methods! |
948 // ----------------------------------------------------------------------------- |
954 // ----------------------------------------------------------------------------- |
949 // |
955 // |
950 TInt CDownloadMgrUiDownloadsList::AddDownloadToListModelL |
956 TInt CDownloadMgrUiDownloadsList::AddDownloadToListModelL |
951 ( CDownloadsListArray& aLBModel, RHttpDownload& aDownload ) |
957 ( CDownloadsListArray& aLBModel, RHttpDownload& aDownload ) |
959 // It is already on the list - do not add it again. |
965 // It is already on the list - do not add it again. |
960 CLOG_WRITE_FORMAT(" aDownload already on list (%d)",itemIndex); |
966 CLOG_WRITE_FORMAT(" aDownload already on list (%d)",itemIndex); |
961 } |
967 } |
962 else |
968 else |
963 { |
969 { |
964 // Do not add the download to the list if the storage |
970 // Do not add the download to the list if the storage |
965 // media is not in the device. |
971 // media is not in the device. |
966 TBool noMedia( EFalse ); |
972 TBool noMedia( EFalse ); |
967 User::LeaveIfError( aDownload.GetBoolAttribute |
973 User::LeaveIfError( aDownload.GetBoolAttribute |
968 ( EDlAttrNoMedia, noMedia ) ); |
974 ( EDlAttrNoMedia, noMedia ) ); |
969 CLOG_WRITE_FORMAT(" EDlAttrNoMedia: %d",noMedia); |
975 CLOG_WRITE_FORMAT(" EDlAttrNoMedia: %d",noMedia); |
970 // Do not add the download to the list if it is hidden |
976 // Do not add the download to the list if it is hidden |
971 TBool isHidden( EFalse ); |
977 TBool isHidden( EFalse ); |
972 User::LeaveIfError( aDownload.GetBoolAttribute |
978 User::LeaveIfError( aDownload.GetBoolAttribute |
973 ( EDlAttrHidden, isHidden ) ); |
979 ( EDlAttrHidden, isHidden ) ); |
974 CLOG_WRITE_FORMAT(" EDlAttrHidden: %d",isHidden); |
980 CLOG_WRITE_FORMAT(" EDlAttrHidden: %d",isHidden); |
975 |
981 |
976 if ( noMedia || isHidden ) |
982 if ( noMedia || isHidden ) |
977 { |
983 { |
978 // Do not add it to the list - hide it from the user. |
984 // Do not add it to the list - hide it from the user. |
979 } |
985 } |
980 else |
986 else |
1013 CLOG_WRITE_FORMAT(" EDlAttrLength err: %d",err); |
1019 CLOG_WRITE_FORMAT(" EDlAttrLength err: %d",err); |
1014 if ( err != KErrNone && err != KErrNotFound ) |
1020 if ( err != KErrNone && err != KErrNotFound ) |
1015 { |
1021 { |
1016 User::LeaveIfError( err ); |
1022 User::LeaveIfError( err ); |
1017 } |
1023 } |
1018 |
1024 |
1019 // Number of media objects in download ( inalbum)? |
1025 // Number of media objects in download ( inalbum)? |
1020 err = aDownload.GetIntAttribute |
1026 err = aDownload.GetIntAttribute |
1021 ( EDlAttrNumMediaObjects, dlData->iNumMediaObjects ); |
1027 ( EDlAttrNumMediaObjects, dlData->iNumMediaObjects ); |
1022 CLOG_WRITE_FORMAT(" EDlAttrNumMediaObjects err: %d",err); |
1028 CLOG_WRITE_FORMAT(" EDlAttrNumMediaObjects err: %d",err); |
1023 User::LeaveIfError( err ); |
1029 User::LeaveIfError( err ); |
1024 |
1030 |
1025 // Get file name |
1031 // Get file name |
1026 // In case of album - if download is complete, query album name, |
1032 // In case of album - if download is complete, query album name, |
1027 // otherwise query track name |
1033 // otherwise query track name |
1028 if ((dlData->iNumMediaObjects > 1) && |
1034 if ((dlData->iNumMediaObjects > 1) && |
1029 (EHttpDlMultipleMOCompleted == dlData->iDownloadState)) |
1035 (EHttpDlMultipleMOCompleted == dlData->iDownloadState)) |
1030 { |
1036 { |
1031 err = aDownload.GetStringAttribute |
1037 err = aDownload.GetStringAttribute |
1032 ( EDlAttrAlbumName, dlData->iName ); |
1038 ( EDlAttrAlbumName, dlData->iName ); |
1033 CLOG_WRITE_FORMAT(" EDlAttrAlbumName err: %d",err); |
1039 CLOG_WRITE_FORMAT(" EDlAttrAlbumName err: %d",err); |
1034 } |
1040 } |
1035 else |
1041 else |
1036 { |
1042 { |
1037 err = aDownload.GetStringAttribute |
1043 err = aDownload.GetStringAttribute |
1038 ( EDlAttrName, dlData->iName ); |
1044 ( EDlAttrName, dlData->iName ); |
1039 CLOG_WRITE_FORMAT(" EDlAttrName err: %d",err); |
1045 CLOG_WRITE_FORMAT(" EDlAttrName err: %d",err); |
1040 } |
1046 } |
1041 |
1047 |
1042 if ( err != KErrNone && err != KErrNotFound ) |
1048 if ( err != KErrNone && err != KErrNotFound ) |
1043 { |
1049 { |
1044 User::LeaveIfError( err ); |
1050 User::LeaveIfError( err ); |
1045 } |
1051 } |
1046 CLOG_WRITE_FORMAT(" EDlAttrName: %S",&(dlData->iName)); |
1052 CLOG_WRITE_FORMAT(" EDlAttrName: %S",&(dlData->iName)); |
1047 |
1053 |
1048 // If download name is empty, use the file name got from URI |
1054 // If download name is empty, use the file name got from URI |
1049 if ( dlData->iName.Length() == 0 ) |
1055 if ( dlData->iName.Length() == 0 ) |
1050 { |
1056 { |
1051 HBufC* url = HBufC::NewLC( KMaxUrlLength ); |
1057 HBufC* url = HBufC::NewLC( KMaxUrlLength ); |
1052 TPtr urlPtr = url->Des(); |
1058 TPtr urlPtr = url->Des(); |
1106 |
1112 |
1107 // Is the download pausable? |
1113 // Is the download pausable? |
1108 User::LeaveIfError( aDownload.GetBoolAttribute |
1114 User::LeaveIfError( aDownload.GetBoolAttribute |
1109 ( EDlAttrPausable, dlData->iPausable ) ); |
1115 ( EDlAttrPausable, dlData->iPausable ) ); |
1110 CLOG_WRITE_FORMAT(" EDlAttrPausable: %d",dlData->iPausable); |
1116 CLOG_WRITE_FORMAT(" EDlAttrPausable: %d",dlData->iPausable); |
1111 |
1117 |
1112 // Is the download on an external/removable memory (like MMC)? |
1118 // Is the download on an external/removable memory (like MMC)? |
1113 err = aDownload.GetIntAttribute |
1119 err = aDownload.GetBoolAttribute |
1114 ( EDlAttrDestRemovable, dlData->iExternalMemoryStatus ); |
1120 ( EDlAttrDestRemovable, dlData->iIsOnExternalMemory ); |
1115 CLOG_WRITE_FORMAT(" EDlAttrDestRemovable err: %d",err); |
1121 CLOG_WRITE_FORMAT(" EDlAttrDestRemovable err: %d",err); |
1116 // 'err' is ignored. |
1122 // 'err' is ignored. |
1117 CLOG_WRITE_FORMAT(" EDlAttrDestRemovable: %d",dlData->iExternalMemoryStatus); |
1123 CLOG_WRITE_FORMAT(" EDlAttrDestRemovable: %d",dlData->iIsOnExternalMemory); |
1118 |
1124 |
1119 // Currently active media object's index (in album)? |
1125 // Currently active media object's index (in album)? |
1120 err = aDownload.GetIntAttribute |
1126 err = aDownload.GetIntAttribute |
1121 ( EDlAttrActiveDownload, dlData->iActiveMoIndex ); |
1127 ( EDlAttrActiveDownload, dlData->iActiveMoIndex ); |
1122 CLOG_WRITE_FORMAT(" EDlAttrActiveDownload err: %d",err); |
1128 CLOG_WRITE_FORMAT(" EDlAttrActiveDownload err: %d",err); |
1123 User::LeaveIfError( err ); |
1129 User::LeaveIfError( err ); |
1124 |
1130 |
1125 // First add the handler app's icon to model, so that we then |
1131 // First add the handler app's icon to model, so that we then |
1126 // know the index of it that can then be set in the item text, |
1132 // know the index of it that can then be set in the item text, |
1127 // which is then also added to the model. |
1133 // which is then also added to the model. |
1128 dlData->iIconIndex = |
1134 dlData->iIconIndex = |
1129 iListModel->AddHandlerAppIconL( dlData->iContentType ); |
1135 iListModel->AddHandlerAppIconL( dlData->iContentType ); |
1130 CLOG_WRITE(" AddHandlerAppIconL OK"); |
1136 CLOG_WRITE(" AddHandlerAppIconL OK"); |
1131 |
1137 |
1132 // Add now the structure to the model: |
1138 // Add now the structure to the model: |
1133 itemIndex = aLBModel.AppendL( *dlData, aDownload ); |
1139 itemIndex = aLBModel.AppendL( *dlData, aDownload ); |
1172 iListModel->Delete( index ); |
1178 iListModel->Delete( index ); |
1173 } |
1179 } |
1174 else |
1180 else |
1175 { |
1181 { |
1176 iListModel->Delete( index ); |
1182 iListModel->Delete( index ); |
1177 |
1183 |
1178 // Update view |
1184 // Update view |
1179 if ( iExtension->IsDialogVisible() ) |
1185 if ( iExtension->IsDialogVisible() ) |
1180 { |
1186 { |
1181 iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadRemoved, index ); |
1187 iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadRemoved, index ); |
1182 CLOG_WRITE(" HandleModelChangeL OK"); |
1188 CLOG_WRITE(" HandleModelChangeL OK"); |
1183 } |
1189 } |
1184 } |
1190 } |
1185 } |
1191 } |
1186 } |
1192 } |
1187 |
1193 |
1188 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DeleteDownloadL"); |
1194 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DeleteDownloadL"); |
1189 } |
1195 } |
1190 |
1196 |
1191 // ----------------------------------------------------------------------------- |
1197 // ----------------------------------------------------------------------------- |
1192 // CDownloadMgrUiDownloadsList::DeleteDownloadL |
1198 // CDownloadMgrUiDownloadsList::DeleteDownloadL |
1193 // ----------------------------------------------------------------------------- |
1199 // ----------------------------------------------------------------------------- |
1194 // |
1200 // |
1195 TBool CDownloadMgrUiDownloadsList::IsOneProgressive() |
1201 TBool CDownloadMgrUiDownloadsList::IsOneProgressive() |
1196 { |
1202 { |
1197 TBool anyOneProgress = EFalse; |
1203 TBool anyOneProgress = EFalse; |
1198 if (iListModel == NULL) |
1204 if (iListModel == NULL) |
1199 { |
1205 { |
1200 return EFalse; |
1206 return EFalse; |
1201 } |
1207 } |
1202 else |
1208 else |
1203 { |
1209 { |
1204 TInt count = Count(); |
1210 TInt count = Count(); |
1205 for ( TInt i = 0; i < count; ++i ) |
1211 for ( TInt i = 0; i < count; ++i ) |
1206 { |
1212 { |
1207 RHttpDownload& download = iListModel->Download(i); |
1213 RHttpDownload& download = iListModel->Download(i); |
1208 TInt err = download.GetBoolAttribute( EDlAttrProgressive, anyOneProgress ); |
1214 TInt err = download.GetBoolAttribute( EDlAttrProgressive, anyOneProgress ); |
1209 // If there is a COD download and check if it is attached. Then set it as attached while resuming |
1215 // If there is a COD download and check if it is attached. Then set it as attached while resuming |
1210 TBool isCodDownload; |
1216 TBool isCodDownload; |
1211 download.GetBoolAttribute(EDlAttrCodDownload,isCodDownload); |
1217 download.GetBoolAttribute(EDlAttrCodDownload,isCodDownload); |
1212 if(isCodDownload && anyOneProgress ) |
1218 if(isCodDownload && anyOneProgress ) |
1214 download.SetBoolAttribute( EDlAttrProgressive, ETrue ); |
1220 download.SetBoolAttribute( EDlAttrProgressive, ETrue ); |
1215 } |
1221 } |
1216 THttpProgressState state; |
1222 THttpProgressState state; |
1217 if( anyOneProgress ) |
1223 if( anyOneProgress ) |
1218 { |
1224 { |
1219 download.GetIntAttribute(EDlAttrProgressState, (TInt32&)state); |
1225 download.GetIntAttribute(EDlAttrProgressState, (TInt32&)state); |
1220 if(state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged ) |
1226 if(state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged ) |
1221 { |
1227 { |
1222 anyOneProgress = 0;//once the move() has happened the progressive Download is finished |
1228 anyOneProgress = 0;//once the move() has happened the progressive Download is finished |
1223 } //and we can bring MP to foreground and start another PD |
1229 } //and we can bring MP to foreground and start another PD |
1224 } |
1230 } |
1225 CLOG_WRITE_FORMAT(" EDlAttrProgressive err: %d",err); |
1231 CLOG_WRITE_FORMAT(" EDlAttrProgressive err: %d",err); |
1226 if ( anyOneProgress ) |
1232 if ( anyOneProgress ) |
1227 return ETrue; |
1233 return ETrue; |
1228 } |
1234 } |
1229 } |
1235 } |
1230 return anyOneProgress; |
1236 return anyOneProgress; |
1231 } |
1237 } |
1232 |
1238 |
1233 |
1239 |
1234 // ----------------------------------------------------------------------------- |
1240 // ----------------------------------------------------------------------------- |
1235 // CDownloadMgrUiDownloadsList::NewDownloadCreatedL |
1241 // CDownloadMgrUiDownloadsList::NewDownloadCreatedL |
1236 // ----------------------------------------------------------------------------- |
1242 // ----------------------------------------------------------------------------- |
1237 // |
1243 // |
1238 void CDownloadMgrUiDownloadsList::NewDownloadCreatedL( RHttpDownload& aDownload ) |
1244 void CDownloadMgrUiDownloadsList::NewDownloadCreatedL( RHttpDownload& aDownload ) |
1261 } |
1267 } |
1262 else |
1268 else |
1263 { |
1269 { |
1264 // Create a local copy |
1270 // Create a local copy |
1265 TDownloadUiData dlData = *dlDataPtr; |
1271 TDownloadUiData dlData = *dlDataPtr; |
1266 |
1272 |
1267 // Track changed? We need to change icon of new track |
1273 // Track changed? We need to change icon of new track |
1268 TInt32 moIndex(0); |
1274 TInt32 moIndex(0); |
1269 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, moIndex ) ); |
1275 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, moIndex ) ); |
1270 TBool activeIndexChanged = (dlData.iActiveMoIndex != moIndex); |
1276 TBool activeIndexChanged = (dlData.iActiveMoIndex != moIndex); |
1271 |
1277 |
1272 // Update download state - this must always be done! |
1278 // Update download state - this must always be done! |
1273 dlData.iDownloadState = aEvent.iDownloadState; |
1279 dlData.iDownloadState = aEvent.iDownloadState; |
1274 dlData.iProgressState = aEvent.iProgressState; |
1280 dlData.iProgressState = aEvent.iProgressState; |
1275 dlData.iActiveMoIndex = moIndex; |
1281 dlData.iActiveMoIndex = moIndex; |
1276 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1282 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1277 // Permanent redirection changes the filename. |
1283 // Permanent redirection changes the filename. |
1278 if ( aEvent.iProgressState == EHttpProgRedirectedPermanently || |
1284 if ( aEvent.iProgressState == EHttpProgRedirectedPermanently || |
1279 aEvent.iProgressState == EHttpProgRedirectedTemporarily ) |
1285 aEvent.iProgressState == EHttpProgRedirectedTemporarily ) |
1280 { |
1286 { |
1281 CLOG_WRITE(" Redirection"); |
1287 CLOG_WRITE(" Redirection"); |
1282 } |
1288 } |
1283 else if ( aEvent.iProgressState == EHttpProgResponseHeaderReceived ) |
1289 else if ( aEvent.iProgressState == EHttpProgResponseHeaderReceived ) |
1284 { |
1290 { |
1285 // Is the download on an external/removable memory (like MMC)? |
1291 // Is the download on an external/removable memory (like MMC)? |
1286 // Return value is ignored. |
1292 aDownload.GetBoolAttribute |
1287 aDownload.GetIntAttribute( EDlAttrDestRemovable, dlData.iExternalMemoryStatus ); |
1293 ( EDlAttrDestRemovable, dlData.iIsOnExternalMemory ); |
1288 CLOG_WRITE_FORMAT(" EDlAttrDestRemovable: %d",dlData.iExternalMemoryStatus); |
1294 // Return value is ignored. |
1289 } |
1295 CLOG_WRITE_FORMAT(" EDlAttrDestRemovable: %d",dlData.iIsOnExternalMemory); |
|
1296 } |
1290 else if ( aEvent.iProgressState == EHttpProgDlNameChanged ) |
1297 else if ( aEvent.iProgressState == EHttpProgDlNameChanged ) |
1291 { |
1298 { |
1292 CLOG_WRITE(" EHttpProgDlNameChanged"); |
1299 CLOG_WRITE(" EHttpProgDlNameChanged"); |
1293 } |
1300 } |
1294 |
1301 |
1295 if (( aEvent.iProgressState == EHttpProgContentTypeChanged ) || activeIndexChanged ) |
1302 if (( aEvent.iProgressState == EHttpProgContentTypeChanged ) || activeIndexChanged ) |
1296 { |
1303 { |
1297 // Update handler application icon |
1304 // Update handler application icon |
1298 // Also update the content type, because the handler application |
1305 // Also update the content type, because the handler application |
1299 // icon depends from this. |
1306 // icon depends from this. |
1300 CLOG_WRITE_FORMAT(" EHttpProgContentTypeChanged: ActiveIndex - %d",dlData.iActiveMoIndex); |
1307 CLOG_WRITE_FORMAT(" EHttpProgContentTypeChanged: ActiveIndex - %d",dlData.iActiveMoIndex); |
1301 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue ); |
1308 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue ); |
1302 // Not pushed to cleanup stack - unnecessary. |
1309 // Not pushed to cleanup stack - unnecessary. |
1303 // There is a limit for dlData.iContentType |
1310 // There is a limit for dlData.iContentType |
1351 // Update download state - this must always be done! |
1358 // Update download state - this must always be done! |
1352 dlData.iDownloadState = aEvent.iDownloadState; |
1359 dlData.iDownloadState = aEvent.iDownloadState; |
1353 dlData.iProgressState = aEvent.iProgressState; |
1360 dlData.iProgressState = aEvent.iProgressState; |
1354 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) ); |
1361 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) ); |
1355 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1362 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1356 // Here we have to initialize the full size, if the |
1363 // Here we have to initialize the full size, if the |
1357 // content-type header arrives!! |
1364 // content-type header arrives!! |
1358 if ( aEvent.iProgressState == EHttpContentTypeReceived ) |
1365 if ( aEvent.iProgressState == EHttpContentTypeReceived ) |
1359 { |
1366 { |
1360 TInt err = aDownload.GetIntAttribute( EDlAttrLength, dlData.iFullSize ); |
1367 TInt err = aDownload.GetIntAttribute( EDlAttrLength, dlData.iFullSize ); |
1361 if ( err != KErrNone && err != KErrNotFound ) |
1368 if ( err != KErrNone && err != KErrNotFound ) |
1362 { |
1369 { |
1363 User::LeaveIfError( err ); |
1370 User::LeaveIfError( err ); |
1364 } |
1371 } |
1365 |
1372 |
1366 // Also update the content type, because the handler application |
1373 // Also update the content type, because the handler application |
1367 // icon depends from this. |
1374 // icon depends from this. |
1368 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue ); |
1375 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue ); |
1369 // Not pushed to cleanup stack - unnecessary. |
1376 // Not pushed to cleanup stack - unnecessary. |
1370 // There is a limit for dlData.iContentType |
1377 // There is a limit for dlData.iContentType |
1371 if ( contentType->Length() > KMaxContentTypeLength ) |
1378 if ( contentType->Length() > KMaxContentTypeLength ) |
1380 delete contentType; |
1387 delete contentType; |
1381 contentType = 0; |
1388 contentType = 0; |
1382 dlData.iIconIndex = iListModel->AddHandlerAppIconL( dlData.iContentType ); |
1389 dlData.iIconIndex = iListModel->AddHandlerAppIconL( dlData.iContentType ); |
1383 } |
1390 } |
1384 |
1391 |
1385 // Update downloaded size (introduced, because for non-pausable downloads |
1392 // Update downloaded size (introduced, because for non-pausable downloads |
1386 // paused command sets downloaded size back to 0 kB). |
1393 // paused command sets downloaded size back to 0 kB). |
1387 User::LeaveIfError( aDownload.GetIntAttribute |
1394 User::LeaveIfError( aDownload.GetIntAttribute |
1388 ( EDlAttrDownloadedSize, dlData.iDownloadedSize ) ); |
1395 ( EDlAttrDownloadedSize, dlData.iDownloadedSize ) ); |
1389 |
1396 |
1390 // Update the download ui data in the 'model'. |
1397 // Update the download ui data in the 'model'. |
1391 iListModel->UpdateL( index, dlData ); |
1398 iListModel->UpdateL( index, dlData ); |
1392 // Update the 'view' |
1399 // Update the 'view' |
1393 iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index ); |
1400 iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index ); |
1394 // Also need to update the middle softkey |
1401 // Also need to update the middle softkey |
1395 iExtension->DlExecuter().Dialog().HandleMiddleSoftKeyChangeL(); |
1402 iExtension->DlExecuter().Dialog().HandleMiddleSoftKeyChangeL(); |
1396 } |
1403 } |
1397 |
1404 |
1398 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DownloadPausedL"); |
1405 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DownloadPausedL"); |
1399 } |
1406 } |
1400 |
1407 |
1401 // ----------------------------------------------------------------------------- |
1408 // ----------------------------------------------------------------------------- |
1402 // CDownloadMgrUiDownloadsList::DownloadCompletedL |
1409 // CDownloadMgrUiDownloadsList::DownloadCompletedL |
1421 TDownloadUiData dlData = *dlDataPtr; |
1428 TDownloadUiData dlData = *dlDataPtr; |
1422 // Update download state - this must always be done! |
1429 // Update download state - this must always be done! |
1423 dlData.iDownloadState = aEvent.iDownloadState; |
1430 dlData.iDownloadState = aEvent.iDownloadState; |
1424 dlData.iProgressState = aEvent.iProgressState; |
1431 dlData.iProgressState = aEvent.iProgressState; |
1425 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) ); |
1432 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) ); |
1426 |
1433 |
1427 // In case of Album download, change the name to Album name |
1434 // In case of Album download, change the name to Album name |
1428 if (dlData.iNumMediaObjects > 1) |
1435 if (dlData.iNumMediaObjects > 1) |
1429 { |
1436 { |
1430 aDownload.GetStringAttribute( EDlAttrAlbumName, dlData.iName ); |
1437 aDownload.GetStringAttribute( EDlAttrAlbumName, dlData.iName ); |
1431 } |
1438 } |
1432 else if (dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged) |
1439 else if (dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged) |
1433 // Filename changed, get the updated filename |
1440 // Filename changed, get the updated filename |
1434 { |
1441 { |
1435 CLOG_WRITE(" EHttpProgDlNameChanged"); |
1442 CLOG_WRITE(" EHttpProgDlNameChanged"); |
1436 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1443 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1437 } |
1444 } |
1438 |
1445 |
1439 __ASSERT_DEBUG( aEvent.iDownloadState == EHttpDlMultipleMOCompleted, |
1446 __ASSERT_DEBUG( aEvent.iDownloadState == EHttpDlMultipleMOCompleted, |
1440 Panic( EUiLibPanDlStateNotCompleted ) ); |
1447 Panic( EUiLibPanDlStateNotCompleted ) ); |
1441 |
1448 |
1442 if( dlData.iProgressState == EHttpProgContentFileMoved || dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ) |
1449 if( dlData.iProgressState == EHttpProgContentFileMoved || dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ) |
1443 { |
1450 { |
1444 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue, KFirstMoIndex ); |
1451 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue, KFirstMoIndex ); |
1445 if ( contentType->Length() > KMaxContentTypeLength ) |
1452 if ( contentType->Length() > KMaxContentTypeLength ) |
1446 { |
1453 { |
1721 if ( aiwServiceId != KAiwCmdNone ) |
1728 if ( aiwServiceId != KAiwCmdNone ) |
1722 { |
1729 { |
1723 HandleAIWCommandL(aCommandId, currDownload); |
1730 HandleAIWCommandL(aCommandId, currDownload); |
1724 return; |
1731 return; |
1725 } |
1732 } |
1726 |
1733 |
1727 switch ( aCommandId ) |
1734 switch ( aCommandId ) |
1728 { |
1735 { |
1729 case EAknSoftkeyOpen: // handle middlesoft key |
1736 case EAknSoftkeyOpen: // handle middlesoft key |
1730 { |
1737 { |
1731 // First close the downloads list. |
1738 // First close the downloads list. |
1732 CancelDisplayingDownloadsList(); |
1739 CancelDisplayingDownloadsList(); |
1733 CLOG_WRITE(" CancelDisplayingDownloadsList OK"); |
1740 CLOG_WRITE(" CancelDisplayingDownloadsList OK"); |
1734 |
1741 |
1735 if(iProgressiveDownload) |
1742 if(iProgressiveDownload) |
1736 { |
1743 { |
1737 // check if it's pd supported |
1744 // check if it's pd supported |
1738 TBool isPdSupported = EFalse; |
1745 TBool isPdSupported = EFalse; |
1739 // Get the PD player application's UID for the download |
1746 // Get the PD player application's UID for the download |
1740 TUid pdPlayerUid = { 0 }; |
1747 TUid pdPlayerUid = { 0 }; |
1741 HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue, KFirstMoIndex ); |
1748 HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue, KFirstMoIndex ); |
1742 TDataType dataType( *contentType ); |
1749 TDataType dataType( *contentType ); |
1743 delete contentType; |
1750 delete contentType; |
1744 contentType = NULL; |
1751 contentType = NULL; |
1745 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
1752 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
1746 isPdSupported = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); |
1753 isPdSupported = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); |
1747 CleanupStack::PopAndDestroy( docHandler ); // docHandler |
1754 CleanupStack::PopAndDestroy( docHandler ); // docHandler |
1748 |
1755 |
1749 if ( isPdSupported && iUiUtils->IsNetworkPdCompatibleL() ) |
1756 if ( isPdSupported && iUiUtils->IsNetworkPdCompatibleL() ) |
1750 { |
1757 { |
1751 // Get the UI data for the current download |
1758 // Get the UI data for the current download |
1752 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
1759 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
1753 TInt32 state( dlData.iProgressState ); |
1760 TInt32 state( dlData.iProgressState ); |
1754 TBool isProgressively = ETrue; |
1761 TBool isProgressively = ETrue; |
1755 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged ) |
1762 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged ) |
1756 { |
1763 { |
1757 // this will be used to tell multimedia app that content file |
1764 // this will be used to tell multimedia app that content file |
1758 // has already been moved, and it does not need to attach |
1765 // has already been moved, and it does not need to attach |
1759 // to download - it can just read completed download from |
1766 // to download - it can just read completed download from |
1760 // filesystem. |
1767 // filesystem. |
1761 isProgressively = EFalse; |
1768 isProgressively = EFalse; |
1762 } |
1769 } |
1763 // First close the downloads list. |
1770 // First close the downloads list. |
1764 CancelDisplayingDownloadsList(); |
1771 CancelDisplayingDownloadsList(); |
1765 iUiUtils->LaunchPdAppL(currDownload, isProgressively); |
1772 iUiUtils->LaunchPdAppL(currDownload, isProgressively); |
1766 } |
1773 } |
1767 else |
1774 else |
1768 { |
1775 { |
1769 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1776 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1770 CLOG_WRITE("HandleContentL OK"); |
1777 CLOG_WRITE("HandleContentL OK"); |
1771 } |
1778 } |
1772 } |
1779 } |
1773 else |
1780 else |
1774 { |
1781 { |
1775 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1782 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1776 CLOG_WRITE("HandleContentL OK"); |
1783 CLOG_WRITE("HandleContentL OK"); |
1777 } |
1784 } |
1778 break; |
1785 break; |
1779 } |
1786 } |
1780 |
1787 |
1781 |
1788 |
1784 // First close the downloads list. |
1791 // First close the downloads list. |
1785 CancelDisplayingDownloadsList(); |
1792 CancelDisplayingDownloadsList(); |
1786 CLOG_WRITE(" CancelDisplayingDownloadsList OK"); |
1793 CLOG_WRITE(" CancelDisplayingDownloadsList OK"); |
1787 |
1794 |
1788 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1795 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1789 CLOG_WRITE("HandleContentL OK"); |
1796 CLOG_WRITE("HandleContentL OK"); |
1790 // After the termination of the handler, download is removed |
1797 // After the termination of the handler, download is removed |
1791 // from the list of downloads in NotifyHandlerExitL(). |
1798 // from the list of downloads in NotifyHandlerExitL(). |
1792 break; |
1799 break; |
1793 } |
1800 } |
1794 |
1801 |
1795 case EDownloadsListCmdPlay: |
1802 case EDownloadsListCmdPlay: |
1796 { |
1803 { |
1797 #ifdef __DMGR_PD_TESTHARNESS |
1804 #ifdef __DMGR_PD_TESTHARNESS |
1798 // First close the downloads list. |
1805 // First close the downloads list. |
1799 CancelDisplayingDownloadsList(); |
1806 CancelDisplayingDownloadsList(); |
1800 iUiUtils->TestLaunchPdAppL(currDownload); |
1807 iUiUtils->TestLaunchPdAppL(currDownload); |
1801 #else |
1808 #else |
1802 // Get the UI data for the current download |
1809 // Get the UI data for the current download |
1803 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
1810 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
1804 TInt32 state( dlData.iProgressState ); |
1811 TInt32 state( dlData.iProgressState ); |
1805 TBool isProgressively = ETrue; |
1812 TBool isProgressively = ETrue; |
1806 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged ) |
1813 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged ) |
1807 { |
1814 { |
1808 // this will be used to tell multimedia app that content file |
1815 // this will be used to tell multimedia app that content file |
1809 // has already been moved, and it does not need to attach |
1816 // has already been moved, and it does not need to attach |
1810 // to download - it can just read completed download from |
1817 // to download - it can just read completed download from |
1811 // filesystem. |
1818 // filesystem. |
1812 isProgressively = EFalse; |
1819 isProgressively = EFalse; |
1813 } |
1820 } |
1814 // First close the downloads list. |
1821 // First close the downloads list. |
1815 CancelDisplayingDownloadsList(); |
1822 CancelDisplayingDownloadsList(); |
1816 if (iUiUtils->IsNetworkPdCompatibleL() ) |
1823 if (iUiUtils->IsNetworkPdCompatibleL() ) |
1817 { |
1824 { |
1819 } |
1826 } |
1820 #endif //__DMGR_PD_TESTHARNESS |
1827 #endif //__DMGR_PD_TESTHARNESS |
1821 |
1828 |
1822 break; |
1829 break; |
1823 } |
1830 } |
1824 |
1831 |
1825 case EDownloadsListCmdSave: |
1832 case EDownloadsListCmdSave: |
1826 { |
1833 { |
1827 TBool saved = iUiUtils->SaveContentL( currDownload ); |
1834 TBool saved = iUiUtils->SaveContentL( currDownload ); |
1828 if ( saved ) |
1835 if ( saved ) |
1829 { |
1836 { |
1830 // Remove the download from the Downloads List to |
1837 // Remove the download from the Downloads List to |
1831 // avoid confusion... |
1838 // avoid confusion... |
1832 DeleteDownloadL( currDownload ); |
1839 DeleteDownloadL( currDownload ); |
1833 } |
1840 } |
1834 // The save (moving) procedure is asynchronous! |
1841 // The save (moving) procedure is asynchronous! |
1835 // CUserInteractionsEventHandler handles |
1842 // CUserInteractionsEventHandler handles |
1836 // EHttpDlCompleted/EHttpProgMovingContentFile and |
1843 // EHttpDlCompleted/EHttpProgMovingContentFile and |
1837 // EHttpDlCompleted/EHttpProgContentFileMoved. |
1844 // EHttpDlCompleted/EHttpProgContentFileMoved. |
1838 break; |
1845 break; |
1839 } |
1846 } |
1840 |
1847 |
1841 case EDownloadsListCmdDelete: |
1848 case EDownloadsListCmdDelete: |
1842 { |
1849 { |
1843 // Retrieve the full path to filename before deletion |
1850 // Retrieve the full path to filename before deletion |
1844 // this way we check if the the actuall content file was deleted or not, |
1851 // this way we check if the the actuall content file was deleted or not, |
1845 // if not, we will manually delete it |
1852 // if not, we will manually delete it |
1846 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
1853 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
1847 TPtr fileNamePtr = fileName->Des(); |
1854 TPtr fileNamePtr = fileName->Des(); |
1848 User::LeaveIfError |
1855 User::LeaveIfError |
1849 ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
1856 ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
2056 break; |
2043 break; |
2057 } |
2044 } |
2058 |
2045 |
2059 case EDownloadsListCmdGallery: |
2046 case EDownloadsListCmdGallery: |
2060 { |
2047 { |
2061 |
2048 |
2062 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
2049 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
2063 |
2050 |
2064 TVwsViewId id = TVwsViewId( |
2051 TVwsViewId id = TVwsViewId( |
2065 TUid::Uid( KMediaGalleryUID3 ), |
2052 TUid::Uid( KMediaGalleryUID3 ), |
2066 TUid::Uid( KMediaGalleryListViewUID ) ); |
2053 TUid::Uid( KMediaGalleryListViewUID ) ); |
2067 |
2054 |
2068 // By default, custom message is empty |
2055 // By default, custom message is empty |
2069 TPtrC8 customMessage( KNullDesC8 ); |
2056 TPtrC8 customMessage( KNullDesC8 ); |
2070 |
2057 |
2071 CEikonEnv::Static()->EikAppUi()->ActivateViewL( |
2058 CEikonEnv::Static()->EikAppUi()->ActivateViewL( |
2072 id, |
2059 id, |
2073 TUid::Uid( KMediaGalleryCmdMoveFocusToAllFilesTab ), |
2060 TUid::Uid( KMediaGalleryCmdMoveFocusToAllFilesTab ), |
2074 customMessage ); |
2061 customMessage ); |
2075 #endif |
2062 #endif |
2076 break; |
2063 break; |
2077 } |
2064 } |
2078 |
2065 |
2079 case EDownloadsListCmdFileManager: |
2066 case EDownloadsListCmdFileManager: |
2080 { |
2067 { |
2081 |
2068 |
2082 if ( iPlatformSupportsGallery ) |
2069 if ( iPlatformSupportsGallery ) |
2083 { |
2070 { |
2084 LaunchFileManagerApplication(); |
2071 LaunchFileManagerApplication(); |
2085 } |
2072 } |
2086 else |
2073 else |
2087 { |
2074 { |
2088 CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewL(); |
2075 CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewL(); |
2089 serviceHandler->AttachL( R_DMUL_FILEMANAGER_AIW_INTEREST ); |
2076 serviceHandler->AttachL( R_DMUL_FILEMANAGER_AIW_INTEREST ); |
2090 |
2077 |
2091 CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); |
2078 CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); |
2092 |
2079 |
2093 //get the destination file path |
2080 //get the destination file path |
2094 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
2081 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
2095 TPtr fileNamePtr = fileName->Des(); |
2082 TPtr fileNamePtr = fileName->Des(); |
2096 User::LeaveIfError ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
2083 User::LeaveIfError ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
2097 |
2084 |
2098 // Locate the last '\\' character and remove the file name so that we will get the folder name |
2085 // Locate the last '\\' character and remove the file name so that we will get the folder name |
2099 TInt len = fileNamePtr.LocateReverse('\\'); |
2086 TInt len = fileNamePtr.LocateReverse('\\'); |
2100 TPtr ptr = fileNamePtr.LeftTPtr(len + 1); |
2087 TPtr ptr = fileNamePtr.LeftTPtr(len + 1); |
2101 |
2088 |
2102 // Append the directory name to be opened |
2089 // Append the directory name to be opened |
2103 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( ptr ) ) ); |
2090 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( ptr ) ) ); |
2104 //Append the sort method |
2091 //Append the sort method |
2105 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KMostRecentSort ) ) ); |
2092 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KMostRecentSort ) ) ); |
2106 //Append to define whether to open in standalone mode |
2093 //Append to define whether to open in standalone mode |
2107 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KLauchStandAlone ) ) ); |
2094 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KLauchStandAlone ) ) ); |
2108 |
2095 |
2109 TRAPD( err, serviceHandler->ExecuteServiceCmdL( KAiwCmdEdit, *inParams, serviceHandler->OutParamListL() )); |
2096 TRAPD( err, serviceHandler->ExecuteServiceCmdL( KAiwCmdEdit, *inParams, serviceHandler->OutParamListL() )); |
2110 |
2097 |
2111 CleanupStack::PopAndDestroy( fileName ); |
2098 CleanupStack::PopAndDestroy( fileName ); |
2112 CleanupStack::PopAndDestroy( inParams ); |
2099 CleanupStack::PopAndDestroy( inParams ); |
2113 |
2100 |
2114 delete serviceHandler; |
2101 delete serviceHandler; |
2115 |
2102 |
2116 //if there is any error, open the file manager in root folder |
2103 //if there is any error, open the file manager in root folder |
2117 if (err != KErrNone) |
2104 if (err != KErrNone) |
2118 { |
2105 { |
2119 LaunchFileManagerApplication(); |
2106 LaunchFileManagerApplication(); |
2120 } |
2107 } |
2121 } |
2108 } |
2122 |
2109 |
2123 break; |
2110 break; |
2124 } |
2111 } |
2125 |
2112 |
2126 default: |
2113 default: |
2127 { |
2114 { |
2128 break; |
2115 break; |
2129 } |
2116 } |
2130 } |
2117 } |
2131 } |
2118 } |
2132 |
2119 |
2133 |
2120 |
2134 // ----------------------------------------------------------------------------- |
2121 // ----------------------------------------------------------------------------- |
2135 // CDownloadMgrUiDownloadsList::LaunchFileManagerApplication |
2122 // CDownloadMgrUiDownloadsList::LaunchFileManagerApplication |
2136 // ----------------------------------------------------------------------------- |
2123 // ----------------------------------------------------------------------------- |
2137 // |
2124 // |
2138 |
2125 |
2139 void CDownloadMgrUiDownloadsList::LaunchFileManagerApplication() |
2126 void CDownloadMgrUiDownloadsList::LaunchFileManagerApplication() |
2140 { |
2127 { |
2141 |
2128 |
2142 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
2129 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
2143 CRepository *repository=CRepository::NewL(KCRUidBrowser); |
2130 CRepository *repository=CRepository::NewL(KCRUidBrowser); |
2144 TInt fileManagerId; |
2131 TInt fileManagerId; |
2145 User::LeaveIfError(repository->Get(KFileManagerUid , fileManagerId )); |
2132 User::LeaveIfError(repository->Get(KFileManagerUid , fileManagerId )); |
2146 TUid id = TUid::Uid(fileManagerId); |
2133 TUid id = TUid::Uid(fileManagerId); |
2147 TApaTask task = taskList.FindApp( id ); |
2134 TApaTask task = taskList.FindApp( id ); |
2148 if ( task.Exists() ) |
2135 if ( task.Exists() ) |
2149 { |
2136 { |
2150 task.BringToForeground(); |
2137 task.BringToForeground(); |
2151 } |
2138 } |
2152 else |
2139 else |
2153 { |
2140 { |
2154 RApaLsSession appArcSession; |
2141 RApaLsSession appArcSession; |
2155 User::LeaveIfError( appArcSession.Connect() ); |
2142 User::LeaveIfError( appArcSession.Connect() ); |
2156 CleanupClosePushL( appArcSession ); |
2143 CleanupClosePushL( appArcSession ); |
2157 TThreadId id1; |
2144 TThreadId id1; |
2158 User::LeaveIfError( appArcSession.StartDocument( KNullDesC, id, id1 ) ); |
2145 User::LeaveIfError( appArcSession.StartDocument( KNullDesC, id, id1 ) ); |
2159 CleanupStack::PopAndDestroy( &appArcSession ); |
2146 CleanupStack::PopAndDestroy( &appArcSession ); |
2160 } |
2147 } |
2161 |
2148 |
2162 } |
2149 } |
2163 |
2150 |
2164 |
2151 |
2165 // ----------------------------------------------------------------------------- |
2152 // ----------------------------------------------------------------------------- |
2166 // CDownloadMgrUiDownloadsList::DynInitMenuPaneL |
2153 // CDownloadMgrUiDownloadsList::DynInitMenuPaneL |
2167 // ----------------------------------------------------------------------------- |
2154 // ----------------------------------------------------------------------------- |
2168 // |
2155 // |
2169 void CDownloadMgrUiDownloadsList::DynInitMenuPaneL( CDownloadsListDlg& aDialog, |
2156 void CDownloadMgrUiDownloadsList::DynInitMenuPaneL( CDownloadsListDlg& aDialog, |
2170 TInt aResourceId, |
2157 TInt aResourceId, |
2171 CEikMenuPane* aMenuPane ) |
2158 CEikMenuPane* aMenuPane ) |
2172 { |
2159 { |
2173 CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL"); |
2160 CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL"); |
2174 |
2161 |
2175 __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanNull ) ); |
2162 __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanNull ) ); |
2181 |
2168 |
2182 TInt currentItemIndex = aDialog.CurrentItemIndex(); |
2169 TInt currentItemIndex = aDialog.CurrentItemIndex(); |
2183 __ASSERT_DEBUG( 0 <= currentItemIndex, Panic( EUiLibPanDLNegItemIndex ) ); |
2170 __ASSERT_DEBUG( 0 <= currentItemIndex, Panic( EUiLibPanDLNegItemIndex ) ); |
2184 RHttpDownload& currDownload = iListModel->Download( currentItemIndex ); |
2171 RHttpDownload& currDownload = iListModel->Download( currentItemIndex ); |
2185 CLOG_WRITE_FORMAT(" currDownload: 0x%x",&currDownload); |
2172 CLOG_WRITE_FORMAT(" currDownload: 0x%x",&currDownload); |
2186 |
2173 |
2187 // Get the UI data for the current download |
2174 // Get the UI data for the current download |
2188 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
2175 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
2189 TInt32 state( dlData.iDownloadState ); |
2176 TInt32 state( dlData.iDownloadState ); |
2190 CLOG_WRITE_FORMAT(" state: %d",state); |
2177 CLOG_WRITE_FORMAT(" state: %d",state); |
2191 |
2178 |
2192 // The moved state is only a temporary state - the server |
2179 // The moved state is only a temporary state - the server |
2193 // sets the download's original state back right after it, |
2180 // sets the download's original state back right after it, |
2194 // thus we query the state again: |
2181 // thus we query the state again: |
2195 if ( state == EHttpDlMoved ) |
2182 if ( state == EHttpDlMoved ) |
2196 { |
2183 { |
2197 User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrState, state ) ); |
2184 User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrState, state ) ); |
2198 |
2185 |
2199 //Changes for the bug JERI-7P8CF2 |
2186 //Changes for the bug JERI-7P8CF2 |
2200 //Changes made in the server side to fix the video center receiving unexpected events |
2187 //Changes made in the server side to fix the video center receiving unexpected events |
2201 //Reassigning these events back to the changes done in server side |
2188 //Reassigning these events back to the changes done in server side |
2202 if( state == EHttpDlCompleted ) |
2189 if( state == EHttpDlCompleted ) |
2203 { |
2190 { |
2205 } |
2192 } |
2206 else if(state == EHttpDlFailed ) |
2193 else if(state == EHttpDlFailed ) |
2207 { |
2194 { |
2208 state = EHttpDlMultipleMOFailed; |
2195 state = EHttpDlMultipleMOFailed; |
2209 } |
2196 } |
2210 |
2197 |
2211 CLOG_WRITE_FORMAT(" state re-query: %d",state); |
2198 CLOG_WRITE_FORMAT(" state re-query: %d",state); |
2212 } |
2199 } |
2213 __ASSERT_DEBUG( state != EHttpDlMoved, Panic( EUiLibPanStateIsStillMoved ) ); |
2200 __ASSERT_DEBUG( state != EHttpDlMoved, Panic( EUiLibPanStateIsStillMoved ) ); |
2214 |
2201 |
2215 TBool wasCompleted = state == EHttpDlMultipleMOCompleted; |
2202 TBool wasCompleted = state == EHttpDlMultipleMOCompleted; |
2216 |
2203 |
2217 // Get if it's theme |
2204 // Get if it's theme |
2218 TInt isThemeType = 0; |
2205 TInt isThemeType = 0; |
2219 HBufC8* contentType = HBufC8::NewLC(KMaxContentTypeLength); |
2206 HBufC8* contentType = HBufC8::NewLC(KMaxContentTypeLength); |
2220 TPtr8 contentTypePtr = contentType->Des(); |
2207 TPtr8 contentTypePtr = contentType->Des(); |
2221 User::LeaveIfError |
2208 User::LeaveIfError |
2222 ( currDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
2209 ( currDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
2223 isThemeType = !contentType->Compare(KSisxContentType); |
2210 isThemeType = !contentType->Compare(KSisxContentType); |
2224 CleanupStack::PopAndDestroy( contentType ); |
2211 CleanupStack::PopAndDestroy( contentType ); |
2225 |
2212 |
2226 if ( aResourceId == R_DMUL_DOWNLOADSLIST_MENU ) |
2213 if ( aResourceId == R_DMUL_DOWNLOADSLIST_MENU ) |
2227 { |
2214 { |
2228 __ASSERT_DEBUG( 0<iListModel->Count(), Panic( EUiLibPanOptionsShownWhileNoDownloads ) ); |
2215 __ASSERT_DEBUG( 0<iListModel->Count(), Panic( EUiLibPanOptionsShownWhileNoDownloads ) ); |
2229 |
2216 |
2230 TBool isCreated = state == EHttpDlCreated; |
2217 TBool isCreated = state == EHttpDlCreated; |
2231 // The fix of PHAN-6KVK5R makes this line no longer necessary |
2218 // The fix of PHAN-6KVK5R makes this line no longer necessary |
2232 // TBool isInProgress = state == EHttpDlInprogress; |
2219 // TBool isInProgress = state == EHttpDlInprogress; |
2233 TBool isPaused = state == EHttpDlPaused; |
2220 TBool isPaused = state == EHttpDlPaused; |
2234 TBool isCompleted = state == EHttpDlMultipleMOCompleted; |
2221 TBool isCompleted = state == EHttpDlMultipleMOCompleted; |
2235 TBool isFailed = state == EHttpDlMultipleMOFailed; |
2222 TBool isFailed = state == EHttpDlMultipleMOFailed; |
2236 TBool isDrmDownload = EFalse; |
2223 TBool isDrmDownload = EFalse; |
2248 } |
2235 } |
2249 TBool s60Supported( EFalse ); |
2236 TBool s60Supported( EFalse ); |
2250 TBool gallerySupported( EFalse ); |
2237 TBool gallerySupported( EFalse ); |
2251 s60Supported = iUiUtils->IsContentTypeSupportedL( dlData.iContentType ); |
2238 s60Supported = iUiUtils->IsContentTypeSupportedL( dlData.iContentType ); |
2252 gallerySupported = CDownloadUtils::IsGallerySupported(dlData.iContentType); |
2239 gallerySupported = CDownloadUtils::IsGallerySupported(dlData.iContentType); |
2253 CLOG_WRITE_FORMAT(" s60Supported: %d",s60Supported); |
2240 CLOG_WRITE_FORMAT(" s60Supported: %d",s60Supported); |
2254 CLOG_WRITE_FORMAT(" gallerySupported: %d",gallerySupported); |
2241 CLOG_WRITE_FORMAT(" gallerySupported: %d",gallerySupported); |
2255 |
2242 |
2256 TBool isCodDownload( EFalse ); |
2243 TBool isCodDownload( EFalse ); |
2257 TInt err = currDownload.GetBoolAttribute( EDlAttrCodDownload, isCodDownload ); |
2244 TInt err = currDownload.GetBoolAttribute( EDlAttrCodDownload, isCodDownload ); |
2258 CLOG_WRITE_FORMAT(" EDlAttrCodDownload err: %d",err); |
2245 CLOG_WRITE_FORMAT(" EDlAttrCodDownload err: %d",err); |
2259 |
2246 |
2260 TBool isCodPdDownload( EFalse ); |
2247 TBool isCodPdDownload( EFalse ); |
2261 err = currDownload.GetBoolAttribute( EDlAttrCodPdAvailable, isCodPdDownload ); |
2248 err = currDownload.GetBoolAttribute( EDlAttrCodPdAvailable, isCodPdDownload ); |
2262 CLOG_WRITE_FORMAT(" EDlAttrCodPdAvailable err: %d",err); |
2249 CLOG_WRITE_FORMAT(" EDlAttrCodPdAvailable err: %d",err); |
2263 |
2250 |
2264 // Get if it can be handled progressively |
2251 // Get if it can be handled progressively |
2265 TBool canProgHandled = EFalse; |
2252 TBool canProgHandled = EFalse; |
2266 TUid pdPlayerUid = { 0 }; |
2253 TUid pdPlayerUid = { 0 }; |
2267 HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue ); |
2254 HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue ); |
2268 TDataType dataType( *contentType ); |
2255 TDataType dataType( *contentType ); |
2269 delete contentType; |
2256 delete contentType; |
2270 contentType = NULL; |
2257 contentType = NULL; |
2271 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
2258 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
2272 canProgHandled = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); |
2259 canProgHandled = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); |
2273 CleanupStack::PopAndDestroy( docHandler ); // docHandler |
2260 CleanupStack::PopAndDestroy( docHandler ); // docHandler |
2274 |
2261 |
2275 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF |
|
2276 //delete open file manager when download is not complete |
2262 //delete open file manager when download is not complete |
2277 if( !(isCompleted)) |
2263 if( !(isCompleted)) |
2278 { |
2264 { |
2279 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager ); |
2265 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager ); |
2280 } |
2266 } |
2281 |
2267 |
2282 // For any gallery supported download, "go to gallery" option should be displayed in the download list option when the download completes |
2268 // For any gallery supported download, "go to gallery" option should be displayed in the download list option when the download completes |
2283 |
2269 |
2284 |
2270 |
2285 if ( (!( isCompleted && s60Supported && gallerySupported ) ) || (!iPlatformSupportsGallery) ) |
2271 if ( (!( isCompleted && s60Supported && gallerySupported ) ) || (!iPlatformSupportsGallery) ) |
2286 { |
2272 { |
2287 aMenuPane->DeleteMenuItem( EDownloadsListCmdGallery ); |
2273 aMenuPane->DeleteMenuItem( EDownloadsListCmdGallery ); |
2288 } |
2274 } |
2289 |
2275 |
2290 if ( !( isCompleted && s60Supported && gallerySupported && |
2276 if ( !( isCompleted && s60Supported && gallerySupported && |
2291 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2277 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2292 { |
2278 { |
2293 aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs ); |
2279 aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs ); |
2294 } |
2280 } |
2295 |
2281 |
2296 else |
2282 else |
2297 { |
2283 { |
2298 TInt32 numMediaObjects = 0; |
2284 TInt32 numMediaObjects = 0; |
2299 User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ) ); |
2285 User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ) ); |
2300 if (numMediaObjects > KFirstMoIndex) |
2286 if (numMediaObjects > KFirstMoIndex) |
2301 { |
2287 { |
2302 aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs ); |
2288 aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs ); |
2303 } |
2289 } |
2304 } |
2290 } |
2305 |
2291 |
2306 if( iProgressiveDownload || isCompleted ) |
2292 if( iProgressiveDownload || isCompleted ) |
2307 { |
2293 { |
2308 if ( canProgHandled ) |
2294 if ( canProgHandled ) |
2309 { |
2295 { |
2310 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2296 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2311 if (isCodDownload && !isCompleted ) |
2297 if (isCodDownload && !isCompleted ) |
2312 { |
2298 { |
2313 if ( !( gallerySupported && canProgHandled && isCodPdDownload && |
2299 if ( !( gallerySupported && canProgHandled && isCodPdDownload && |
2314 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) || (isPaused || isFailed)) |
2300 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) || (isPaused || isFailed)) |
2315 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2301 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2316 } |
2302 } |
2317 else |
2303 else |
2318 { |
2304 { |
2319 if ( !( gallerySupported && canProgHandled && |
2305 if ( !( gallerySupported && canProgHandled && |
2320 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ))) || (isPaused || isFailed)) |
2306 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ))) || (isPaused || isFailed)) |
2321 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2307 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2322 } |
2308 } |
2323 } |
2309 } |
2324 else |
2310 else |
2325 { |
2311 { |
2326 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2312 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2327 |
2313 |
2328 if ( !( isCompleted && ( s60Supported ) && |
2314 if ( !( isCompleted && ( s60Supported ) && |
2329 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2315 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2330 { |
2316 { |
2331 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2317 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2332 } |
2318 } |
2333 |
2319 |
2334 //there should not be open in menu when download is not complete and file is not supported by s60 or Gallery |
2320 //there should not be open in menu when download is not complete and file is not supported by s60 or Gallery |
2335 /* else if( isCompleted && ( !s60Supported && !gallerySupported)) |
2321 /* else if( isCompleted && ( !s60Supported && !gallerySupported)) |
2336 { |
2322 { |
2337 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2323 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2338 }*/ |
2324 }*/ |
2339 } |
2325 } |
2340 } |
2326 } |
2341 |
2327 |
2342 else // if iProgressiveDownload == EFalse |
2328 else // if iProgressiveDownload == EFalse |
2343 { |
2329 { |
2344 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2330 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2345 |
2331 |
2346 if ( !( isCompleted && s60Supported && |
2332 if ( !( isCompleted && s60Supported && |
2347 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2333 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2348 { |
2334 { |
2349 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2335 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2350 } |
2336 } |
2351 |
2337 |
2352 else if( isCompleted && !s60Supported && gallerySupported) |
2338 else if( isCompleted && !s60Supported && gallerySupported) |
2353 { |
2339 { |
2354 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2340 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2355 } |
2341 } |
2356 } |
2342 } |
2357 |
2343 |
2358 // ELFG-732DK3: There is no need to have save option since it's already saved |
2344 // ELFG-732DK3: There is no need to have save option since it's already saved |
2359 aMenuPane->DeleteMenuItem( EDownloadsListCmdSave ); |
2345 aMenuPane->DeleteMenuItem( EDownloadsListCmdSave ); |
2360 |
2346 |
2361 if ( !( isCompleted ) ) |
2347 if ( !( isCompleted ) ) |
2362 { |
2348 { |
2363 aMenuPane->DeleteMenuItem( EDownloadsListCmdDelete ); |
2349 aMenuPane->DeleteMenuItem( EDownloadsListCmdDelete ); |
2364 } |
2350 } |
2365 else |
2351 else |
2375 */ |
2361 */ |
2376 if ( !( isCreated || isPaused || isFailed ) ) |
2362 if ( !( isCreated || isPaused || isFailed ) ) |
2377 { |
2363 { |
2378 aMenuPane->DeleteMenuItem( EDownloadsListCmdResume ); |
2364 aMenuPane->DeleteMenuItem( EDownloadsListCmdResume ); |
2379 } |
2365 } |
2380 // Count paused downloads. Note that Creates and Failed downloads |
2366 // Count paused downloads. Note that Creates and Failed downloads |
2381 // are also considered as Paused, and they can be resumed. |
2367 // are also considered as Paused, and they can be resumed. |
2382 TInt pausedCount = iListModel->DownloadsCount |
2368 TInt pausedCount = iListModel->DownloadsCount |
2383 ( MASKED_DL_STATE(EHttpDlCreated) | |
2369 ( MASKED_DL_STATE(EHttpDlCreated) | |
2384 MASKED_DL_STATE(EHttpDlPaused) | |
2370 MASKED_DL_STATE(EHttpDlPaused) | |
2385 MASKED_DL_STATE(EHttpDlMultipleMOFailed) ); |
2371 MASKED_DL_STATE(EHttpDlMultipleMOFailed) ); |
2386 CLOG_WRITE_FORMAT(" paused count: %d",pausedCount); |
2372 CLOG_WRITE_FORMAT(" paused count: %d",pausedCount); |
2387 // |
2373 // |
2388 if ( !( 1 < pausedCount ) ) |
2374 if ( !( 1 < pausedCount ) ) |
2389 { |
2375 { |
2390 aMenuPane->DeleteMenuItem( EDownloadsListCmdResumeAll ); |
2376 aMenuPane->DeleteMenuItem( EDownloadsListCmdResumeAll ); |
2391 } |
2377 } |
2392 |
2378 |
2393 TInt downloadCount = iListModel->DownloadsCount |
2379 TInt downloadCount = iListModel->DownloadsCount |
2394 ( MASKED_DL_STATE(EHttpDlCreated) | |
2380 ( MASKED_DL_STATE(EHttpDlCreated) | |
2395 MASKED_DL_STATE(EHttpDlInprogress)| |
2381 MASKED_DL_STATE(EHttpDlInprogress)| |
2396 MASKED_DL_STATE(EHttpDlPaused) ); |
2382 MASKED_DL_STATE(EHttpDlPaused) ); |
2397 CLOG_WRITE_FORMAT(" download count: %d",downloadCount); |
2383 CLOG_WRITE_FORMAT(" download count: %d",downloadCount); |
2398 |
2384 |
2399 if ( !( 1 < downloadCount ) ) |
2385 if ( !( 1 < downloadCount ) ) |
2400 { |
2386 { |
2401 aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll ); |
2387 aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll ); |
2402 } |
2388 } |
2403 |
2389 |
2404 if ( iPlatformSupportsGallery ) |
2390 if ( iPlatformSupportsGallery ) |
2405 { |
2391 { |
2406 if ( isCompleted && gallerySupported && s60Supported ) |
2392 if ( isCompleted && gallerySupported && s60Supported ) |
2407 { |
2393 { |
2408 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager ); |
2394 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager ); |
2409 } |
2395 } |
2410 } |
2396 } |
2411 #else |
2397 } |
2412 // Count paused downloads. Note that Creates and Failed downloads |
2398 |
2413 // are also considered as Paused, and they can be resumed. |
2399 if ( wasCompleted && !isThemeType ) |
2414 TInt pausedCount = iListModel->DownloadsCount |
2400 { |
2415 ( MASKED_DL_STATE(EHttpDlCreated) | |
2401 InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload ); |
2416 MASKED_DL_STATE(EHttpDlPaused) | |
|
2417 MASKED_DL_STATE(EHttpDlMultipleMOFailed) ); |
|
2418 CLOG_WRITE_FORMAT(" paused count: %d",pausedCount); |
|
2419 // |
|
2420 if ( !( 1 < pausedCount ) ) |
|
2421 { |
|
2422 aMenuPane->DeleteMenuItem( EDownloadsListCmdResumeAll ); |
|
2423 } |
|
2424 |
|
2425 TInt downloadCount = iListModel->DownloadsCount |
|
2426 ( MASKED_DL_STATE(EHttpDlCreated) | |
|
2427 MASKED_DL_STATE(EHttpDlInprogress)| |
|
2428 MASKED_DL_STATE(EHttpDlPaused) ); |
|
2429 CLOG_WRITE_FORMAT(" download count: %d",downloadCount); |
|
2430 |
|
2431 if ( !( 1 < downloadCount ) ) |
|
2432 { |
|
2433 aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll ); |
|
2434 } |
|
2435 #endif |
|
2436 } |
|
2437 if ( wasCompleted && !isThemeType ) |
|
2438 { |
|
2439 InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload ); |
|
2440 } |
2402 } |
2441 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL"); |
2403 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL"); |
2442 } |
2404 } |
2443 |
2405 |
2444 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
2445 void CDownloadMgrUiDownloadsList::AIWPlugInMenusL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
2446 { |
|
2447 if( !iAIWServiceHandler ) |
|
2448 { |
|
2449 AttachAIWInterestL(); |
|
2450 } |
|
2451 RHttpDownload& currDownload = iListModel->Download( 0 ); |
|
2452 InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload ); |
|
2453 } |
|
2454 #endif |
|
2455 // ----------------------------------------------------------------------------- |
2406 // ----------------------------------------------------------------------------- |
2456 // CDownloadMgrUiDownloadsList::OfferKeyEventL |
2407 // CDownloadMgrUiDownloadsList::OfferKeyEventL |
2457 // ----------------------------------------------------------------------------- |
2408 // ----------------------------------------------------------------------------- |
2458 // |
2409 // |
2459 TKeyResponse CDownloadMgrUiDownloadsList::OfferKeyEventL |
2410 TKeyResponse CDownloadMgrUiDownloadsList::OfferKeyEventL |
2561 TAiwVariant fileNameVariant( fileNamePtr ); |
2512 TAiwVariant fileNameVariant( fileNamePtr ); |
2562 TAiwGenericParam genericParamFileName( EGenericParamFile, fileNameVariant ); |
2513 TAiwGenericParam genericParamFileName( EGenericParamFile, fileNameVariant ); |
2563 aParams.AppendL( genericParamFileName ); |
2514 aParams.AppendL( genericParamFileName ); |
2564 |
2515 |
2565 HBufC* contentType = HBufC::NewLC(KMaxContentTypeLength); |
2516 HBufC* contentType = HBufC::NewLC(KMaxContentTypeLength); |
2566 TPtr contentTypePtr = contentType->Des(); |
2517 TPtr contentTypePtr = contentType->Des(); |
2567 User::LeaveIfError |
2518 User::LeaveIfError |
2568 ( aDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
2519 ( aDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
2569 fileNameVariant.Set(contentTypePtr); |
2520 fileNameVariant.Set(contentTypePtr); |
2570 TAiwGenericParam genericParamMimeType( EGenericParamMIMEType, fileNameVariant ); |
2521 TAiwGenericParam genericParamMimeType( EGenericParamMIMEType, fileNameVariant ); |
2571 aParams.AppendL( genericParamMimeType ); |
2522 aParams.AppendL( genericParamMimeType ); |
2572 CleanupStack::PopAndDestroy( contentType ); |
2523 CleanupStack::PopAndDestroy( contentType ); |
2573 CleanupStack::PopAndDestroy( fileName ); |
2524 CleanupStack::PopAndDestroy( fileName ); |
2574 |
2525 |
2575 } |
2526 } |
2576 |
2527 |
2577 // ----------------------------------------------------------------------------- |
2528 // ----------------------------------------------------------------------------- |
2578 // CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL |
2529 // CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL |
2579 // ----------------------------------------------------------------------------- |
2530 // ----------------------------------------------------------------------------- |
2580 // |
2531 // |
2581 void CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL( TInt aResourceId, |
2532 void CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL( TInt aResourceId, |
2641 TInt res = view->GotoFirstRecord(); |
2592 TInt res = view->GotoFirstRecord(); |
2642 while( res == KErrNone ) |
2593 while( res == KErrNone ) |
2643 { |
2594 { |
2644 view->ReadTextL( TPtrC(COMMDB_NAME), name ); |
2595 view->ReadTextL( TPtrC(COMMDB_NAME), name ); |
2645 view->ReadUintL( TPtrC(COMMDB_ID), id ); |
2596 view->ReadUintL( TPtrC(COMMDB_ID), id ); |
2646 |
2597 |
2647 idArray.Insert( id, 0 ); |
2598 idArray.Insert( id, 0 ); |
2648 nameArray->InsertL( 0, name ); |
2599 nameArray->InsertL( 0, name ); |
2649 |
2600 |
2650 res = view->GotoNextRecord(); |
2601 res = view->GotoNextRecord(); |
2651 RDebug::Print(_L("IAP name, id: %S, %d"), &name, id); |
2602 RDebug::Print(_L("IAP name, id: %S, %d"), &name, id); |
2652 } |
2603 } |
2653 |
2604 |
2654 CleanupStack::PopAndDestroy( view ); // view |
2605 CleanupStack::PopAndDestroy( view ); // view |
2655 CleanupStack::PopAndDestroy( TheDb ); // TheDb |
2606 CleanupStack::PopAndDestroy( TheDb ); // TheDb |
2656 |
2607 |
2657 // Create listbox and PUSH it. |
2608 // Create listbox and PUSH it. |
2658 CEikTextListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; |
2609 CEikTextListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; |
2659 CleanupStack::PushL( list ); |
2610 CleanupStack::PushL( list ); |
2660 |
2611 |
2661 // Create popup list and PUSH it. |
2612 // Create popup list and PUSH it. |
2662 CAknPopupList* popupList = CAknPopupList::NewL( |
2613 CAknPopupList* popupList = CAknPopupList::NewL( |
2663 list, R_AVKON_SOFTKEYS_OK_EMPTY__OK, |
2614 list, R_AVKON_SOFTKEYS_OK_EMPTY__OK, |
2664 AknPopupLayouts::EMenuWindow); |
2615 AknPopupLayouts::EMenuWindow); |
2665 CleanupStack::PushL( popupList ); |
2616 CleanupStack::PushL( popupList ); |
2666 |
2617 |
2667 // initialize listbox. |
2618 // initialize listbox. |
2668 list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); |
2619 list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); |
2669 list->CreateScrollBarFrameL( ETrue ); |
2620 list->CreateScrollBarFrameL( ETrue ); |
2670 list->ScrollBarFrame()->SetScrollBarVisibilityL( |
2621 list->ScrollBarFrame()->SetScrollBarVisibilityL( |
2671 CEikScrollBarFrame::EOff, |
2622 CEikScrollBarFrame::EOff, |
2672 CEikScrollBarFrame::EAuto ); |
2623 CEikScrollBarFrame::EAuto ); |
2673 |
2624 |
2674 // Set listitems. |
2625 // Set listitems. |
2675 CTextListBoxModel* model = list->Model(); |
2626 CTextListBoxModel* model = list->Model(); |
2676 model->SetItemTextArray( nameArray ); |
2627 model->SetItemTextArray( nameArray ); |
2677 model->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
2628 model->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
2678 |
2629 |
2679 // Set title |
2630 // Set title |
2680 popupList->SetTitleL( _L("Select IAP:") ); |
2631 popupList->SetTitleL( _L("Select IAP:") ); |
2681 |
2632 |
2682 // Show popup list. |
2633 // Show popup list. |
2683 TInt popupOk = popupList->ExecuteLD(); |
2634 TInt popupOk = popupList->ExecuteLD(); |
2684 CleanupStack::Pop( popupList ); // popupList |
2635 CleanupStack::Pop( popupList ); // popupList |
2685 if ( popupOk ) |
2636 if ( popupOk ) |
2686 { |
2637 { |
2687 TInt index = list->CurrentItemIndex(); |
2638 TInt index = list->CurrentItemIndex(); |
2688 aId = idArray[index]; |
2639 aId = idArray[index]; |
2689 } |
2640 } |
2690 |
2641 |
2691 CleanupStack::PopAndDestroy( 3, &idArray ); // list, nameArray, idArray |
2642 CleanupStack::PopAndDestroy( 3, &idArray ); // list, nameArray, idArray |
2692 |
2643 |
2693 return popupOk; |
2644 return popupOk; |
2694 } |
2645 } |
2695 #endif // #ifdef __WINS__ |
2646 #endif // #ifdef __WINS__ |
2696 |
2647 |
2697 /* End of file. */ |
2648 /* End of file. */ |