13 * |
13 * |
14 * Description: User Interactions event handler |
14 * Description: User Interactions event handler |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 |
|
19 |
18 // INCLUDE FILES |
20 // INCLUDE FILES |
19 #include <browser_platform_variant.hrh> |
21 //#include <platform/mw/Browser_platform_variant.hrh> |
|
22 #include <Browser_platform_variant.hrh> |
20 #include "UserInteractionsEventHandler.h" |
23 #include "UserInteractionsEventHandler.h" |
21 #include "CUserInteractionsUtils.h" |
24 #include "CUserInteractionsUtils.h" |
22 #include "ProgressInfoCreator.h" |
25 #include "ProgressInfoCreator.h" |
23 #include <cdownloadmgruilibregistry.h> |
26 #include "CDownloadMgrUiLibRegistry.h" |
24 #include <cdownloadmgruidownloadslist.h> |
27 #include "CDownloadMgrUiDownloadsList.h" |
25 #include <cdownloadmgruiuserinteractions.h> |
28 #include "CDownloadMgrUiUserInteractions.h" |
26 #include "UiLibLogger.h" |
29 #include "UiLibLogger.h" |
27 #include "DMgrUiLibPanic.h" |
30 #include "DMgrUiLibPanic.h" |
28 #include <bldvariant.hrh> |
31 #include <bldvariant.hrh> |
29 #include <DownloadMgrUiLib.rsg> |
32 #include <DownloadMgrUiLib.rsg> |
30 #include <aknlists.h> |
33 #include <aknlists.h> |
31 #include <aknPopup.h> |
34 #include <aknPopup.h> |
32 #include <StringLoader.h> |
35 #include <StringLoader.h> |
33 #include <apgcli.h> |
36 #include <apgcli.h> |
34 #include <eikbtgpc.h> |
37 #include <eikbtgpc.h> |
35 #include <SysUtil.h> |
38 #include <sysutil.h> |
36 #include <exterror.h> |
39 #include <exterror.h> |
37 #include <etelpckt.h> |
40 #include <etelpckt.h> |
38 #include <AknNoteDialog.h> |
41 #include <aknnotedialog.h> |
39 #include <UriUtils.h> |
42 #include <uriutils.h> |
|
43 |
|
44 |
|
45 // following line is temporary: AVKON dependency removal |
|
46 #undef BRDO_APP_GALLERY_SUPPORTED_FF |
40 |
47 |
41 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
48 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
42 #include <MGXFileManagerFactory.h> |
49 #include <MGXFileManagerFactory.h> |
43 #include <CMGXFileManager.h> |
50 #include <CMGXFileManager.h> |
44 #endif |
51 #endif |
56 |
63 |
57 |
64 |
58 // LOCAL CONSTANTS AND MACROS |
65 // LOCAL CONSTANTS AND MACROS |
59 _LIT( KListBoxSeparator, "\t" ); |
66 _LIT( KListBoxSeparator, "\t" ); |
60 _LIT( KDownloadPath,"download"); |
67 _LIT( KDownloadPath,"download"); |
61 const TInt KMyFavApplicationUid = 0x200110D5; |
68 |
62 |
69 |
63 const TInt KDownloadConfSizeLimit = 100000; |
70 const TInt KDownloadConfSizeLimit = 100000; |
64 |
71 |
65 // ============================ MEMBER FUNCTIONS =============================== |
72 // ============================ MEMBER FUNCTIONS =============================== |
66 |
73 |
67 // ----------------------------------------------------------------------------- |
74 // ----------------------------------------------------------------------------- |
68 // CUserInteractionsEventHandler::CUserInteractionsEventHandler |
75 // CUserInteractionsEventHandler::CUserInteractionsEventHandler |
69 // ----------------------------------------------------------------------------- |
76 // ----------------------------------------------------------------------------- |
70 // |
77 // |
71 CUserInteractionsEventHandler::CUserInteractionsEventHandler |
78 CUserInteractionsEventHandler::CUserInteractionsEventHandler |
72 ( RHttpDownload& aDownload, THttpDownloadEvent aEvent, |
79 ( RHttpDownload& aDownload, THttpDownloadEvent aEvent, |
73 MDownloadMgrUiLibRegModel& aRegistryModel, |
80 MDownloadMgrUiLibRegModel& aRegistryModel, |
74 CAsyncEventHandlerArray& aOwner, |
81 CAsyncEventHandlerArray& aOwner, |
75 CUserInteractionsUtils& aUiUtils ) |
82 CUserInteractionsUtils& aUiUtils ) |
76 : CAsyncEventHandlerBase( aDownload, aEvent, aRegistryModel, aOwner ), |
83 : CAsyncEventHandlerBase( aDownload, aEvent, aRegistryModel, aOwner ), |
77 iUiUtils( aUiUtils ), |
84 iUiUtils( aUiUtils ), |
78 iDownloadConfirmationShown( EFalse ) |
85 iDownloadConfirmationShown( EFalse ) |
161 TRAP_IGNORE( isSpaceBelowCL = SysUtil::DiskSpaceBelowCriticalLevelL( |
168 TRAP_IGNORE( isSpaceBelowCL = SysUtil::DiskSpaceBelowCriticalLevelL( |
162 &fs, |
169 &fs, |
163 bytesToWrite, |
170 bytesToWrite, |
164 selectedDrive ) ); |
171 selectedDrive ) ); |
165 |
172 |
166 // If there is error, then isSpaceBelowCL is untouched and |
173 // If there is error, then isSpaceBelowCL is untouched and |
167 // contains the right value. Otherwise it also contains |
174 // contains the right value. Otherwise it also contains |
168 // the right value. |
175 // the right value. |
169 CLOG_WRITE_FORMAT(" DiskSpace: isSpaceBelowCL: %d",isSpaceBelowCL); |
176 CLOG_WRITE_FORMAT(" DiskSpace: isSpaceBelowCL: %d",isSpaceBelowCL); |
170 |
177 |
171 #else |
178 #else |
172 isSpaceBelowCL = SysUtil::DiskSpaceBelowCriticalLevelL( &fs, |
179 isSpaceBelowCL = SysUtil::DiskSpaceBelowCriticalLevelL( &fs, |
173 bytesToWrite, |
180 bytesToWrite, |
174 EDriveC ); |
181 EDriveC ); |
175 CLOG_WRITE_FORMAT(" C: isSpaceBelowCL: %d",isSpaceBelowCL); |
182 CLOG_WRITE_FORMAT(" C: isSpaceBelowCL: %d",isSpaceBelowCL); |
176 |
183 |
177 if ( isSpaceBelowCL ) |
184 if ( isSpaceBelowCL ) |
178 { |
185 { |
179 // Check MMC |
186 // Check MMC |
180 TRAP_IGNORE( isSpaceBelowCL = |
187 TRAP_IGNORE( isSpaceBelowCL = |
181 SysUtil::MMCSpaceBelowCriticalLevelL( &fs, bytesToWrite ) ); |
188 SysUtil::MMCSpaceBelowCriticalLevelL( &fs, bytesToWrite ) ); |
182 // If there is error, then isSpaceBelowCL is untouched and |
189 // If there is error, then isSpaceBelowCL is untouched and |
183 // contains the right value. Otherwise it also contains |
190 // contains the right value. Otherwise it also contains |
184 // the right value. |
191 // the right value. |
185 CLOG_WRITE_FORMAT(" MMC: isSpaceBelowCL: %d",isSpaceBelowCL); |
192 CLOG_WRITE_FORMAT(" MMC: isSpaceBelowCL: %d",isSpaceBelowCL); |
186 } |
193 } |
187 #endif |
194 #endif |
188 |
195 |
220 */ |
227 */ |
221 |
228 |
222 User::LeaveIfError( aDownload.GetIntAttribute |
229 User::LeaveIfError( aDownload.GetIntAttribute |
223 ( EDlAttrMultipleMOLength, totalLength ) ); |
230 ( EDlAttrMultipleMOLength, totalLength ) ); |
224 CLOG_WRITE_FORMAT(" EDlAttrMultipleMOLength: %d",totalLength); |
231 CLOG_WRITE_FORMAT(" EDlAttrMultipleMOLength: %d",totalLength); |
225 |
232 |
226 User::LeaveIfError( aDownload.GetIntAttribute |
233 User::LeaveIfError( aDownload.GetIntAttribute |
227 ( EDlAttrMultipleMODownloadedSize, downloadedSize ) ); |
234 ( EDlAttrMultipleMODownloadedSize, downloadedSize ) ); |
228 CLOG_WRITE_FORMAT(" EDlAttrMultipleMODownloadedSizes: %d",downloadedSize); |
235 CLOG_WRITE_FORMAT(" EDlAttrMultipleMODownloadedSizes: %d",downloadedSize); |
229 |
236 |
230 HBufC8* contentType = iUiUtils.ContentTypeL( aDownload, ETrue ); |
237 HBufC8* contentType = iUiUtils.ContentTypeL( aDownload, ETrue ); |
231 CleanupStack::PushL( contentType ); |
238 CleanupStack::PushL( contentType ); |
232 |
239 |
233 // Don't show the confirmation query if the downloading |
240 // Don't show the confirmation query if the downloading |
234 // already finished |
241 // already finished |
235 if ( downloadedSize == totalLength ) |
242 if ( downloadedSize == totalLength ) |
236 { |
243 { |
237 ret = ETrue; |
244 ret = ETrue; |
238 } |
245 } |
239 else if ( 0 <= totalLength && totalLength < KDownloadConfSizeLimit ) |
246 else if ( 0 <= totalLength && totalLength < KDownloadConfSizeLimit ) |
240 { |
247 { |
241 ret = ETrue; |
248 ret = ETrue; |
242 } |
249 } |
243 // GGUO-775RXR for widgets we don't need to have download confirmation either |
250 // GGUO-775RXR for widgets we don't need to have download confirmation either |
244 else if ( contentType->Compare( KWidgetMimeType) == 0 ) |
251 else if ( contentType->Compare( KWidgetMimeType) == 0 ) |
245 { |
252 { |
246 ret = ETrue; |
253 ret = ETrue; |
247 } |
254 } |
248 else |
255 else |
249 { |
256 { |
250 // For mimetype that download confirmation dialog should not be shown |
257 ret = ShowDownloadConfirmationL( aDownload, aCbaResource ); |
251 TUid pdPlayerUid = { 0 }; |
258 } |
252 TDataType dataType ( *contentType ); |
259 CleanupStack::PopAndDestroy( contentType ); |
253 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
|
254 TBool pdSupported = docHandler->CanHandleProgressivelyL( dataType , pdPlayerUid ); |
|
255 CleanupStack::PopAndDestroy ( docHandler ); |
|
256 if ( pdPlayerUid == KMyFavApplicationUid) |
|
257 { |
|
258 ret = ETrue; |
|
259 } |
|
260 else |
|
261 { |
|
262 ret = ShowDownloadConfirmationL( aDownload, aCbaResource ); |
|
263 } |
|
264 } |
|
265 CleanupStack::PopAndDestroy( contentType ); |
|
266 } |
260 } |
267 |
261 |
268 CLOG_LEAVEFN("CUserInteractionsEventHandler::ShowDownloadConfirmationL aForce"); |
262 CLOG_LEAVEFN("CUserInteractionsEventHandler::ShowDownloadConfirmationL aForce"); |
269 return ret; |
263 return ret; |
270 } |
264 } |
271 // ----------------------------------------------------------------------------- |
265 // ----------------------------------------------------------------------------- |
272 // CUserInteractionsEventHandler::ShowDownloadConfirmationL |
266 // CUserInteractionsEventHandler::ShowDownloadConfirmationL |
273 // ----------------------------------------------------------------------------- |
267 // ----------------------------------------------------------------------------- |
274 // |
268 // |
275 // Cod we used the following order |
269 // Cod we used the following order |
276 // name/size/type/price(optional)/description(no)/vendor(no) |
270 // name/size/type/price(optional)/description(no)/vendor(no) |
277 |
271 |
278 TBool CUserInteractionsEventHandler::ShowDownloadConfirmationL |
272 TBool CUserInteractionsEventHandler::ShowDownloadConfirmationL |
279 ( RHttpDownload& aDownload, TInt aCbaResource ) |
273 ( RHttpDownload& aDownload, TInt aCbaResource ) |
280 { |
274 { |
281 CLOG_ENTERFN("CUserInteractionsEventHandler::ShowDownloadConfirmationL"); |
275 CLOG_ENTERFN("CUserInteractionsEventHandler::ShowDownloadConfirmationL"); |
297 listBox->ScrollBarFrame()->SetScrollBarVisibilityL |
291 listBox->ScrollBarFrame()->SetScrollBarVisibilityL |
298 ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
292 ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
299 |
293 |
300 MDesCArray* itemList = listBox->Model()->ItemTextArray(); |
294 MDesCArray* itemList = listBox->Model()->ItemTextArray(); |
301 CDesCArray* itemArray = (CDesCArray*)itemList; |
295 CDesCArray* itemArray = (CDesCArray*)itemList; |
302 |
296 |
303 //------------------------------------------- |
297 //------------------------------------------- |
304 // Header |
298 // Header |
305 // |
299 // |
306 HBufC* header = StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_TITLE ); //"Download" |
300 HBufC* header = StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_TITLE ); //"Download" |
307 popupList->SetTitleL( *header ); |
301 popupList->SetTitleL( *header ); |
326 #else |
320 #else |
327 if ( DiskSpaceBelowCriticalLevelL( (TInt)contentSize ) ) |
321 if ( DiskSpaceBelowCriticalLevelL( (TInt)contentSize ) ) |
328 #endif |
322 #endif |
329 { |
323 { |
330 // Not enough free disk space! |
324 // Not enough free disk space! |
331 HBufC* notEnoughSpace = |
325 HBufC* notEnoughSpace = |
332 StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_NOT_ENOUGH_MEM ); |
326 StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_NOT_ENOUGH_MEM ); |
333 itemArray->AppendL( *notEnoughSpace ); |
327 itemArray->AppendL( *notEnoughSpace ); |
334 CleanupStack::PopAndDestroy( notEnoughSpace ); // notEnoughSpace |
328 CleanupStack::PopAndDestroy( notEnoughSpace ); // notEnoughSpace |
335 // and disable OK button |
329 // and disable OK button |
336 popupList->ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOk, EFalse ); |
330 popupList->ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOk, EFalse ); |
337 } |
331 } |
339 //------------------------------------------- |
333 //------------------------------------------- |
340 // Supported? no need - this was confirmed earlier |
334 // Supported? no need - this was confirmed earlier |
341 // |
335 // |
342 |
336 |
343 //------------------------------------------- |
337 //------------------------------------------- |
344 // Add name here |
338 // Add name here |
345 // name/size/type/price(optional)/description(no)/vendor(no) |
339 // name/size/type/price(optional)/description(no)/vendor(no) |
346 HBufC* nameHeader = StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_NAME ); |
340 HBufC* nameHeader = StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_NAME ); |
347 HBufC* dlName = HBufC::NewLC( KMaxPath ); |
341 HBufC* dlName = HBufC::NewLC( KMaxPath ); |
348 TPtr dlNamePtr = dlName->Des(); |
342 TPtr dlNamePtr = dlName->Des(); |
349 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrName, dlNamePtr ) ); |
343 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrName, dlNamePtr ) ); |
350 |
344 |
351 itemText = FormatListBoxItemLC( *nameHeader, *dlName ); |
345 itemText = FormatListBoxItemLC( *nameHeader, *dlName ); |
352 itemArray->AppendL( *itemText ); |
346 itemArray->AppendL( *itemText ); |
353 CleanupStack::PopAndDestroy( 3, nameHeader ); // itemText, sizeHeader |
347 CleanupStack::PopAndDestroy( 3, nameHeader ); // itemText, sizeHeader |
354 dlName = NULL; |
348 dlName = NULL; |
355 itemText = NULL; |
349 itemText = NULL; |
356 nameHeader = NULL; |
350 nameHeader = NULL; |
357 |
351 |
358 //------------------------------------------- |
352 //------------------------------------------- |
359 // Content Size |
353 // Content Size |
379 itemText = NULL; |
373 itemText = NULL; |
380 sizeHeader = NULL; |
374 sizeHeader = NULL; |
381 |
375 |
382 //------------------------------------------- |
376 //------------------------------------------- |
383 // Application Name - only show if Supported |
377 // Application Name - only show if Supported |
384 // |
378 // |
385 HBufC* handlerHeader = StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_OPENWITH ); |
379 HBufC* handlerHeader = StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_OPENWITH ); |
386 |
380 |
387 RApaLsSession apaLs; |
381 RApaLsSession apaLs; |
388 User::LeaveIfError( apaLs.Connect() ); |
382 User::LeaveIfError( apaLs.Connect() ); |
389 CleanupClosePushL( apaLs ); |
383 CleanupClosePushL( apaLs ); |
390 TUid appUid; |
384 TUid appUid; |
391 HBufC8* contentType = iUiUtils.ContentTypeL( aDownload, ETrue ); |
385 HBufC8* contentType = iUiUtils.ContentTypeL( aDownload, ETrue ); |
392 CleanupStack::PushL( contentType ); |
386 CleanupStack::PushL( contentType ); |
393 |
387 |
394 #ifdef _DEBUG |
388 #ifdef _DEBUG |
395 HBufC* contType = HBufC::NewL( contentType->Length() ); |
389 HBufC* contType = HBufC::NewL( contentType->Length() ); |
396 TPtr ptr = contType->Des(); |
390 TPtr ptr = contType->Des(); |
397 ptr.Copy( *contentType ); |
391 ptr.Copy( *contentType ); |
398 CLOG_WRITE_FORMAT(" contentType: %S",&ptr); |
392 CLOG_WRITE_FORMAT(" contentType: %S",&ptr); |
399 delete contType; |
393 delete contType; |
400 contType = NULL; |
394 contType = NULL; |
401 #endif // _DEBUG |
395 #endif // _DEBUG |
402 |
396 |
403 User::LeaveIfError( apaLs.AppForDataType( TDataType(*contentType), appUid ) ); |
397 User::LeaveIfError( apaLs.AppForDataType( TDataType(*contentType), appUid ) ); |
404 HBufC* handlerName = ConstructHandlerAppNameLC( appUid, apaLs ); |
398 HBufC* handlerName = ConstructHandlerAppNameLC( appUid, apaLs ); |
405 |
399 |
406 itemText = FormatListBoxItemLC( *handlerHeader, *handlerName ); |
400 itemText = FormatListBoxItemLC( *handlerHeader, *handlerName ); |
407 CleanupStack::PopAndDestroy( itemText ); |
401 CleanupStack::PopAndDestroy( itemText ); |
408 |
402 |
409 CleanupStack::PopAndDestroy( handlerName ); |
403 CleanupStack::PopAndDestroy( handlerName ); |
410 CleanupStack::Pop( contentType ); // Still needed - push later again |
404 CleanupStack::Pop( contentType ); // Still needed - push later again |
411 CleanupStack::PopAndDestroy( &apaLs ); |
405 CleanupStack::PopAndDestroy( &apaLs ); |
412 CleanupStack::PopAndDestroy( handlerHeader ); |
406 CleanupStack::PopAndDestroy( handlerHeader ); |
413 itemText = NULL; |
407 itemText = NULL; |
414 handlerName = NULL; |
408 handlerName = NULL; |
415 handlerHeader = NULL; |
409 handlerHeader = NULL; |
416 CleanupStack::PushL( contentType ); |
410 CleanupStack::PushL( contentType ); |
417 |
411 |
418 |
412 |
419 //------------------------------------------- |
413 //------------------------------------------- |
420 // MIME Content Type |
414 // MIME Content Type |
421 // |
415 // |
422 HBufC* typeHeader = StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_FILETYPE ); |
416 HBufC* typeHeader = StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_FILETYPE ); |
423 |
417 |
441 typeString = NULL; |
435 typeString = NULL; |
442 typeHeader = NULL; |
436 typeHeader = NULL; |
443 contentType = NULL; |
437 contentType = NULL; |
444 |
438 |
445 //------------------------------------------- |
439 //------------------------------------------- |
446 // Price: since dm has no info, we don't need this at all here |
440 // Price: since dm has no info, we don't need this at all here |
447 // |
441 // |
448 |
442 |
449 //------------------------------------------- |
443 //------------------------------------------- |
450 // Description: since dm has no info, we don't need this at all here |
444 // Description: since dm has no info, we don't need this at all here |
451 // |
445 // |
452 |
446 |
453 //------------------------------------------- |
447 //------------------------------------------- |
454 // Vendor: since dm has no info, we don't need this at all here |
448 // Vendor: since dm has no info, we don't need this at all here |
455 // |
449 // |
456 |
450 |
457 // Show popup list - it calls CActiveScheduler::Start(), so be careful |
451 // Show popup list - it calls CActiveScheduler::Start(), so be careful |
458 // when using data members after ExecuteLD! |
452 // when using data members after ExecuteLD! |
459 iDownloadConfirmationShown = ETrue; |
453 iDownloadConfirmationShown = ETrue; |
460 iPopupList = popupList; |
454 iPopupList = popupList; |
461 TBool deleted( EFalse ); |
455 TBool deleted( EFalse ); |
462 iDownloadConfirmationDeletedPtr = &deleted; |
456 iDownloadConfirmationDeletedPtr = &deleted; |
463 TInt pressedOk = popupList->ExecuteLD(); |
457 TInt pressedOk = popupList->ExecuteLD(); |
464 CleanupStack::Pop( popupList ); // popupList |
458 CleanupStack::Pop( popupList ); // popupList |
465 if ( !deleted ) |
459 if ( !deleted ) |
466 { |
460 { |
467 // We can use members only in this case! |
461 // We can use members only in this case! |
468 iDownloadConfirmationShown = EFalse; |
462 iDownloadConfirmationShown = EFalse; |
469 iPopupList = NULL; |
463 iPopupList = NULL; |
474 |
468 |
475 CLOG_WRITE_FORMAT(" pressedOk: %d",pressedOk); |
469 CLOG_WRITE_FORMAT(" pressedOk: %d",pressedOk); |
476 CLOG_LEAVEFN("CUserInteractionsEventHandler::ShowDownloadConfirmationL"); |
470 CLOG_LEAVEFN("CUserInteractionsEventHandler::ShowDownloadConfirmationL"); |
477 return (TBool)pressedOk; |
471 return (TBool)pressedOk; |
478 } |
472 } |
479 |
473 |
480 // ----------------------------------------------------------------------------- |
474 // ----------------------------------------------------------------------------- |
481 // CUserInteractionsEventHandler::ConstructHandlerAppNameLC |
475 // CUserInteractionsEventHandler::ConstructHandlerAppNameLC |
482 // ----------------------------------------------------------------------------- |
476 // ----------------------------------------------------------------------------- |
483 // |
477 // |
484 HBufC* CUserInteractionsEventHandler::ConstructHandlerAppNameLC |
478 HBufC* CUserInteractionsEventHandler::ConstructHandlerAppNameLC |
485 ( const TUid& aAppUid, RApaLsSession& aApaLs ) |
479 ( const TUid& aAppUid, RApaLsSession& aApaLs ) |
486 { |
480 { |
487 CLOG_ENTERFN("CUserInteractionsEventHandler::ConstructHandlerAppNameLC"); |
481 CLOG_ENTERFN("CUserInteractionsEventHandler::ConstructHandlerAppNameLC"); |
488 |
482 |
489 HBufC* handlerName = NULL; |
483 HBufC* handlerName = NULL; |
490 if ( aAppUid == TUid::Null() ) |
484 if ( aAppUid == TUid::Null() ) |
491 { |
485 { |
492 // No handler found |
486 // No handler found |
493 handlerName = StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_UNKNOWN ); |
487 handlerName = StringLoader::LoadLC( R_DMUL_DOWNLOADCONF_UNKNOWN ); |
497 TApaAppInfo appInfo; |
491 TApaAppInfo appInfo; |
498 User::LeaveIfError( aApaLs.GetAppInfo( appInfo, aAppUid ) ); |
492 User::LeaveIfError( aApaLs.GetAppInfo( appInfo, aAppUid ) ); |
499 CLOG_WRITE_FORMAT(" appInfo.iFullName: %S",&appInfo.iFullName); |
493 CLOG_WRITE_FORMAT(" appInfo.iFullName: %S",&appInfo.iFullName); |
500 CLOG_WRITE_FORMAT(" appInfo.iCaption: %S",&appInfo.iCaption); |
494 CLOG_WRITE_FORMAT(" appInfo.iCaption: %S",&appInfo.iCaption); |
501 CLOG_WRITE_FORMAT(" appInfo.iShortCaption: %S",&appInfo.iShortCaption); |
495 CLOG_WRITE_FORMAT(" appInfo.iShortCaption: %S",&appInfo.iShortCaption); |
502 // In many cases there is long caption. We should use short caption only |
496 // In many cases there is long caption. We should use short caption only |
503 // if it is empty. They say that sometimes the long caption is not empty, |
497 // if it is empty. They say that sometimes the long caption is not empty, |
504 // but it contains only a space (0x20). In this case we must use the short. |
498 // but it contains only a space (0x20). In this case we must use the short. |
505 // For safety reasons, we will check the whole long caption, if it |
499 // For safety reasons, we will check the whole long caption, if it |
506 // contains only space characters. |
500 // contains only space characters. |
507 const TDesC& longCap = appInfo.iCaption; |
501 const TDesC& longCap = appInfo.iCaption; |
508 TBool longCapIsEmpty = (longCap.Length() == 0); |
502 TBool longCapIsEmpty = (longCap.Length() == 0); |
509 if ( longCapIsEmpty == EFalse ) |
503 if ( longCapIsEmpty == EFalse ) |
510 { |
504 { |
545 // ----------------------------------------------------------------------------- |
539 // ----------------------------------------------------------------------------- |
546 // |
540 // |
547 HBufC* CUserInteractionsEventHandler::FormatListBoxItemLC |
541 HBufC* CUserInteractionsEventHandler::FormatListBoxItemLC |
548 ( const TDesC& aFirst, const TDesC& aSecond ) |
542 ( const TDesC& aFirst, const TDesC& aSecond ) |
549 { |
543 { |
550 HBufC* res = HBufC::NewLC( aFirst.Length() + |
544 HBufC* res = HBufC::NewLC( aFirst.Length() + |
551 aSecond.Length() + |
545 aSecond.Length() + |
552 KListBoxSeparator().Length() ); |
546 KListBoxSeparator().Length() ); |
553 res->Des().Copy( aFirst ); |
547 res->Des().Copy( aFirst ); |
554 res->Des().Append( KListBoxSeparator ); |
548 res->Des().Append( KListBoxSeparator ); |
555 res->Des().Append( aSecond ); |
549 res->Des().Append( aSecond ); |
556 return res; |
550 return res; |
565 CLOG_ENTERFN("CUserInteractionsEventHandler::HandleInProgressStateL"); |
559 CLOG_ENTERFN("CUserInteractionsEventHandler::HandleInProgressStateL"); |
566 |
560 |
567 // GET - download is in progress - user can cancel |
561 // GET - download is in progress - user can cancel |
568 if( iEvent.iProgressState == EHttpProgCodDownloadStarted && iEvent.iDownloadState == EHttpDlInprogress ) |
562 if( iEvent.iProgressState == EHttpProgCodDownloadStarted && iEvent.iDownloadState == EHttpDlInprogress ) |
569 { |
563 { |
570 iRegistryModel.DownloadsList().CancelDisplayingDownloadsList(); |
564 iRegistryModel.DownloadsList().CancelDisplayingDownloadsList(); |
571 } |
565 } |
572 if ( iEvent.iProgressState == EHttpContTypeRecognitionAvail ) |
566 if ( iEvent.iProgressState == EHttpContTypeRecognitionAvail ) |
573 { |
567 { |
574 // Don't show confirmation query for COD downloads |
568 // Don't show confirmation query for COD downloads |
575 TBool isCodDownload( EFalse ); |
569 TBool isCodDownload( EFalse ); |
587 TPtr8 contentTypePtr = contentType->Des(); |
581 TPtr8 contentTypePtr = contentType->Des(); |
588 User::LeaveIfError |
582 User::LeaveIfError |
589 ( iDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
583 ( iDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
590 if( 0 == contentType->Compare( KMultiPartMimeType ) ) |
584 if( 0 == contentType->Compare( KMultiPartMimeType ) ) |
591 { |
585 { |
592 // Don't show confirmation query yet, but |
586 // Don't show confirmation query yet, but |
593 // observe EHttpProgSupportedMultiPart. |
587 // observe EHttpProgSupportedMultiPart. |
594 } |
588 } |
595 else |
589 else |
596 { |
590 { |
597 iUiUtils.IsContentTypeSupportedL( iDownload ); |
591 iUiUtils.IsContentTypeSupportedL( iDownload ); |
598 TBool suppressDownloadConfirmation( EFalse ); |
592 TBool suppressDownloadConfirmation( EFalse ); |
599 iRegistryModel.UserInteractions().GetBoolAttributeL |
593 iRegistryModel.UserInteractions().GetBoolAttributeL |
600 ( CDownloadMgrUiUserInteractions::EAttrSuppressDownloadConfirmation, |
594 ( CDownloadMgrUiUserInteractions::EAttrSuppressDownloadConfirmation, |
601 suppressDownloadConfirmation ); |
595 suppressDownloadConfirmation ); |
602 CLOG_WRITE_FORMAT(" suppressDownloadConfirmation: %d", |
596 CLOG_WRITE_FORMAT(" suppressDownloadConfirmation: %d", |
603 suppressDownloadConfirmation); |
597 suppressDownloadConfirmation); |
604 |
598 |
605 if ( suppressDownloadConfirmation ) |
599 if ( suppressDownloadConfirmation ) |
606 { |
600 { |
607 // Nothing to do. |
601 // Nothing to do. |
625 } |
619 } |
626 else |
620 else |
627 { |
621 { |
628 userConfirms = ShowDownloadConfirmationL |
622 userConfirms = ShowDownloadConfirmationL |
629 ( iDownload, R_AVKON_SOFTKEYS_OK_CANCEL__OK, EFalse ); |
623 ( iDownload, R_AVKON_SOFTKEYS_OK_CANCEL__OK, EFalse ); |
630 |
624 |
631 // executes a wait dialog! Check if this is deleted meanwhile |
625 // executes a wait dialog! Check if this is deleted meanwhile |
632 if ( aThisDeleted ) |
626 if ( aThisDeleted ) |
633 { |
627 { |
634 CLOG_WRITE_FORMAT(" this deleted: %x", this); |
628 CLOG_WRITE_FORMAT(" this deleted: %x", this); |
635 CLOG_LEAVEFN("CUserInteractionsEventHandler::HandleInProgressStateL"); |
629 CLOG_LEAVEFN("CUserInteractionsEventHandler::HandleInProgressStateL"); |
636 CleanupStack::PopAndDestroy( contentType ); |
|
637 return; |
630 return; |
638 } |
631 } |
639 |
632 |
640 if ( userConfirms ) |
633 if ( userConfirms ) |
641 { |
634 { |
642 TBool isLaunchType( EFalse ); |
635 TBool isLaunchType( EFalse ); |
643 if( iUiUtils.DrmDownloadL( iDownload ) ) |
636 if( iUiUtils.DrmDownloadL( iDownload ) ) |
644 { |
637 { |
657 EDlAttrAction, ELaunch ) ); |
650 EDlAttrAction, ELaunch ) ); |
658 } |
651 } |
659 else |
652 else |
660 { |
653 { |
661 //part of error PNIO-73GEM3.Sis file progress should be visible to user |
654 //part of error PNIO-73GEM3.Sis file progress should be visible to user |
662 if( (KSisxApplication().Find( contentTypePtr)!= KErrNotFound) || |
655 if( (KSisxApplication().Find( contentTypePtr)!= KErrNotFound) || |
663 (KPipApplication().Find( contentTypePtr)!= KErrNotFound) || |
656 (KPipApplication().Find( contentTypePtr)!= KErrNotFound) || |
664 (KWidgetMimeType().Find( contentTypePtr)!= KErrNotFound) || |
657 (KWidgetMimeType().Find( contentTypePtr)!= KErrNotFound) || |
665 (KSharingConfig().Find( contentTypePtr)!= KErrNotFound) ) |
658 (KSharingConfig().Find( contentTypePtr)!= KErrNotFound) ) |
666 { |
659 { |
667 isLaunchType = ETrue; |
660 isLaunchType = ETrue; |
668 User::LeaveIfError( iDownload.SetIntAttribute( |
661 User::LeaveIfError( iDownload.SetIntAttribute( |
669 EDlAttrAction, ELaunch ) ); |
662 EDlAttrAction, ELaunch ) ); |
670 } |
663 } |
671 // Open the download list if there is no more |
664 // Open the download list if there is no more |
672 // download confirmation shown: |
665 // download confirmation shown: |
673 if ( iRegistryModel.UserInteractions(). |
666 if ( iRegistryModel.UserInteractions(). |
674 DownloadConfirmationsShown() == 0 ) |
667 DownloadConfirmationsShown() == 0 ) |
675 { |
668 { |
676 if ( iRegistryModel.DownloadsListInstalled() ) |
669 if ( iRegistryModel.DownloadsListInstalled() ) |
689 } |
682 } |
690 } |
683 } |
691 } |
684 } |
692 if (userConfirms) |
685 if (userConfirms) |
693 { |
686 { |
694 |
687 |
695 #ifdef __DMGR_PD_TESTHARNESS |
688 #ifdef __DMGR_PD_TESTHARNESS |
696 iUiUtils.TestLaunchPdAppL(iDownload); |
689 iUiUtils.TestLaunchPdAppL(iDownload); |
697 #else |
690 #else |
698 //#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
691 //#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
699 |
692 |
700 // check if it's PdLaunch action |
693 // check if it's PdLaunch action |
701 TInt32 action(0); |
694 TInt32 action(0); |
702 User::LeaveIfError( iDownload.GetIntAttribute( EDlAttrAction, action ) ); |
695 User::LeaveIfError( iDownload.GetIntAttribute( EDlAttrAction, action ) ); |
703 if( (action & EPdLaunch) && |
696 if( (action & EPdLaunch) && |
704 iUiUtils.CanLaunchAsProgDownload( iDownload, iRegistryModel.DownloadsList(),EFalse )) |
697 iUiUtils.CanLaunchAsProgDownload( iDownload, iRegistryModel.DownloadsList(),EFalse )) |
705 { |
698 { |
706 CLOG_WRITE( " launchPdAppL(iDownload)" ); |
699 CLOG_WRITE( " launchPdAppL(iDownload)" ); |
707 iUiUtils.LaunchPdAppL(iDownload, ETrue); |
700 iUiUtils.LaunchPdAppL(iDownload, ETrue); |
708 } |
701 } |
709 //#endif //RD_BROWSER_PROGRESSIVE_DOWNLOAD |
702 //#endif //RD_BROWSER_PROGRESSIVE_DOWNLOAD |
710 #endif //__DMGR_PD_TESTHARNESS |
703 #endif //__DMGR_PD_TESTHARNESS |
711 } |
704 } |
712 } |
705 } |
713 CleanupStack::PopAndDestroy( contentType ); // contentType |
706 CleanupStack::PopAndDestroy( contentType ); // contentType |
714 } |
707 } |
715 } |
708 } |
718 TBool isCodPdAvailable( EFalse ); |
711 TBool isCodPdAvailable( EFalse ); |
719 User::LeaveIfError( iDownload.GetBoolAttribute |
712 User::LeaveIfError( iDownload.GetBoolAttribute |
720 ( EDlAttrCodPdAvailable, isCodPdAvailable ) ); |
713 ( EDlAttrCodPdAvailable, isCodPdAvailable ) ); |
721 if ( isCodPdAvailable ) |
714 if ( isCodPdAvailable ) |
722 { |
715 { |
723 |
716 |
724 #ifdef __DMGR_PD_TESTHARNESS |
717 #ifdef __DMGR_PD_TESTHARNESS |
725 iUiUtils.TestLaunchPdAppL(iDownload); |
718 iUiUtils.TestLaunchPdAppL(iDownload); |
726 #else |
719 #else |
727 // check if it's PdLaunch action |
720 // check if it's PdLaunch action |
728 TInt32 action(0); |
721 TInt32 action(0); |
729 User::LeaveIfError( iDownload.GetIntAttribute( EDlAttrAction, action ) ); |
722 User::LeaveIfError( iDownload.GetIntAttribute( EDlAttrAction, action ) ); |
730 if ( (action & EPdLaunch) && |
723 if ( (action & EPdLaunch) && |
731 iUiUtils.CanLaunchAsProgDownload( iDownload, iRegistryModel.DownloadsList(),ETrue )) |
724 iUiUtils.CanLaunchAsProgDownload( iDownload, iRegistryModel.DownloadsList(),ETrue )) |
732 { |
725 { |
733 iUiUtils.LaunchPdAppL(iDownload, ETrue); |
726 iUiUtils.LaunchPdAppL(iDownload, ETrue); |
734 } |
727 } |
735 #endif //__DMGR_PD_TESTHARNESS |
728 #endif //__DMGR_PD_TESTHARNESS |
736 } |
729 } |
737 } |
730 } |
738 else if ( iEvent.iProgressState == EHttpProgCodDescriptorAccepted ) |
731 else if ( iEvent.iProgressState == EHttpProgCodDescriptorAccepted ) |
739 { |
732 { |
740 // COD load accepted. Download is turned to visible, and |
733 // COD load accepted. Download is turned to visible, and |
741 // downloads list is shown. |
734 // downloads list is shown. |
742 User::LeaveIfError( iDownload.SetBoolAttribute |
735 User::LeaveIfError( iDownload.SetBoolAttribute |
743 ( EDlAttrHidden, EFalse ) ); |
736 ( EDlAttrHidden, EFalse ) ); |
744 CLOG_WRITE(" SetBoolAttribute EDlAttrHidden OK"); |
737 CLOG_WRITE(" SetBoolAttribute EDlAttrHidden OK"); |
745 // If this download's ServiceFlow was running, it's not more |
738 // If this download's ServiceFlow was running, it's not more |
746 // a ServiceFlow, thus the next postponed download can be |
739 // a ServiceFlow, thus the next postponed download can be |
747 // scheduled. |
740 // scheduled. |
748 if ( iRegistryModel.UserInteractions().IsCodServiceFlowRunning( iDownload ) ) |
741 if ( iRegistryModel.UserInteractions().IsCodServiceFlowRunning( iDownload ) ) |
749 { |
742 { |
750 iRegistryModel.UserInteractions().SchedulePostponedDownloadL(); |
743 iRegistryModel.UserInteractions().SchedulePostponedDownloadL(); |
751 } |
744 } |
758 } |
751 } |
759 else if ( iEvent.iProgressState == EHttpProgCodLoadEnd ) |
752 else if ( iEvent.iProgressState == EHttpProgCodLoadEnd ) |
760 { |
753 { |
761 // UI state must be checked before we set download to hidden! |
754 // UI state must be checked before we set download to hidden! |
762 TBool isUiBusyNow = iRegistryModel.UserInteractions().IsUiBusy(); |
755 TBool isUiBusyNow = iRegistryModel.UserInteractions().IsUiBusy(); |
763 // COD load has ended. Download is turned to hidden, removed from |
756 // COD load has ended. Download is turned to hidden, removed from |
764 // downloads list, and restarted (ServiceFlow). |
757 // downloads list, and restarted (ServiceFlow). |
765 CLOG_WRITE(" SetBoolAttribute EDlAttrHidden OK"); |
758 CLOG_WRITE(" SetBoolAttribute EDlAttrHidden OK"); |
766 |
759 |
767 // Restart if possible - start ServiceFlow. |
760 // Restart if possible - start ServiceFlow. |
768 // (UserInteractions must be installed...) |
761 // (UserInteractions must be installed...) |
769 if ( isUiBusyNow ) |
762 if ( isUiBusyNow ) |
770 { |
763 { |
771 // Not possible to do it. Postpone the Service Flow and |
764 // Not possible to do it. Postpone the Service Flow and |
772 // invoke when no more handler is running. |
765 // invoke when no more handler is running. |
773 // The download is already hidden! |
766 // The download is already hidden! |
774 iRegistryModel.UserInteractions().PostponeCodHandlingL( iDownload ); |
767 iRegistryModel.UserInteractions().PostponeCodHandlingL( iDownload ); |
775 //Download will be handled when the UI becomes free. |
768 //Download will be handled when the UI becomes free. |
776 } |
769 } |
794 } |
787 } |
795 else |
788 else |
796 { |
789 { |
797 TBool suppressDownloadConfirmation( EFalse ); |
790 TBool suppressDownloadConfirmation( EFalse ); |
798 iRegistryModel.UserInteractions().GetBoolAttributeL |
791 iRegistryModel.UserInteractions().GetBoolAttributeL |
799 ( CDownloadMgrUiUserInteractions::EAttrSuppressDownloadConfirmation, |
792 ( CDownloadMgrUiUserInteractions::EAttrSuppressDownloadConfirmation, |
800 suppressDownloadConfirmation ); |
793 suppressDownloadConfirmation ); |
801 CLOG_WRITE_FORMAT(" suppressDownloadConfirmation: %d", |
794 CLOG_WRITE_FORMAT(" suppressDownloadConfirmation: %d", |
802 suppressDownloadConfirmation); |
795 suppressDownloadConfirmation); |
803 |
796 |
804 if ( suppressDownloadConfirmation ) |
797 if ( suppressDownloadConfirmation ) |
805 { |
798 { |
806 // Nothing to do. |
799 // Nothing to do. |
807 } |
800 } |
808 else |
801 else |
809 { |
802 { |
810 TBool userConfirms = ShowDownloadConfirmationL |
803 TBool userConfirms = ShowDownloadConfirmationL |
811 ( iDownload, R_AVKON_SOFTKEYS_OK_CANCEL__OK, EFalse ); |
804 ( iDownload, R_AVKON_SOFTKEYS_OK_CANCEL__OK, EFalse ); |
812 |
805 |
813 // executes a wait dialog! Check if this is deleted meanwhile |
806 // executes a wait dialog! Check if this is deleted meanwhile |
814 if ( aThisDeleted ) |
807 if ( aThisDeleted ) |
815 { |
808 { |
816 CLOG_WRITE_FORMAT(" this deleted: %x", this); |
809 CLOG_WRITE_FORMAT(" this deleted: %x", this); |
817 CLOG_LEAVEFN("CUserInteractionsEventHandler::HandleInProgressStateL"); |
810 CLOG_LEAVEFN("CUserInteractionsEventHandler::HandleInProgressStateL"); |
818 return; |
811 return; |
819 } |
812 } |
820 |
813 |
821 if ( userConfirms ) |
814 if ( userConfirms ) |
822 { |
815 { |
823 // Open the download list if there is no more |
816 // Open the download list if there is no more |
824 // download confirmation shown: |
817 // download confirmation shown: |
825 if ( iRegistryModel.UserInteractions(). |
818 if ( iRegistryModel.UserInteractions(). |
826 DownloadConfirmationsShown() == 0 ) |
819 DownloadConfirmationsShown() == 0 ) |
827 { |
820 { |
828 if ( iRegistryModel.DownloadsListInstalled() ) |
821 if ( iRegistryModel.DownloadsListInstalled() ) |
867 } |
860 } |
868 else |
861 else |
869 { |
862 { |
870 TBool suppressDownloadConfirmation( EFalse ); |
863 TBool suppressDownloadConfirmation( EFalse ); |
871 iRegistryModel.UserInteractions().GetBoolAttributeL |
864 iRegistryModel.UserInteractions().GetBoolAttributeL |
872 ( CDownloadMgrUiUserInteractions::EAttrSuppressDownloadConfirmation, |
865 ( CDownloadMgrUiUserInteractions::EAttrSuppressDownloadConfirmation, |
873 suppressDownloadConfirmation ); |
866 suppressDownloadConfirmation ); |
874 CLOG_WRITE_FORMAT(" suppressDownloadConfirmation: %d", |
867 CLOG_WRITE_FORMAT(" suppressDownloadConfirmation: %d", |
875 suppressDownloadConfirmation); |
868 suppressDownloadConfirmation); |
876 |
869 |
877 if ( suppressDownloadConfirmation ) |
870 if ( suppressDownloadConfirmation ) |
878 { |
871 { |
879 // Nothing to do, just resume the download. |
872 // Nothing to do, just resume the download. |
891 { |
884 { |
892 CLOG_WRITE_FORMAT(" this deleted: %x", this); |
885 CLOG_WRITE_FORMAT(" this deleted: %x", this); |
893 CLOG_LEAVEFN("CUserInteractionsEventHandler::HandlePausedStateL"); |
886 CLOG_LEAVEFN("CUserInteractionsEventHandler::HandlePausedStateL"); |
894 return; |
887 return; |
895 } |
888 } |
896 |
889 |
897 // Open Downloads List if user confirms: |
890 // Open Downloads List if user confirms: |
898 if ( userConfirms ) |
891 if ( userConfirms ) |
899 { |
892 { |
900 // Resume the download: |
893 // Resume the download: |
901 User::LeaveIfError( iDownload.Start() ); |
894 User::LeaveIfError( iDownload.Start() ); |
902 // and open the download list if there is no more |
895 // and open the download list if there is no more |
903 // download confirmation shown: |
896 // download confirmation shown: |
904 if ( iRegistryModel.UserInteractions(). |
897 if ( iRegistryModel.UserInteractions(). |
905 DownloadConfirmationsShown() == 0 ) |
898 DownloadConfirmationsShown() == 0 ) |
906 { |
899 { |
907 if ( iRegistryModel.DownloadsListInstalled() ) |
900 if ( iRegistryModel.DownloadsListInstalled() ) |
938 CLOG_WRITE(" Move has started"); |
931 CLOG_WRITE(" Move has started"); |
939 } |
932 } |
940 else if ( iEvent.iProgressState == EHttpProgContentFileMoved || iEvent.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ) |
933 else if ( iEvent.iProgressState == EHttpProgContentFileMoved || iEvent.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ) |
941 { |
934 { |
942 // An asynchronous move has ended. |
935 // An asynchronous move has ended. |
943 |
936 |
944 CLOG_WRITE(" Move has ended"); |
937 CLOG_WRITE(" Move has ended"); |
945 // After successful moving, display updated download list |
938 // After successful moving, display updated download list |
946 iRegistryModel.DownloadsList().DisplayDownloadsListL( iDownload ); |
939 iRegistryModel.DownloadsList().DisplayDownloadsListL( iDownload ); |
947 // Notify Media Gallery about new media file |
940 // Notify Media Gallery about new media file |
948 // first get path to gallery where file was moved |
941 // first get path to gallery where file was moved |
949 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
942 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
950 TPtr fileNamePtr = fileName->Des(); |
943 TPtr fileNamePtr = fileName->Des(); |
951 TInt attErr = iDownload.GetStringAttribute( |
944 TInt attErr = iDownload.GetStringAttribute( |
952 EDlAttrDestFilename, fileNamePtr ); |
945 EDlAttrDestFilename, fileNamePtr ); |
953 CLOG_WRITE_FORMAT(" EDlAttrDestFilename: %S",&fileNamePtr); |
946 CLOG_WRITE_FORMAT(" EDlAttrDestFilename: %S",&fileNamePtr); |
954 TBool havePath = (attErr == KErrNone) && (fileNamePtr.Length() > 0); |
947 TBool havePath = (attErr == KErrNone) && (fileNamePtr.Length() > 0); |
955 |
948 |
956 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
949 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
957 // |
950 // |
958 CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL( |
951 CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL( |
959 CEikonEnv::Static()->FsSession() ); |
952 CEikonEnv::Static()->FsSession() ); |
960 if( havePath ) |
953 if( havePath ) |
1003 TInt err = iDownload.GetBoolAttribute |
996 TInt err = iDownload.GetBoolAttribute |
1004 ( EDlAttrProgressive, isProgressive ); |
997 ( EDlAttrProgressive, isProgressive ); |
1005 CLOG_WRITE_FORMAT(" EDlAttrProgressive err: %d",err); |
998 CLOG_WRITE_FORMAT(" EDlAttrProgressive err: %d",err); |
1006 // 'err' is ignored. |
999 // 'err' is ignored. |
1007 CLOG_WRITE_FORMAT(" EDlAttrProgressive: %d", isProgressive); |
1000 CLOG_WRITE_FORMAT(" EDlAttrProgressive: %d", isProgressive); |
1008 |
1001 |
1009 // check if move is already issued |
1002 // check if move is already issued |
1010 TBool isMoveIssued = EFalse; |
1003 TBool isMoveIssued = EFalse; |
1011 TInt32 progState(0); |
1004 TInt32 progState(0); |
1012 User::LeaveIfError( iDownload.GetIntAttribute |
1005 User::LeaveIfError( iDownload.GetIntAttribute |
1013 ( EDlAttrProgressState, progState ) ); |
1006 ( EDlAttrProgressState, progState ) ); |
1014 |
1007 |
1015 if(progState == EHttpProgMovingContentFile) isMoveIssued = ETrue; |
1008 if(progState == EHttpProgMovingContentFile) isMoveIssued = ETrue; |
1016 |
1009 |
1017 if( isCodDownload ) |
1010 if( isCodDownload ) |
1018 { |
1011 { |
1019 HBufC8* contentType = HBufC8::NewLC( KMaxContentTypeLength ); |
1012 HBufC8* contentType = HBufC8::NewLC( KMaxContentTypeLength ); |
1020 TPtr8 contentTypePtr = contentType->Des(); |
1013 TPtr8 contentTypePtr = contentType->Des(); |
1021 User::LeaveIfError |
1014 User::LeaveIfError |
1022 ( iDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
1015 ( iDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
1023 if( !contentType->Compare(KRoapMimeType)) |
1016 if( !contentType->Compare(KRoapMimeType)) |
1024 { |
1017 { |
1025 User::LeaveIfError |
1018 User::LeaveIfError |
1026 ( iDownload.Delete()); |
1019 ( iDownload.Delete()); |
1027 } |
1020 } |
1028 CleanupStack::PopAndDestroy( contentType ); |
1021 CleanupStack::PopAndDestroy( contentType ); |
1029 } |
1022 } |
1030 else if( isProgressive || isMoveIssued ) |
1023 else if( isProgressive || isMoveIssued ) |
1031 { |
1024 { |
1032 //do not move |
1025 //do not move |
1033 |
1026 |
1034 } |
1027 } |
1035 else |
1028 else |
1036 { |
1029 { |
1037 // Move content to the location defined by KDownloadPath |
1030 // Move content to the location defined by KDownloadPath |
1038 |
1031 |
1061 if( lastSlashPos != KErrNotFound ) |
1054 if( lastSlashPos != KErrNotFound ) |
1062 { |
1055 { |
1063 fileNamePtr.Delete( 0, lastSlashPos ); |
1056 fileNamePtr.Delete( 0, lastSlashPos ); |
1064 } |
1057 } |
1065 } |
1058 } |
1066 |
1059 |
1067 // Setting RootPath for new Destination file |
1060 // Setting RootPath for new Destination file |
1068 fileNamePtr.Insert( 0, rootPath ); |
1061 fileNamePtr.Insert( 0, rootPath ); |
1069 // Setting KDownloadPath |
1062 // Setting KDownloadPath |
1070 fileNamePtr.Insert( rootPath.Length(), KDownloadPath ); |
1063 fileNamePtr.Insert( rootPath.Length(), KDownloadPath ); |
1071 #else |
1064 #else |
1072 |
1065 |
1073 TParse p; |
1066 TParse p; |
1074 p.SetNoWild(fileNamePtr, NULL, NULL); |
1067 p.SetNoWild(fileNamePtr, NULL, NULL); |
1075 TDriveUnit currentDrive(fileNamePtr); |
1068 TDriveUnit currentDrive(fileNamePtr); |
1076 TFileName rootPath; |
1069 TFileName rootPath; |
1077 User::LeaveIfError( PathInfo::GetRootPath( rootPath, currentDrive ) ); |
1070 User::LeaveIfError( PathInfo::GetRootPath( rootPath, currentDrive ) ); |
1078 |
1071 |
1079 TPtrC namePtr = p.NameAndExt(); |
1072 TPtrC namePtr = p.NameAndExt(); |
1080 fileNamePtr.Format( _L("%S%S\\%S"), &rootPath, |
1073 fileNamePtr.Format( _L("%S%S\\%S"), &rootPath, |
1081 &KDownloadPath, |
1074 &KDownloadPath, |
1082 &namePtr ); |
1075 &namePtr ); |
1083 #endif |
1076 #endif |
1100 } |
1093 } |
1101 } |
1094 } |
1102 } |
1095 } |
1103 |
1096 |
1104 |
1097 |
1105 TBool isProg(EFalse); |
1098 // update EDlAttrDestFilename with new path |
1106 User::LeaveIfError( iDownload.GetBoolAttribute( EDlAttrProgressive, isProg ) ); |
1099 User::LeaveIfError |
1107 |
1100 ( iDownload.SetStringAttribute( EDlAttrDestFilename, *fileName ) ); |
1108 // Move operation should be invoked by DL Manger if its not a progressive download. |
1101 // move file |
1109 if( !isProg ) |
1102 User::LeaveIfError( iDownload.Move() ); |
1110 { |
|
1111 // update EDlAttrDestFilename with new path |
|
1112 User::LeaveIfError |
|
1113 ( iDownload.SetStringAttribute( EDlAttrDestFilename, *fileName ) ); |
|
1114 User::LeaveIfError( iDownload.Move() ); |
|
1115 } |
|
1116 CleanupStack::PopAndDestroy( fileName ); // fileName |
1103 CleanupStack::PopAndDestroy( fileName ); // fileName |
1117 } |
1104 } |
1118 } |
1105 } |
1119 else if ( action & EPdLaunch ) |
1106 else if ( action & EPdLaunch ) |
1120 { |
1107 { |
1121 // do nothing since PdLaunch was already launched during the progress |
1108 // do nothing since PdLaunch was already launched during the progress |
1122 } |
1109 } |
1123 else |
1110 else |
1124 { |
1111 { |
1125 // Defaulting to Launch |
1112 // Defaulting to Launch |
1126 iRegistryModel.UserInteractions().HandleDownloadL( iDownload ); |
1113 iRegistryModel.UserInteractions().HandleDownloadL( iDownload ); |
1144 User::LeaveIfError( iDownload.GetBoolAttribute |
1131 User::LeaveIfError( iDownload.GetBoolAttribute |
1145 ( EDlAttrCodDownload, isCodDownload ) ); |
1132 ( EDlAttrCodDownload, isCodDownload ) ); |
1146 CLOG_WRITE_FORMAT("EDlAttrCodDownload: %d",isCodDownload); |
1133 CLOG_WRITE_FORMAT("EDlAttrCodDownload: %d",isCodDownload); |
1147 if ( isCodDownload ) |
1134 if ( isCodDownload ) |
1148 { |
1135 { |
1149 // If the ServiceFlow of the download was running, but failed, |
1136 // If the ServiceFlow of the download was running, but failed, |
1150 // schedule the next download for running. |
1137 // schedule the next download for running. |
1151 // UserInteractions is assumed to be installed. |
1138 // UserInteractions is assumed to be installed. |
1152 // Do not delete the download yet (because IsCodServiceFlowRunning needs it)! |
1139 // Do not delete the download yet (because IsCodServiceFlowRunning needs it)! |
1153 if ( iRegistryModel.UserInteractions().IsCodServiceFlowRunning( iDownload ) ) |
1140 if ( iRegistryModel.UserInteractions().IsCodServiceFlowRunning( iDownload ) ) |
1154 { |
1141 { |
1155 iRegistryModel.UserInteractions().SchedulePostponedDownloadL(); |
1142 iRegistryModel.UserInteractions().SchedulePostponedDownloadL(); |
1185 // Do not handle it. |
1172 // Do not handle it. |
1186 } |
1173 } |
1187 else |
1174 else |
1188 { |
1175 { |
1189 TBool errorHandled( EFalse ); |
1176 TBool errorHandled( EFalse ); |
1190 |
1177 |
1191 if ( !errorHandled ) |
1178 if ( !errorHandled ) |
1192 { |
1179 { |
1193 iUiUtils.ShowErrorNoteL( iDownload, errorId ); |
1180 iUiUtils.ShowErrorNoteL( iDownload, errorId ); |
1194 // This component is responsible for deleting |
1181 // This component is responsible for deleting |
1195 // not recoverable downloads |
1182 // not recoverable downloads |
1196 if ( iUiUtils.IsRecoverableFailL( iDownload, errorId ) ) |
1183 if ( iUiUtils.IsRecoverableFailL( iDownload, errorId ) ) |
1197 { |
1184 { |
1198 // Do nothing. |
1185 // Do nothing. |
1199 } |
1186 } |
1248 CleanupStack::PopAndDestroy( converted ); |
1235 CleanupStack::PopAndDestroy( converted ); |
1249 } |
1236 } |
1250 CleanupStack::PopAndDestroy( url ); |
1237 CleanupStack::PopAndDestroy( url ); |
1251 } |
1238 } |
1252 |
1239 |
1253 // iDownload can now been deleted |
1240 // iDownload can now been deleted |
1254 User::LeaveIfError( iDownload.Delete() ); |
1241 User::LeaveIfError( iDownload.Delete() ); |
1255 CLOG_WRITE(" Delete OK"); |
1242 CLOG_WRITE(" Delete OK"); |
1256 |
1243 |
1257 HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_CANCELLED, *dlName ); |
1244 HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_CANCELLED, *dlName ); |
1258 CLOG_WRITE(" StringLoader OK"); |
1245 CLOG_WRITE(" StringLoader OK"); |
1259 |
1246 |
1260 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(); |
1247 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(); |
1261 dlg->PrepareLC( R_DMUL_DOWNLOAD_OK_INFO ); |
1248 dlg->PrepareLC( R_DMUL_DOWNLOAD_OK_INFO ); |
1262 dlg->SetTextL( *infoPrompt ); |
1249 dlg->SetTextL( *infoPrompt ); |
1263 dlg->RunLD(); |
1250 dlg->RunLD(); |
1264 CLOG_WRITE(" RunLD OK"); |
1251 CLOG_WRITE(" RunLD OK"); |
1289 |
1276 |
1290 // This RunL may show wait dialogs. Use an indicator for if this is deleted |
1277 // This RunL may show wait dialogs. Use an indicator for if this is deleted |
1291 TBool deleted( EFalse ); |
1278 TBool deleted( EFalse ); |
1292 iDeletedPtr = &deleted; |
1279 iDeletedPtr = &deleted; |
1293 |
1280 |
1294 // Incase of completed and moved downloads, subsession will be closed and whole download info will be cached client side. |
1281 // Incase of completed and moved downloads, subsession will be closed and whole download info will be cached client side. |
1295 // No need to check for subsession close |
1282 // No need to check for subsession close |
1296 if(!(iEvent.iDownloadState == EHttpDlMultipleMOCompleted && (iEvent.iProgressState == EHttpProgContentFileMoved || iEvent.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ))) |
1283 if(!(iEvent.iDownloadState == EHttpDlMultipleMOCompleted && (iEvent.iProgressState == EHttpProgContentFileMoved || iEvent.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ))) |
1297 { |
1284 { |
1298 // Due to the postponed event handling, it may happen that somebody already |
1285 // Due to the postponed event handling, it may happen that somebody already |
1299 // closed the download meanwhile. Check if it is still alive: |
1286 // closed the download meanwhile. Check if it is still alive: |
1300 if ( iDownload.SubSessionHandle() == 0 ) |
1287 if ( iDownload.SubSessionHandle() == 0 ) |
1301 { |
1288 { |
1302 // No, it's already closed!! Do nothing. |
1289 // No, it's already closed!! Do nothing. |
1303 // Necessary task done in RunL. This object is no more necessary. |
1290 // Necessary task done in RunL. This object is no more necessary. |