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