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 ) |
1253 __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanProgressNotVisible ) ); |
1259 __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanProgressNotVisible ) ); |
1254 // Update the download progress info at the current index. |
1260 // Update the download progress info at the current index. |
1255 // First find the current download in the model. |
1261 // First find the current download in the model. |
1256 TInt index(0); |
1262 TInt index(0); |
1257 TDownloadUiData* dlDataPtr = FindDlUiData( *iListModel, aDownload, index ); |
1263 TDownloadUiData* dlDataPtr = FindDlUiData( *iListModel, aDownload, index ); |
1258 if ( !dlDataPtr || dlDataPtr->iDownloadState == EHttpDlCompleted ) |
1264 if ( !dlDataPtr ) |
1259 { |
1265 { |
1260 /* |
1266 // do nothing |
1261 For download completed do not update any thing in UI list.Download was small and may |
|
1262 have completed before you could recieve progress notification |
|
1263 |
|
1264 do nothing |
|
1265 */ |
|
1266 } |
1267 } |
1267 else |
1268 else |
1268 { |
1269 { |
1269 // Create a local copy |
1270 // Create a local copy |
1270 TDownloadUiData dlData = *dlDataPtr; |
1271 TDownloadUiData dlData = *dlDataPtr; |
1271 |
1272 |
1272 // Track changed? We need to change icon of new track |
1273 // Track changed? We need to change icon of new track |
1273 TInt32 moIndex(0); |
1274 TInt32 moIndex(0); |
1274 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, moIndex ) ); |
1275 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, moIndex ) ); |
1275 TBool activeIndexChanged = (dlData.iActiveMoIndex != moIndex); |
1276 TBool activeIndexChanged = (dlData.iActiveMoIndex != moIndex); |
1276 |
1277 |
1277 // Update download state - this must always be done! |
1278 // Update download state - this must always be done! |
1278 dlData.iDownloadState = aEvent.iDownloadState; |
1279 dlData.iDownloadState = aEvent.iDownloadState; |
1279 dlData.iProgressState = aEvent.iProgressState; |
1280 dlData.iProgressState = aEvent.iProgressState; |
1280 dlData.iActiveMoIndex = moIndex; |
1281 dlData.iActiveMoIndex = moIndex; |
1281 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1282 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1282 // Permanent redirection changes the filename. |
1283 // Permanent redirection changes the filename. |
1283 if ( aEvent.iProgressState == EHttpProgRedirectedPermanently || |
1284 if ( aEvent.iProgressState == EHttpProgRedirectedPermanently || |
1284 aEvent.iProgressState == EHttpProgRedirectedTemporarily ) |
1285 aEvent.iProgressState == EHttpProgRedirectedTemporarily ) |
1285 { |
1286 { |
1286 CLOG_WRITE(" Redirection"); |
1287 CLOG_WRITE(" Redirection"); |
1287 } |
1288 } |
1288 else if ( aEvent.iProgressState == EHttpProgResponseHeaderReceived ) |
1289 else if ( aEvent.iProgressState == EHttpProgResponseHeaderReceived ) |
1289 { |
1290 { |
1290 // Is the download on an external/removable memory (like MMC)? |
1291 // Is the download on an external/removable memory (like MMC)? |
1291 // Return value is ignored. |
1292 aDownload.GetBoolAttribute |
1292 aDownload.GetIntAttribute( EDlAttrDestRemovable, dlData.iExternalMemoryStatus ); |
1293 ( EDlAttrDestRemovable, dlData.iIsOnExternalMemory ); |
1293 CLOG_WRITE_FORMAT(" EDlAttrDestRemovable: %d",dlData.iExternalMemoryStatus); |
1294 // Return value is ignored. |
1294 } |
1295 CLOG_WRITE_FORMAT(" EDlAttrDestRemovable: %d",dlData.iIsOnExternalMemory); |
|
1296 } |
1295 else if ( aEvent.iProgressState == EHttpProgDlNameChanged ) |
1297 else if ( aEvent.iProgressState == EHttpProgDlNameChanged ) |
1296 { |
1298 { |
1297 CLOG_WRITE(" EHttpProgDlNameChanged"); |
1299 CLOG_WRITE(" EHttpProgDlNameChanged"); |
1298 } |
1300 } |
1299 |
1301 |
1300 if (( aEvent.iProgressState == EHttpProgContentTypeChanged ) || activeIndexChanged ) |
1302 if (( aEvent.iProgressState == EHttpProgContentTypeChanged ) || activeIndexChanged ) |
1301 { |
1303 { |
1302 // Update handler application icon |
1304 // Update handler application icon |
1303 // Also update the content type, because the handler application |
1305 // Also update the content type, because the handler application |
1304 // icon depends from this. |
1306 // icon depends from this. |
1305 CLOG_WRITE_FORMAT(" EHttpProgContentTypeChanged: ActiveIndex - %d",dlData.iActiveMoIndex); |
1307 CLOG_WRITE_FORMAT(" EHttpProgContentTypeChanged: ActiveIndex - %d",dlData.iActiveMoIndex); |
1306 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue ); |
1308 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue ); |
1307 // Not pushed to cleanup stack - unnecessary. |
1309 // Not pushed to cleanup stack - unnecessary. |
1308 // There is a limit for dlData.iContentType |
1310 // There is a limit for dlData.iContentType |
1356 // Update download state - this must always be done! |
1358 // Update download state - this must always be done! |
1357 dlData.iDownloadState = aEvent.iDownloadState; |
1359 dlData.iDownloadState = aEvent.iDownloadState; |
1358 dlData.iProgressState = aEvent.iProgressState; |
1360 dlData.iProgressState = aEvent.iProgressState; |
1359 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) ); |
1361 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) ); |
1360 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1362 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1361 // Here we have to initialize the full size, if the |
1363 // Here we have to initialize the full size, if the |
1362 // content-type header arrives!! |
1364 // content-type header arrives!! |
1363 if ( aEvent.iProgressState == EHttpContentTypeReceived ) |
1365 if ( aEvent.iProgressState == EHttpContentTypeReceived ) |
1364 { |
1366 { |
1365 TInt err = aDownload.GetIntAttribute( EDlAttrLength, dlData.iFullSize ); |
1367 TInt err = aDownload.GetIntAttribute( EDlAttrLength, dlData.iFullSize ); |
1366 if ( err != KErrNone && err != KErrNotFound ) |
1368 if ( err != KErrNone && err != KErrNotFound ) |
1367 { |
1369 { |
1368 User::LeaveIfError( err ); |
1370 User::LeaveIfError( err ); |
1369 } |
1371 } |
1370 |
1372 |
1371 // Also update the content type, because the handler application |
1373 // Also update the content type, because the handler application |
1372 // icon depends from this. |
1374 // icon depends from this. |
1373 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue ); |
1375 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue ); |
1374 // Not pushed to cleanup stack - unnecessary. |
1376 // Not pushed to cleanup stack - unnecessary. |
1375 // There is a limit for dlData.iContentType |
1377 // There is a limit for dlData.iContentType |
1376 if ( contentType->Length() > KMaxContentTypeLength ) |
1378 if ( contentType->Length() > KMaxContentTypeLength ) |
1385 delete contentType; |
1387 delete contentType; |
1386 contentType = 0; |
1388 contentType = 0; |
1387 dlData.iIconIndex = iListModel->AddHandlerAppIconL( dlData.iContentType ); |
1389 dlData.iIconIndex = iListModel->AddHandlerAppIconL( dlData.iContentType ); |
1388 } |
1390 } |
1389 |
1391 |
1390 // Update downloaded size (introduced, because for non-pausable downloads |
1392 // Update downloaded size (introduced, because for non-pausable downloads |
1391 // paused command sets downloaded size back to 0 kB). |
1393 // paused command sets downloaded size back to 0 kB). |
1392 User::LeaveIfError( aDownload.GetIntAttribute |
1394 User::LeaveIfError( aDownload.GetIntAttribute |
1393 ( EDlAttrDownloadedSize, dlData.iDownloadedSize ) ); |
1395 ( EDlAttrDownloadedSize, dlData.iDownloadedSize ) ); |
1394 |
1396 |
1395 // Update the download ui data in the 'model'. |
1397 // Update the download ui data in the 'model'. |
1396 iListModel->UpdateL( index, dlData ); |
1398 iListModel->UpdateL( index, dlData ); |
1397 // Update the 'view' |
1399 // Update the 'view' |
1398 iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index ); |
1400 iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index ); |
1399 // Also need to update the middle softkey |
1401 // Also need to update the middle softkey |
1400 iExtension->DlExecuter().Dialog().HandleMiddleSoftKeyChangeL(); |
1402 iExtension->DlExecuter().Dialog().HandleMiddleSoftKeyChangeL(); |
1401 } |
1403 } |
1402 |
1404 |
1403 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DownloadPausedL"); |
1405 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DownloadPausedL"); |
1404 } |
1406 } |
1405 |
1407 |
1406 // ----------------------------------------------------------------------------- |
1408 // ----------------------------------------------------------------------------- |
1407 // CDownloadMgrUiDownloadsList::DownloadCompletedL |
1409 // CDownloadMgrUiDownloadsList::DownloadCompletedL |
1426 TDownloadUiData dlData = *dlDataPtr; |
1428 TDownloadUiData dlData = *dlDataPtr; |
1427 // Update download state - this must always be done! |
1429 // Update download state - this must always be done! |
1428 dlData.iDownloadState = aEvent.iDownloadState; |
1430 dlData.iDownloadState = aEvent.iDownloadState; |
1429 dlData.iProgressState = aEvent.iProgressState; |
1431 dlData.iProgressState = aEvent.iProgressState; |
1430 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) ); |
1432 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) ); |
1431 |
1433 |
1432 // In case of Album download, change the name to Album name |
1434 // In case of Album download, change the name to Album name |
1433 if (dlData.iNumMediaObjects > 1) |
1435 if (dlData.iNumMediaObjects > 1) |
1434 { |
1436 { |
1435 aDownload.GetStringAttribute( EDlAttrAlbumName, dlData.iName ); |
1437 aDownload.GetStringAttribute( EDlAttrAlbumName, dlData.iName ); |
1436 } |
1438 } |
1437 else if ( !(dlData.iProgressState == EHttpProgContentFileMoved) || dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged) |
1439 else if (dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged) |
1438 // Filename changed, get the updated filename |
1440 // Filename changed, get the updated filename |
1439 { |
1441 { |
1440 CLOG_WRITE(" EHttpProgDlNameChanged"); |
1442 CLOG_WRITE(" EHttpProgDlNameChanged"); |
1441 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1443 aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); |
1442 } |
1444 } |
1443 |
1445 |
1444 __ASSERT_DEBUG( aEvent.iDownloadState == EHttpDlMultipleMOCompleted, |
1446 __ASSERT_DEBUG( aEvent.iDownloadState == EHttpDlMultipleMOCompleted, |
1445 Panic( EUiLibPanDlStateNotCompleted ) ); |
1447 Panic( EUiLibPanDlStateNotCompleted ) ); |
1446 |
1448 |
1447 if( dlData.iProgressState == EHttpProgContentFileMoved || dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ) |
1449 if( dlData.iProgressState == EHttpProgContentFileMoved || dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ) |
1448 { |
1450 { |
1449 aDownload.GetIntAttribute( EDlAttrDestRemovable, dlData.iExternalMemoryStatus ); |
|
1450 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue, KFirstMoIndex ); |
1451 HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue, KFirstMoIndex ); |
1451 if ( contentType->Length() > KMaxContentTypeLength ) |
1452 if ( contentType->Length() > KMaxContentTypeLength ) |
1452 { |
1453 { |
1453 // What can we do? Use an empty mime string. |
1454 // What can we do? Use an empty mime string. |
1454 CLOG_WRITE_FORMAT(" Length overflow: %d",contentType->Length()); |
1455 CLOG_WRITE_FORMAT(" Length overflow: %d",contentType->Length()); |
1727 if ( aiwServiceId != KAiwCmdNone ) |
1728 if ( aiwServiceId != KAiwCmdNone ) |
1728 { |
1729 { |
1729 HandleAIWCommandL(aCommandId, currDownload); |
1730 HandleAIWCommandL(aCommandId, currDownload); |
1730 return; |
1731 return; |
1731 } |
1732 } |
1732 |
1733 |
1733 switch ( aCommandId ) |
1734 switch ( aCommandId ) |
1734 { |
1735 { |
1735 case EAknSoftkeyOpen: // handle middlesoft key |
1736 case EAknSoftkeyOpen: // handle middlesoft key |
1736 { |
1737 { |
1737 // First close the downloads list. |
1738 // First close the downloads list. |
1738 CancelDisplayingDownloadsList(); |
1739 CancelDisplayingDownloadsList(); |
1739 CLOG_WRITE(" CancelDisplayingDownloadsList OK"); |
1740 CLOG_WRITE(" CancelDisplayingDownloadsList OK"); |
1740 |
1741 |
1741 if(iProgressiveDownload) |
1742 if(iProgressiveDownload) |
1742 { |
1743 { |
1743 // check if it's pd supported |
1744 // check if it's pd supported |
1744 TBool isPdSupported = EFalse; |
1745 TBool isPdSupported = EFalse; |
1745 // Get the PD player application's UID for the download |
1746 // Get the PD player application's UID for the download |
1746 TUid pdPlayerUid = { 0 }; |
1747 TUid pdPlayerUid = { 0 }; |
1747 HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue, KFirstMoIndex ); |
1748 HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue, KFirstMoIndex ); |
1748 TDataType dataType( *contentType ); |
1749 TDataType dataType( *contentType ); |
1749 delete contentType; |
1750 delete contentType; |
1750 contentType = NULL; |
1751 contentType = NULL; |
1751 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
1752 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
1752 isPdSupported = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); |
1753 isPdSupported = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); |
1753 CleanupStack::PopAndDestroy( docHandler ); // docHandler |
1754 CleanupStack::PopAndDestroy( docHandler ); // docHandler |
1754 |
1755 |
1755 if ( isPdSupported && iUiUtils->IsNetworkPdCompatibleL() ) |
1756 if ( isPdSupported && iUiUtils->IsNetworkPdCompatibleL() ) |
1756 { |
1757 { |
1757 // Get the UI data for the current download |
1758 // Get the UI data for the current download |
1758 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
1759 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
1759 TInt32 state( dlData.iProgressState ); |
1760 TInt32 state( dlData.iProgressState ); |
1760 TBool isProgressively = ETrue; |
1761 TBool isProgressively = ETrue; |
1761 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged ) |
1762 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged ) |
1762 { |
1763 { |
1763 // this will be used to tell multimedia app that content file |
1764 // this will be used to tell multimedia app that content file |
1764 // has already been moved, and it does not need to attach |
1765 // has already been moved, and it does not need to attach |
1765 // to download - it can just read completed download from |
1766 // to download - it can just read completed download from |
1766 // filesystem. |
1767 // filesystem. |
1767 isProgressively = EFalse; |
1768 isProgressively = EFalse; |
1768 } |
1769 } |
1769 // First close the downloads list. |
1770 // First close the downloads list. |
1770 if ( state != EHttpProgMovingContentFile ) |
1771 CancelDisplayingDownloadsList(); |
1771 { |
1772 iUiUtils->LaunchPdAppL(currDownload, isProgressively); |
1772 CancelDisplayingDownloadsList(); |
1773 } |
1773 iUiUtils->LaunchPdAppL(currDownload, isProgressively); |
1774 else |
1774 } |
|
1775 } |
|
1776 else |
|
1777 { |
1775 { |
1778 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1776 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1779 CLOG_WRITE("HandleContentL OK"); |
1777 CLOG_WRITE("HandleContentL OK"); |
1780 } |
1778 } |
1781 } |
1779 } |
1782 else |
1780 else |
1783 { |
1781 { |
1784 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1782 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1785 CLOG_WRITE("HandleContentL OK"); |
1783 CLOG_WRITE("HandleContentL OK"); |
1786 } |
1784 } |
1787 break; |
1785 break; |
1788 } |
1786 } |
1789 |
1787 |
1790 |
1788 |
1793 // First close the downloads list. |
1791 // First close the downloads list. |
1794 CancelDisplayingDownloadsList(); |
1792 CancelDisplayingDownloadsList(); |
1795 CLOG_WRITE(" CancelDisplayingDownloadsList OK"); |
1793 CLOG_WRITE(" CancelDisplayingDownloadsList OK"); |
1796 |
1794 |
1797 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1795 iUiUtils->HandleContentL( currDownload, *iExtension ); |
1798 CLOG_WRITE("HandleContentL OK"); |
1796 CLOG_WRITE("HandleContentL OK"); |
1799 // After the termination of the handler, download is removed |
1797 // After the termination of the handler, download is removed |
1800 // from the list of downloads in NotifyHandlerExitL(). |
1798 // from the list of downloads in NotifyHandlerExitL(). |
1801 break; |
1799 break; |
1802 } |
1800 } |
1803 |
1801 |
1804 case EDownloadsListCmdPlay: |
1802 case EDownloadsListCmdPlay: |
1805 { |
1803 { |
1806 #ifdef __DMGR_PD_TESTHARNESS |
1804 #ifdef __DMGR_PD_TESTHARNESS |
1807 // First close the downloads list. |
1805 // First close the downloads list. |
1808 CancelDisplayingDownloadsList(); |
1806 CancelDisplayingDownloadsList(); |
1809 iUiUtils->TestLaunchPdAppL(currDownload); |
1807 iUiUtils->TestLaunchPdAppL(currDownload); |
1810 #else |
1808 #else |
1811 // Get the UI data for the current download |
1809 // Get the UI data for the current download |
1812 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
1810 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
1813 TInt32 state( dlData.iProgressState ); |
1811 TInt32 state( dlData.iProgressState ); |
1814 TBool isProgressively = ETrue; |
1812 TBool isProgressively = ETrue; |
1815 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged ) |
1813 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged ) |
1816 { |
1814 { |
1817 // this will be used to tell multimedia app that content file |
1815 // this will be used to tell multimedia app that content file |
1818 // has already been moved, and it does not need to attach |
1816 // has already been moved, and it does not need to attach |
1819 // to download - it can just read completed download from |
1817 // to download - it can just read completed download from |
1820 // filesystem. |
1818 // filesystem. |
1821 isProgressively = EFalse; |
1819 isProgressively = EFalse; |
1822 } |
1820 } |
1823 // First close the downloads list. |
1821 // First close the downloads list. |
1824 CancelDisplayingDownloadsList(); |
1822 CancelDisplayingDownloadsList(); |
1825 if (iUiUtils->IsNetworkPdCompatibleL() ) |
1823 if (iUiUtils->IsNetworkPdCompatibleL() ) |
1826 { |
1824 { |
1828 } |
1826 } |
1829 #endif //__DMGR_PD_TESTHARNESS |
1827 #endif //__DMGR_PD_TESTHARNESS |
1830 |
1828 |
1831 break; |
1829 break; |
1832 } |
1830 } |
1833 |
1831 |
1834 case EDownloadsListCmdSave: |
1832 case EDownloadsListCmdSave: |
1835 { |
1833 { |
1836 TBool saved = iUiUtils->SaveContentL( currDownload ); |
1834 TBool saved = iUiUtils->SaveContentL( currDownload ); |
1837 if ( saved ) |
1835 if ( saved ) |
1838 { |
1836 { |
1839 // Remove the download from the Downloads List to |
1837 // Remove the download from the Downloads List to |
1840 // avoid confusion... |
1838 // avoid confusion... |
1841 DeleteDownloadL( currDownload ); |
1839 DeleteDownloadL( currDownload ); |
1842 } |
1840 } |
1843 // The save (moving) procedure is asynchronous! |
1841 // The save (moving) procedure is asynchronous! |
1844 // CUserInteractionsEventHandler handles |
1842 // CUserInteractionsEventHandler handles |
1845 // EHttpDlCompleted/EHttpProgMovingContentFile and |
1843 // EHttpDlCompleted/EHttpProgMovingContentFile and |
1846 // EHttpDlCompleted/EHttpProgContentFileMoved. |
1844 // EHttpDlCompleted/EHttpProgContentFileMoved. |
1847 break; |
1845 break; |
1848 } |
1846 } |
1849 |
1847 |
1850 case EDownloadsListCmdDelete: |
1848 case EDownloadsListCmdDelete: |
1851 { |
1849 { |
1852 // Retrieve the full path to filename before deletion |
1850 // Retrieve the full path to filename before deletion |
1853 // 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, |
1854 // if not, we will manually delete it |
1852 // if not, we will manually delete it |
1855 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
1853 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
1856 TPtr fileNamePtr = fileName->Des(); |
1854 TPtr fileNamePtr = fileName->Des(); |
1857 User::LeaveIfError |
1855 User::LeaveIfError |
1858 ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
1856 ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
2069 break; |
2043 break; |
2070 } |
2044 } |
2071 |
2045 |
2072 case EDownloadsListCmdGallery: |
2046 case EDownloadsListCmdGallery: |
2073 { |
2047 { |
2074 |
2048 |
2075 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
2049 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
2076 |
2050 |
2077 TVwsViewId id = TVwsViewId( |
2051 TVwsViewId id = TVwsViewId( |
2078 TUid::Uid( KMediaGalleryUID3 ), |
2052 TUid::Uid( KMediaGalleryUID3 ), |
2079 TUid::Uid( KMediaGalleryListViewUID ) ); |
2053 TUid::Uid( KMediaGalleryListViewUID ) ); |
2080 |
2054 |
2081 // By default, custom message is empty |
2055 // By default, custom message is empty |
2082 TPtrC8 customMessage( KNullDesC8 ); |
2056 TPtrC8 customMessage( KNullDesC8 ); |
2083 |
2057 |
2084 CEikonEnv::Static()->EikAppUi()->ActivateViewL( |
2058 CEikonEnv::Static()->EikAppUi()->ActivateViewL( |
2085 id, |
2059 id, |
2086 TUid::Uid( KMediaGalleryCmdMoveFocusToAllFilesTab ), |
2060 TUid::Uid( KMediaGalleryCmdMoveFocusToAllFilesTab ), |
2087 customMessage ); |
2061 customMessage ); |
2088 #endif |
2062 #endif |
2089 break; |
2063 break; |
2090 } |
2064 } |
2091 |
2065 |
2092 case EDownloadsListCmdFileManager: |
2066 case EDownloadsListCmdFileManager: |
2093 { |
2067 { |
2094 |
2068 |
2095 if ( iPlatformSupportsGallery ) |
2069 if ( iPlatformSupportsGallery ) |
2096 { |
2070 { |
2097 LaunchFileManagerApplication(); |
2071 LaunchFileManagerApplication(); |
2098 } |
2072 } |
2099 else |
2073 else |
2100 { |
2074 { |
2101 CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewL(); |
2075 CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewL(); |
2102 serviceHandler->AttachL( R_DMUL_FILEMANAGER_AIW_INTEREST ); |
2076 serviceHandler->AttachL( R_DMUL_FILEMANAGER_AIW_INTEREST ); |
2103 |
2077 |
2104 CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); |
2078 CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); |
2105 |
2079 |
2106 //get the destination file path |
2080 //get the destination file path |
2107 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
2081 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
2108 TPtr fileNamePtr = fileName->Des(); |
2082 TPtr fileNamePtr = fileName->Des(); |
2109 User::LeaveIfError ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
2083 User::LeaveIfError ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
2110 |
2084 |
2111 // 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 |
2112 TInt len = fileNamePtr.LocateReverse('\\'); |
2086 TInt len = fileNamePtr.LocateReverse('\\'); |
2113 TPtr ptr = fileNamePtr.LeftTPtr(len + 1); |
2087 TPtr ptr = fileNamePtr.LeftTPtr(len + 1); |
2114 |
2088 |
2115 // Append the directory name to be opened |
2089 // Append the directory name to be opened |
2116 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( ptr ) ) ); |
2090 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( ptr ) ) ); |
2117 //Append the sort method |
2091 //Append the sort method |
2118 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KMostRecentSort ) ) ); |
2092 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KMostRecentSort ) ) ); |
2119 //Append to define whether to open in standalone mode |
2093 //Append to define whether to open in standalone mode |
2120 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KLauchStandAlone ) ) ); |
2094 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KLauchStandAlone ) ) ); |
2121 |
2095 |
2122 TRAPD( err, serviceHandler->ExecuteServiceCmdL( KAiwCmdEdit, *inParams, serviceHandler->OutParamListL() )); |
2096 TRAPD( err, serviceHandler->ExecuteServiceCmdL( KAiwCmdEdit, *inParams, serviceHandler->OutParamListL() )); |
2123 |
2097 |
2124 CleanupStack::PopAndDestroy( fileName ); |
2098 CleanupStack::PopAndDestroy( fileName ); |
2125 CleanupStack::PopAndDestroy( inParams ); |
2099 CleanupStack::PopAndDestroy( inParams ); |
2126 |
2100 |
2127 delete serviceHandler; |
2101 delete serviceHandler; |
2128 |
2102 |
2129 //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 |
2130 if (err != KErrNone) |
2104 if (err != KErrNone) |
2131 { |
2105 { |
2132 LaunchFileManagerApplication(); |
2106 LaunchFileManagerApplication(); |
2133 } |
2107 } |
2134 } |
2108 } |
2135 |
2109 |
2136 break; |
2110 break; |
2137 } |
2111 } |
2138 |
2112 |
2139 default: |
2113 default: |
2140 { |
2114 { |
2141 break; |
2115 break; |
2142 } |
2116 } |
2143 } |
2117 } |
2144 } |
2118 } |
2145 |
2119 |
2146 |
2120 |
2147 // ----------------------------------------------------------------------------- |
2121 // ----------------------------------------------------------------------------- |
2148 // CDownloadMgrUiDownloadsList::LaunchFileManagerApplication |
2122 // CDownloadMgrUiDownloadsList::LaunchFileManagerApplication |
2149 // ----------------------------------------------------------------------------- |
2123 // ----------------------------------------------------------------------------- |
2150 // |
2124 // |
2151 |
2125 |
2152 void CDownloadMgrUiDownloadsList::LaunchFileManagerApplication() |
2126 void CDownloadMgrUiDownloadsList::LaunchFileManagerApplication() |
2153 { |
2127 { |
2154 |
2128 |
2155 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
2129 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
2156 CRepository *repository=CRepository::NewL(KCRUidBrowser); |
2130 CRepository *repository=CRepository::NewL(KCRUidBrowser); |
2157 TInt fileManagerId; |
2131 TInt fileManagerId; |
2158 User::LeaveIfError(repository->Get(KFileManagerUid , fileManagerId )); |
2132 User::LeaveIfError(repository->Get(KFileManagerUid , fileManagerId )); |
2159 TUid id = TUid::Uid(fileManagerId); |
2133 TUid id = TUid::Uid(fileManagerId); |
2160 TApaTask task = taskList.FindApp( id ); |
2134 TApaTask task = taskList.FindApp( id ); |
2161 if ( task.Exists() ) |
2135 if ( task.Exists() ) |
2162 { |
2136 { |
2163 task.BringToForeground(); |
2137 task.BringToForeground(); |
2164 } |
2138 } |
2165 else |
2139 else |
2166 { |
2140 { |
2167 RApaLsSession appArcSession; |
2141 RApaLsSession appArcSession; |
2168 User::LeaveIfError( appArcSession.Connect() ); |
2142 User::LeaveIfError( appArcSession.Connect() ); |
2169 CleanupClosePushL( appArcSession ); |
2143 CleanupClosePushL( appArcSession ); |
2170 TThreadId id1; |
2144 TThreadId id1; |
2171 User::LeaveIfError( appArcSession.StartDocument( KNullDesC, id, id1 ) ); |
2145 User::LeaveIfError( appArcSession.StartDocument( KNullDesC, id, id1 ) ); |
2172 CleanupStack::PopAndDestroy( &appArcSession ); |
2146 CleanupStack::PopAndDestroy( &appArcSession ); |
2173 } |
2147 } |
2174 |
2148 |
2175 } |
2149 } |
2176 |
2150 |
2177 |
2151 |
2178 // ----------------------------------------------------------------------------- |
2152 // ----------------------------------------------------------------------------- |
2179 // CDownloadMgrUiDownloadsList::DynInitMenuPaneL |
2153 // CDownloadMgrUiDownloadsList::DynInitMenuPaneL |
2180 // ----------------------------------------------------------------------------- |
2154 // ----------------------------------------------------------------------------- |
2181 // |
2155 // |
2182 void CDownloadMgrUiDownloadsList::DynInitMenuPaneL( CDownloadsListDlg& aDialog, |
2156 void CDownloadMgrUiDownloadsList::DynInitMenuPaneL( CDownloadsListDlg& aDialog, |
2183 TInt aResourceId, |
2157 TInt aResourceId, |
2184 CEikMenuPane* aMenuPane ) |
2158 CEikMenuPane* aMenuPane ) |
2185 { |
2159 { |
2186 CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL"); |
2160 CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL"); |
2187 |
2161 |
2188 __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanNull ) ); |
2162 __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanNull ) ); |
2194 |
2168 |
2195 TInt currentItemIndex = aDialog.CurrentItemIndex(); |
2169 TInt currentItemIndex = aDialog.CurrentItemIndex(); |
2196 __ASSERT_DEBUG( 0 <= currentItemIndex, Panic( EUiLibPanDLNegItemIndex ) ); |
2170 __ASSERT_DEBUG( 0 <= currentItemIndex, Panic( EUiLibPanDLNegItemIndex ) ); |
2197 RHttpDownload& currDownload = iListModel->Download( currentItemIndex ); |
2171 RHttpDownload& currDownload = iListModel->Download( currentItemIndex ); |
2198 CLOG_WRITE_FORMAT(" currDownload: 0x%x",&currDownload); |
2172 CLOG_WRITE_FORMAT(" currDownload: 0x%x",&currDownload); |
2199 |
2173 |
2200 // Get the UI data for the current download |
2174 // Get the UI data for the current download |
2201 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
2175 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() ); |
2202 TInt32 state( dlData.iDownloadState ); |
2176 TInt32 state( dlData.iDownloadState ); |
2203 CLOG_WRITE_FORMAT(" state: %d",state); |
2177 CLOG_WRITE_FORMAT(" state: %d",state); |
2204 |
2178 |
2205 // The moved state is only a temporary state - the server |
2179 // The moved state is only a temporary state - the server |
2206 // sets the download's original state back right after it, |
2180 // sets the download's original state back right after it, |
2207 // thus we query the state again: |
2181 // thus we query the state again: |
2208 if ( state == EHttpDlMoved ) |
2182 if ( state == EHttpDlMoved ) |
2209 { |
2183 { |
2210 User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrState, state ) ); |
2184 User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrState, state ) ); |
2211 |
2185 |
2212 //Changes for the bug JERI-7P8CF2 |
2186 //Changes for the bug JERI-7P8CF2 |
2213 //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 |
2214 //Reassigning these events back to the changes done in server side |
2188 //Reassigning these events back to the changes done in server side |
2215 if( state == EHttpDlCompleted ) |
2189 if( state == EHttpDlCompleted ) |
2216 { |
2190 { |
2218 } |
2192 } |
2219 else if(state == EHttpDlFailed ) |
2193 else if(state == EHttpDlFailed ) |
2220 { |
2194 { |
2221 state = EHttpDlMultipleMOFailed; |
2195 state = EHttpDlMultipleMOFailed; |
2222 } |
2196 } |
2223 |
2197 |
2224 CLOG_WRITE_FORMAT(" state re-query: %d",state); |
2198 CLOG_WRITE_FORMAT(" state re-query: %d",state); |
2225 } |
2199 } |
2226 __ASSERT_DEBUG( state != EHttpDlMoved, Panic( EUiLibPanStateIsStillMoved ) ); |
2200 __ASSERT_DEBUG( state != EHttpDlMoved, Panic( EUiLibPanStateIsStillMoved ) ); |
2227 |
2201 |
2228 TBool wasCompleted = state == EHttpDlMultipleMOCompleted; |
2202 TBool wasCompleted = state == EHttpDlMultipleMOCompleted; |
2229 |
2203 |
2230 // Get if it's theme |
2204 // Get if it's theme |
2231 TInt isThemeType = 0; |
2205 TInt isThemeType = 0; |
2232 HBufC8* contentType = HBufC8::NewLC(KMaxContentTypeLength); |
2206 HBufC8* contentType = HBufC8::NewLC(KMaxContentTypeLength); |
2233 TPtr8 contentTypePtr = contentType->Des(); |
2207 TPtr8 contentTypePtr = contentType->Des(); |
2234 User::LeaveIfError |
2208 User::LeaveIfError |
2235 ( currDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
2209 ( currDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
2236 isThemeType = !contentType->Compare(KSisxContentType); |
2210 isThemeType = !contentType->Compare(KSisxContentType); |
2237 CleanupStack::PopAndDestroy( contentType ); |
2211 CleanupStack::PopAndDestroy( contentType ); |
2238 |
2212 |
2239 if ( aResourceId == R_DMUL_DOWNLOADSLIST_MENU ) |
2213 if ( aResourceId == R_DMUL_DOWNLOADSLIST_MENU ) |
2240 { |
2214 { |
2241 __ASSERT_DEBUG( 0<iListModel->Count(), Panic( EUiLibPanOptionsShownWhileNoDownloads ) ); |
2215 __ASSERT_DEBUG( 0<iListModel->Count(), Panic( EUiLibPanOptionsShownWhileNoDownloads ) ); |
2242 |
2216 |
2243 // The fix of PHAN-6KVK5R makes this line no longer necessary |
2217 TBool isCreated = state == EHttpDlCreated; |
|
2218 // The fix of PHAN-6KVK5R makes this line no longer necessary |
2244 // TBool isInProgress = state == EHttpDlInprogress; |
2219 // TBool isInProgress = state == EHttpDlInprogress; |
|
2220 TBool isPaused = state == EHttpDlPaused; |
2245 TBool isCompleted = state == EHttpDlMultipleMOCompleted; |
2221 TBool isCompleted = state == EHttpDlMultipleMOCompleted; |
|
2222 TBool isFailed = state == EHttpDlMultipleMOFailed; |
2246 TBool isDrmDownload = EFalse; |
2223 TBool isDrmDownload = EFalse; |
2247 TBool isDrmRightsOnPhone = EFalse; |
2224 TBool isDrmRightsOnPhone = EFalse; |
2248 TBool isPreviewRights = EFalse; |
2225 TBool isPreviewRights = EFalse; |
2249 // OMA DRM information is used only in case of completed downloads |
2226 // OMA DRM information is used only in case of completed downloads |
2250 if ( isCompleted ) |
2227 if ( isCompleted ) |
2258 } |
2235 } |
2259 TBool s60Supported( EFalse ); |
2236 TBool s60Supported( EFalse ); |
2260 TBool gallerySupported( EFalse ); |
2237 TBool gallerySupported( EFalse ); |
2261 s60Supported = iUiUtils->IsContentTypeSupportedL( dlData.iContentType ); |
2238 s60Supported = iUiUtils->IsContentTypeSupportedL( dlData.iContentType ); |
2262 gallerySupported = CDownloadUtils::IsGallerySupported(dlData.iContentType); |
2239 gallerySupported = CDownloadUtils::IsGallerySupported(dlData.iContentType); |
2263 CLOG_WRITE_FORMAT(" s60Supported: %d",s60Supported); |
2240 CLOG_WRITE_FORMAT(" s60Supported: %d",s60Supported); |
2264 CLOG_WRITE_FORMAT(" gallerySupported: %d",gallerySupported); |
2241 CLOG_WRITE_FORMAT(" gallerySupported: %d",gallerySupported); |
2265 |
2242 |
2266 TBool isCodDownload( EFalse ); |
2243 TBool isCodDownload( EFalse ); |
2267 TInt err = currDownload.GetBoolAttribute( EDlAttrCodDownload, isCodDownload ); |
2244 TInt err = currDownload.GetBoolAttribute( EDlAttrCodDownload, isCodDownload ); |
2268 CLOG_WRITE_FORMAT(" EDlAttrCodDownload err: %d",err); |
2245 CLOG_WRITE_FORMAT(" EDlAttrCodDownload err: %d",err); |
2269 |
2246 |
2270 TBool isCodPdDownload( EFalse ); |
2247 TBool isCodPdDownload( EFalse ); |
2271 err = currDownload.GetBoolAttribute( EDlAttrCodPdAvailable, isCodPdDownload ); |
2248 err = currDownload.GetBoolAttribute( EDlAttrCodPdAvailable, isCodPdDownload ); |
2272 CLOG_WRITE_FORMAT(" EDlAttrCodPdAvailable err: %d",err); |
2249 CLOG_WRITE_FORMAT(" EDlAttrCodPdAvailable err: %d",err); |
2273 |
2250 |
2274 // Get if it can be handled progressively |
2251 // Get if it can be handled progressively |
2275 TBool canProgHandled = EFalse; |
2252 TBool canProgHandled = EFalse; |
2276 TUid pdPlayerUid = { 0 }; |
2253 TUid pdPlayerUid = { 0 }; |
2277 HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue ); |
2254 HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue ); |
2278 TDataType dataType( *contentType ); |
2255 TDataType dataType( *contentType ); |
2279 delete contentType; |
2256 delete contentType; |
2280 contentType = NULL; |
2257 contentType = NULL; |
2281 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
2258 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
2282 canProgHandled = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); |
2259 canProgHandled = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); |
2283 CleanupStack::PopAndDestroy( docHandler ); // docHandler |
2260 CleanupStack::PopAndDestroy( docHandler ); // docHandler |
2284 |
2261 |
2285 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF |
|
2286 TBool isCreated = state == EHttpDlCreated; |
|
2287 TBool isPaused = state == EHttpDlPaused; |
|
2288 TBool isFailed = state == EHttpDlMultipleMOFailed; |
|
2289 //delete open file manager when download is not complete |
2262 //delete open file manager when download is not complete |
2290 if( !(isCompleted)) |
2263 if( !(isCompleted)) |
2291 { |
2264 { |
2292 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager ); |
2265 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager ); |
2293 } |
2266 } |
2294 |
2267 |
2295 // 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 |
2296 |
2269 |
2297 |
2270 |
2298 if ( (!( isCompleted && s60Supported && gallerySupported ) ) || (!iPlatformSupportsGallery) ) |
2271 if ( (!( isCompleted && s60Supported && gallerySupported ) ) || (!iPlatformSupportsGallery) ) |
2299 { |
2272 { |
2300 aMenuPane->DeleteMenuItem( EDownloadsListCmdGallery ); |
2273 aMenuPane->DeleteMenuItem( EDownloadsListCmdGallery ); |
2301 } |
2274 } |
2302 |
2275 |
2303 if ( !( isCompleted && s60Supported && gallerySupported && |
2276 if ( !( isCompleted && s60Supported && gallerySupported && |
2304 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2277 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2305 { |
2278 { |
2306 aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs ); |
2279 aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs ); |
2307 } |
2280 } |
2308 |
2281 |
2309 else |
2282 else |
2310 { |
2283 { |
2311 TInt32 numMediaObjects = 0; |
2284 TInt32 numMediaObjects = 0; |
2312 User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ) ); |
2285 User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ) ); |
2313 if (numMediaObjects > KFirstMoIndex) |
2286 if (numMediaObjects > KFirstMoIndex) |
2314 { |
2287 { |
2315 aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs ); |
2288 aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs ); |
2316 } |
2289 } |
2317 } |
2290 } |
2318 |
2291 |
2319 if( iProgressiveDownload || isCompleted ) |
2292 if( iProgressiveDownload || isCompleted ) |
2320 { |
2293 { |
2321 if ( canProgHandled ) |
2294 if ( canProgHandled ) |
2322 { |
2295 { |
2323 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2296 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2324 if (isCodDownload && !isCompleted ) |
2297 if (isCodDownload && !isCompleted ) |
2325 { |
2298 { |
2326 if ( !( gallerySupported && canProgHandled && isCodPdDownload && |
2299 if ( !( gallerySupported && canProgHandled && isCodPdDownload && |
2327 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) || (isPaused || isFailed)) |
2300 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) || (isPaused || isFailed)) |
2328 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2301 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2329 } |
2302 } |
2330 else |
2303 else |
2331 { |
2304 { |
2332 if ( !( gallerySupported && canProgHandled && |
2305 if ( !( gallerySupported && canProgHandled && |
2333 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ))) || (isPaused || isFailed)) |
2306 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ))) || (isPaused || isFailed)) |
2334 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2307 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2335 } |
2308 } |
2336 } |
2309 } |
2337 else |
2310 else |
2338 { |
2311 { |
2339 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2312 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2340 |
2313 |
2341 if ( !( isCompleted && ( s60Supported ) && |
2314 if ( !( isCompleted && ( s60Supported ) && |
2342 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2315 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2343 { |
2316 { |
2344 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2317 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2345 } |
2318 } |
2346 |
2319 |
2347 //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 |
2348 /* else if( isCompleted && ( !s60Supported && !gallerySupported)) |
2321 /* else if( isCompleted && ( !s60Supported && !gallerySupported)) |
2349 { |
2322 { |
2350 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2323 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2351 }*/ |
2324 }*/ |
2352 } |
2325 } |
2353 } |
2326 } |
2354 |
2327 |
2355 else // if iProgressiveDownload == EFalse |
2328 else // if iProgressiveDownload == EFalse |
2356 { |
2329 { |
2357 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2330 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay ); |
2358 |
2331 |
2359 if ( !( isCompleted && s60Supported && |
2332 if ( !( isCompleted && s60Supported && |
2360 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2333 ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) ) |
2361 { |
2334 { |
2362 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2335 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2363 } |
2336 } |
2364 |
2337 |
2365 else if( isCompleted && !s60Supported && gallerySupported) |
2338 else if( isCompleted && !s60Supported && gallerySupported) |
2366 { |
2339 { |
2367 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2340 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen ); |
2368 } |
2341 } |
2369 } |
2342 } |
2370 |
2343 |
2371 // 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 |
2372 aMenuPane->DeleteMenuItem( EDownloadsListCmdSave ); |
2345 aMenuPane->DeleteMenuItem( EDownloadsListCmdSave ); |
2373 |
2346 |
2374 if ( !( isCompleted ) ) |
2347 if ( !( isCompleted ) ) |
2375 { |
2348 { |
2376 aMenuPane->DeleteMenuItem( EDownloadsListCmdDelete ); |
2349 aMenuPane->DeleteMenuItem( EDownloadsListCmdDelete ); |
2377 } |
2350 } |
2378 else |
2351 else |
2388 */ |
2361 */ |
2389 if ( !( isCreated || isPaused || isFailed ) ) |
2362 if ( !( isCreated || isPaused || isFailed ) ) |
2390 { |
2363 { |
2391 aMenuPane->DeleteMenuItem( EDownloadsListCmdResume ); |
2364 aMenuPane->DeleteMenuItem( EDownloadsListCmdResume ); |
2392 } |
2365 } |
2393 // Count paused downloads. Note that Creates and Failed downloads |
2366 // Count paused downloads. Note that Creates and Failed downloads |
2394 // are also considered as Paused, and they can be resumed. |
2367 // are also considered as Paused, and they can be resumed. |
2395 TInt pausedCount = iListModel->DownloadsCount |
2368 TInt pausedCount = iListModel->DownloadsCount |
2396 ( MASKED_DL_STATE(EHttpDlCreated) | |
2369 ( MASKED_DL_STATE(EHttpDlCreated) | |
2397 MASKED_DL_STATE(EHttpDlPaused) | |
2370 MASKED_DL_STATE(EHttpDlPaused) | |
2398 MASKED_DL_STATE(EHttpDlMultipleMOFailed) ); |
2371 MASKED_DL_STATE(EHttpDlMultipleMOFailed) ); |
2399 CLOG_WRITE_FORMAT(" paused count: %d",pausedCount); |
2372 CLOG_WRITE_FORMAT(" paused count: %d",pausedCount); |
2400 // |
2373 // |
2401 if ( !( 1 < pausedCount ) ) |
2374 if ( !( 1 < pausedCount ) ) |
2402 { |
2375 { |
2403 aMenuPane->DeleteMenuItem( EDownloadsListCmdResumeAll ); |
2376 aMenuPane->DeleteMenuItem( EDownloadsListCmdResumeAll ); |
2404 } |
2377 } |
2405 |
2378 |
2406 TInt downloadCount = iListModel->DownloadsCount |
2379 TInt downloadCount = iListModel->DownloadsCount |
2407 ( MASKED_DL_STATE(EHttpDlCreated) | |
2380 ( MASKED_DL_STATE(EHttpDlCreated) | |
2408 MASKED_DL_STATE(EHttpDlInprogress)| |
2381 MASKED_DL_STATE(EHttpDlInprogress)| |
2409 MASKED_DL_STATE(EHttpDlPaused) ); |
2382 MASKED_DL_STATE(EHttpDlPaused) ); |
2410 CLOG_WRITE_FORMAT(" download count: %d",downloadCount); |
2383 CLOG_WRITE_FORMAT(" download count: %d",downloadCount); |
2411 |
2384 |
2412 if ( !( 1 < downloadCount ) ) |
2385 if ( !( 1 < downloadCount ) ) |
2413 { |
2386 { |
2414 aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll ); |
2387 aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll ); |
2415 } |
2388 } |
2416 |
2389 |
2417 if ( iPlatformSupportsGallery ) |
2390 if ( iPlatformSupportsGallery ) |
2418 { |
2391 { |
2419 if ( isCompleted && gallerySupported && s60Supported ) |
2392 if ( isCompleted && gallerySupported && s60Supported ) |
2420 { |
2393 { |
2421 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager ); |
2394 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager ); |
2422 } |
2395 } |
2423 } |
2396 } |
2424 #else |
2397 } |
2425 // Count paused downloads. Note that Creates and Failed downloads |
2398 |
2426 // are also considered as Paused, and they can be resumed. |
2399 if ( wasCompleted && !isThemeType ) |
2427 TInt pausedCount = iListModel->DownloadsCount |
2400 { |
2428 ( MASKED_DL_STATE(EHttpDlCreated) | |
2401 InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload ); |
2429 MASKED_DL_STATE(EHttpDlPaused) | |
|
2430 MASKED_DL_STATE(EHttpDlMultipleMOFailed) ); |
|
2431 CLOG_WRITE_FORMAT(" paused count: %d",pausedCount); |
|
2432 // |
|
2433 if ( !( 1 < pausedCount ) ) |
|
2434 { |
|
2435 aMenuPane->DeleteMenuItem( EDownloadsListCmdResumeAll ); |
|
2436 } |
|
2437 |
|
2438 TInt downloadCount = iListModel->DownloadsCount |
|
2439 ( MASKED_DL_STATE(EHttpDlCreated) | |
|
2440 MASKED_DL_STATE(EHttpDlInprogress)| |
|
2441 MASKED_DL_STATE(EHttpDlPaused) ); |
|
2442 CLOG_WRITE_FORMAT(" download count: %d",downloadCount); |
|
2443 |
|
2444 if ( !( 1 < downloadCount ) ) |
|
2445 { |
|
2446 aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll ); |
|
2447 } |
|
2448 #endif |
|
2449 } |
|
2450 if ( wasCompleted && !isThemeType ) |
|
2451 { |
|
2452 InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload ); |
|
2453 } |
2402 } |
2454 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL"); |
2403 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL"); |
2455 } |
2404 } |
2456 |
2405 |
2457 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
2458 void CDownloadMgrUiDownloadsList::AIWPlugInMenusL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
2459 { |
|
2460 if( !iAIWServiceHandler ) |
|
2461 { |
|
2462 AttachAIWInterestL(); |
|
2463 } |
|
2464 RHttpDownload& currDownload = iListModel->Download( 0 ); |
|
2465 InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload ); |
|
2466 } |
|
2467 #endif |
|
2468 // ----------------------------------------------------------------------------- |
2406 // ----------------------------------------------------------------------------- |
2469 // CDownloadMgrUiDownloadsList::OfferKeyEventL |
2407 // CDownloadMgrUiDownloadsList::OfferKeyEventL |
2470 // ----------------------------------------------------------------------------- |
2408 // ----------------------------------------------------------------------------- |
2471 // |
2409 // |
2472 TKeyResponse CDownloadMgrUiDownloadsList::OfferKeyEventL |
2410 TKeyResponse CDownloadMgrUiDownloadsList::OfferKeyEventL |
2547 // ---------------------------------------------------- |
2485 // ---------------------------------------------------- |
2548 // CDownloadMgrUiDownloadsList::HandleAIWCommandL(TInt aCommand, RHttpDownload& aDownload) |
2486 // CDownloadMgrUiDownloadsList::HandleAIWCommandL(TInt aCommand, RHttpDownload& aDownload) |
2549 // ---------------------------------------------------- |
2487 // ---------------------------------------------------- |
2550 // |
2488 // |
2551 void CDownloadMgrUiDownloadsList::HandleAIWCommandL(TInt aCommand, RHttpDownload& aDownload) |
2489 void CDownloadMgrUiDownloadsList::HandleAIWCommandL(TInt aCommand, RHttpDownload& aDownload) |
2552 |
2490 { |
2553 { |
2491 // The command is an AIW command |
2554 //Check if file exists |
|
2555 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
|
2556 TPtr fileNamePtr = fileName->Des(); |
|
2557 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
|
2558 if(!iUiUtils->IsDuplicateL(fileNamePtr)) |
|
2559 { |
|
2560 HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND); |
|
2561 CAknInformationNote* note = new(ELeave) CAknInformationNote(); |
|
2562 note->ExecuteLD(*infoPrompt); |
|
2563 CleanupStack::PopAndDestroy(infoPrompt); |
|
2564 CleanupStack::PopAndDestroy(fileName); |
|
2565 return; |
|
2566 } |
|
2567 CleanupStack::PopAndDestroy(fileName); |
|
2568 |
|
2569 // The command is an AIW command |
|
2570 CAiwGenericParamList& params = iAIWServiceHandler->InParamListL(); |
2492 CAiwGenericParamList& params = iAIWServiceHandler->InParamListL(); |
2571 TInt aiwOptions( 0 ); |
2493 TInt aiwOptions( 0 ); |
2572 |
2494 |
2573 ProvideInputParametersL( params, aiwOptions, aDownload ); |
2495 ProvideInputParametersL( params, aiwOptions, aDownload ); |
2574 CAiwGenericParamList& output = iAIWServiceHandler->OutParamListL(); |
2496 CAiwGenericParamList& output = iAIWServiceHandler->OutParamListL(); |
2590 TAiwVariant fileNameVariant( fileNamePtr ); |
2512 TAiwVariant fileNameVariant( fileNamePtr ); |
2591 TAiwGenericParam genericParamFileName( EGenericParamFile, fileNameVariant ); |
2513 TAiwGenericParam genericParamFileName( EGenericParamFile, fileNameVariant ); |
2592 aParams.AppendL( genericParamFileName ); |
2514 aParams.AppendL( genericParamFileName ); |
2593 |
2515 |
2594 HBufC* contentType = HBufC::NewLC(KMaxContentTypeLength); |
2516 HBufC* contentType = HBufC::NewLC(KMaxContentTypeLength); |
2595 TPtr contentTypePtr = contentType->Des(); |
2517 TPtr contentTypePtr = contentType->Des(); |
2596 User::LeaveIfError |
2518 User::LeaveIfError |
2597 ( aDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
2519 ( aDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
2598 fileNameVariant.Set(contentTypePtr); |
2520 fileNameVariant.Set(contentTypePtr); |
2599 TAiwGenericParam genericParamMimeType( EGenericParamMIMEType, fileNameVariant ); |
2521 TAiwGenericParam genericParamMimeType( EGenericParamMIMEType, fileNameVariant ); |
2600 aParams.AppendL( genericParamMimeType ); |
2522 aParams.AppendL( genericParamMimeType ); |
2601 CleanupStack::PopAndDestroy( contentType ); |
2523 CleanupStack::PopAndDestroy( contentType ); |
2602 CleanupStack::PopAndDestroy( fileName ); |
2524 CleanupStack::PopAndDestroy( fileName ); |
2603 |
2525 |
2604 } |
2526 } |
2605 |
2527 |
2606 // ----------------------------------------------------------------------------- |
2528 // ----------------------------------------------------------------------------- |
2607 // CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL |
2529 // CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL |
2608 // ----------------------------------------------------------------------------- |
2530 // ----------------------------------------------------------------------------- |
2609 // |
2531 // |
2610 void CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL( TInt aResourceId, |
2532 void CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL( TInt aResourceId, |
2670 TInt res = view->GotoFirstRecord(); |
2592 TInt res = view->GotoFirstRecord(); |
2671 while( res == KErrNone ) |
2593 while( res == KErrNone ) |
2672 { |
2594 { |
2673 view->ReadTextL( TPtrC(COMMDB_NAME), name ); |
2595 view->ReadTextL( TPtrC(COMMDB_NAME), name ); |
2674 view->ReadUintL( TPtrC(COMMDB_ID), id ); |
2596 view->ReadUintL( TPtrC(COMMDB_ID), id ); |
2675 |
2597 |
2676 idArray.Insert( id, 0 ); |
2598 idArray.Insert( id, 0 ); |
2677 nameArray->InsertL( 0, name ); |
2599 nameArray->InsertL( 0, name ); |
2678 |
2600 |
2679 res = view->GotoNextRecord(); |
2601 res = view->GotoNextRecord(); |
2680 RDebug::Print(_L("IAP name, id: %S, %d"), &name, id); |
2602 RDebug::Print(_L("IAP name, id: %S, %d"), &name, id); |
2681 } |
2603 } |
2682 |
2604 |
2683 CleanupStack::PopAndDestroy( view ); // view |
2605 CleanupStack::PopAndDestroy( view ); // view |
2684 CleanupStack::PopAndDestroy( TheDb ); // TheDb |
2606 CleanupStack::PopAndDestroy( TheDb ); // TheDb |
2685 |
2607 |
2686 // Create listbox and PUSH it. |
2608 // Create listbox and PUSH it. |
2687 CEikTextListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; |
2609 CEikTextListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; |
2688 CleanupStack::PushL( list ); |
2610 CleanupStack::PushL( list ); |
2689 |
2611 |
2690 // Create popup list and PUSH it. |
2612 // Create popup list and PUSH it. |
2691 CAknPopupList* popupList = CAknPopupList::NewL( |
2613 CAknPopupList* popupList = CAknPopupList::NewL( |
2692 list, R_AVKON_SOFTKEYS_OK_EMPTY__OK, |
2614 list, R_AVKON_SOFTKEYS_OK_EMPTY__OK, |
2693 AknPopupLayouts::EMenuWindow); |
2615 AknPopupLayouts::EMenuWindow); |
2694 CleanupStack::PushL( popupList ); |
2616 CleanupStack::PushL( popupList ); |
2695 |
2617 |
2696 // initialize listbox. |
2618 // initialize listbox. |
2697 list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); |
2619 list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); |
2698 list->CreateScrollBarFrameL( ETrue ); |
2620 list->CreateScrollBarFrameL( ETrue ); |
2699 list->ScrollBarFrame()->SetScrollBarVisibilityL( |
2621 list->ScrollBarFrame()->SetScrollBarVisibilityL( |
2700 CEikScrollBarFrame::EOff, |
2622 CEikScrollBarFrame::EOff, |
2701 CEikScrollBarFrame::EAuto ); |
2623 CEikScrollBarFrame::EAuto ); |
2702 |
2624 |
2703 // Set listitems. |
2625 // Set listitems. |
2704 CTextListBoxModel* model = list->Model(); |
2626 CTextListBoxModel* model = list->Model(); |
2705 model->SetItemTextArray( nameArray ); |
2627 model->SetItemTextArray( nameArray ); |
2706 model->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
2628 model->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
2707 |
2629 |
2708 // Set title |
2630 // Set title |
2709 popupList->SetTitleL( _L("Select IAP:") ); |
2631 popupList->SetTitleL( _L("Select IAP:") ); |
2710 |
2632 |
2711 // Show popup list. |
2633 // Show popup list. |
2712 TInt popupOk = popupList->ExecuteLD(); |
2634 TInt popupOk = popupList->ExecuteLD(); |
2713 CleanupStack::Pop( popupList ); // popupList |
2635 CleanupStack::Pop( popupList ); // popupList |
2714 if ( popupOk ) |
2636 if ( popupOk ) |
2715 { |
2637 { |
2716 TInt index = list->CurrentItemIndex(); |
2638 TInt index = list->CurrentItemIndex(); |
2717 aId = idArray[index]; |
2639 aId = idArray[index]; |
2718 } |
2640 } |
2719 |
2641 |
2720 CleanupStack::PopAndDestroy( 3, &idArray ); // list, nameArray, idArray |
2642 CleanupStack::PopAndDestroy( 3, &idArray ); // list, nameArray, idArray |
2721 |
2643 |
2722 return popupOk; |
2644 return popupOk; |
2723 } |
2645 } |
2724 #endif // #ifdef __WINS__ |
2646 #endif // #ifdef __WINS__ |
2725 |
2647 |
2726 /* End of file. */ |
2648 /* End of file. */ |
2727 |
2649 |
2728 |
|