13 * |
13 * |
14 * Description: Supports user interaction dialogs for downloads |
14 * Description: Supports user interaction dialogs for downloads |
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 "CUserInteractionsUtils.h" |
20 #include "CUserInteractionsUtils.h" |
24 #include "MDownloadHandlerObserver.h" |
21 #include "MDownloadHandlerObserver.h" |
25 #include "CDownloadMgrUiBase.h" |
22 #include <cdownloadmgruibase.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 <DownloadMgrUiLib.rsg> |
28 #include <DownloadMgrUiLib.rsg> |
32 #include <DownloadMgrClient.h> |
29 #include <downloadmgrclient.h> |
33 #include <AiwGenericParam.h> |
30 #include <AiwGenericParam.h> |
34 #include <DocumentHandler.h> |
31 #include <DocumentHandler.h> |
35 #include <coemain.h> |
32 #include <coemain.h> |
36 #include <ErrorUI.h> |
33 #include <ErrorUI.h> |
37 #include <eikenv.h> |
34 #include <eikenv.h> |
40 #include <CAknMemorySelectionDialog.h> |
37 #include <CAknMemorySelectionDialog.h> |
41 #include <AknQueryDialog.h> |
38 #include <AknQueryDialog.h> |
42 #include <StringLoader.h> |
39 #include <StringLoader.h> |
43 #include <AknSoftNotificationParameters.h> |
40 #include <AknSoftNotificationParameters.h> |
44 #include <AknSoftNotifier.h> |
41 #include <AknSoftNotifier.h> |
45 #include <aknnotewrappers.h> |
42 #include <AknNoteWrappers.h> |
46 #include <BrowserDialogsProvider.h> |
43 #include <browserdialogsprovider.h> |
47 #include <HttpDownloadMgrCommon.h> |
44 #include <httpdownloadmgrcommon.h> |
48 #include <pathinfo.h> |
45 #include <PathInfo.h> |
49 #include <AknGlobalNote.h> |
46 #include <aknglobalnote.h> |
50 #include <Oma2Agent.h> |
47 #include <Oma2Agent.h> |
51 #include <DRMCommon.h> |
48 #include <DRMCommon.h> |
52 #include <apmrec.h> |
49 #include <apmrec.h> |
53 #include <apgcli.h> |
50 #include <apgcli.h> |
54 #include <s32mem.h> |
51 #include <s32mem.h> |
55 #include "bautils.h" |
52 #include <bautils.h> |
56 #include <etelmm.h> |
53 #include <etelmm.h> |
57 #include <mmtsy_names.h> |
54 #include <MmTsy_names.h> |
58 #include <rconnmon.h> |
55 #include <rconnmon.h> |
59 #include <DcfEntry.h> |
56 #include <DcfEntry.h> |
60 #include <DcfRep.h> |
57 #include <DcfRep.h> |
61 |
|
62 // following line is temporary: AVKON dependency removal |
|
63 #undef BRDO_APP_GALLERY_SUPPORTED_FF |
|
64 |
58 |
65 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
59 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
66 #include <MGXFileManagerFactory.h> |
60 #include <MGXFileManagerFactory.h> |
67 #include <CMGXFileManager.h> |
61 #include <CMGXFileManager.h> |
68 #endif |
62 #endif |
79 |
73 |
80 // ----------------------------------------------------------------------------- |
74 // ----------------------------------------------------------------------------- |
81 // CUserInteractionsUtils::CUserInteractionsUtils |
75 // CUserInteractionsUtils::CUserInteractionsUtils |
82 // ----------------------------------------------------------------------------- |
76 // ----------------------------------------------------------------------------- |
83 // |
77 // |
84 CUserInteractionsUtils::CUserInteractionsUtils( CDownloadMgrUiBase& aDMgrUiBase, |
78 CUserInteractionsUtils::CUserInteractionsUtils( CDownloadMgrUiBase& aDMgrUiBase, |
85 MDownloadMgrUiLibRegModel& aRegistryModel ) |
79 MDownloadMgrUiLibRegModel& aRegistryModel ) |
86 : iCoeEnv( *CCoeEnv::Static() ), |
80 : iCoeEnv( *CCoeEnv::Static() ), |
87 iDMgrUiBase( aDMgrUiBase ), |
81 iDMgrUiBase( aDMgrUiBase ), |
88 iRegistryModel( aRegistryModel ), |
82 iRegistryModel( aRegistryModel ), |
89 iDocHandlerUsesTheUi( EFalse ) |
83 iDocHandlerUsesTheUi( EFalse ) |
90 { |
84 { |
91 } |
85 } |
116 // ----------------------------------------------------------------------------- |
110 // ----------------------------------------------------------------------------- |
117 // |
111 // |
118 CUserInteractionsUtils* CUserInteractionsUtils::NewL |
112 CUserInteractionsUtils* CUserInteractionsUtils::NewL |
119 ( CDownloadMgrUiBase& aDMgrUiBase, MDownloadMgrUiLibRegModel& aRegistryModel ) |
113 ( CDownloadMgrUiBase& aDMgrUiBase, MDownloadMgrUiLibRegModel& aRegistryModel ) |
120 { |
114 { |
121 CUserInteractionsUtils* self = |
115 CUserInteractionsUtils* self = |
122 new ( ELeave ) CUserInteractionsUtils( aDMgrUiBase, aRegistryModel ); |
116 new ( ELeave ) CUserInteractionsUtils( aDMgrUiBase, aRegistryModel ); |
123 CleanupStack::PushL( self ); |
117 CleanupStack::PushL( self ); |
124 self->ConstructL(); |
118 self->ConstructL(); |
125 CleanupStack::Pop(); |
119 CleanupStack::Pop(); |
126 return self; |
120 return self; |
140 delete iErrorUi; |
134 delete iErrorUi; |
141 CLOG_WRITE(" iErrorUi OK"); |
135 CLOG_WRITE(" iErrorUi OK"); |
142 delete iUnderTenFormatter; |
136 delete iUnderTenFormatter; |
143 CLOG_WRITE(" iUnderTenFormatter OK"); |
137 CLOG_WRITE(" iUnderTenFormatter OK"); |
144 delete iOverTenFormatter; |
138 delete iOverTenFormatter; |
145 CLOG_WRITE(" iOverTenFormatter OK"); |
139 CLOG_WRITE(" iOverTenFormatter OK"); |
146 CLOG_LEAVEFN("CUserInteractionsUtils::~CUserInteractionsUtils"); |
140 CLOG_LEAVEFN("CUserInteractionsUtils::~CUserInteractionsUtils"); |
147 } |
141 } |
148 |
142 |
149 // ----------------------------------------------------------------------------- |
143 // ----------------------------------------------------------------------------- |
150 // CUserInteractionsUtils::ShowErrorNoteL |
144 // CUserInteractionsUtils::ShowErrorNoteL |
151 // ----------------------------------------------------------------------------- |
145 // ----------------------------------------------------------------------------- |
152 // |
146 // |
153 void CUserInteractionsUtils::ShowErrorNoteL( RHttpDownload& aDownload, |
147 void CUserInteractionsUtils::ShowErrorNoteL( RHttpDownload& aDownload, |
154 TInt32 aErrorId ) |
148 TInt32 aErrorId ) |
155 { |
149 { |
156 TInt32 sysErrorId( KErrNone ); // Global (system-wide) error ID |
150 TInt32 sysErrorId( KErrNone ); // Global (system-wide) error ID |
157 |
151 |
158 // DMgr specific error code. See THttpDownloadMgrError. |
152 // DMgr specific error code. See THttpDownloadMgrError. |
246 break; |
240 break; |
247 } |
241 } |
248 case EHttpRestartFailed: |
242 case EHttpRestartFailed: |
249 { |
243 { |
250 // Show error note by ourself |
244 // Show error note by ourself |
251 HBufC* errorString = |
245 HBufC* errorString = |
252 iCoeEnv.AllocReadResourceLC( R_DMUL_ERROR_START_FROM_BEGINNING ); |
246 iCoeEnv.AllocReadResourceLC( R_DMUL_ERROR_START_FROM_BEGINNING ); |
253 CAknGlobalNote* globalNote = CAknGlobalNote::NewL(); |
247 CAknGlobalNote* globalNote = CAknGlobalNote::NewL(); |
254 CleanupStack::PushL( globalNote ); |
248 CleanupStack::PushL( globalNote ); |
255 globalNote->ShowNoteL( EAknGlobalErrorNote, *errorString ); |
249 globalNote->ShowNoteL( EAknGlobalErrorNote, *errorString ); |
256 CleanupStack::PopAndDestroy( 2, errorString ); // globalNote, errorString |
250 CleanupStack::PopAndDestroy( 2, errorString ); // globalNote, errorString |
289 |
283 |
290 // ----------------------------------------------------------------------------- |
284 // ----------------------------------------------------------------------------- |
291 // CUserInteractionsUtils::IsRecoverableFailL |
285 // CUserInteractionsUtils::IsRecoverableFailL |
292 // ----------------------------------------------------------------------------- |
286 // ----------------------------------------------------------------------------- |
293 // |
287 // |
294 TBool CUserInteractionsUtils::IsRecoverableFailL( RHttpDownload& aDownload, |
288 TBool CUserInteractionsUtils::IsRecoverableFailL( RHttpDownload& aDownload, |
295 TInt32 aErrorId ) const |
289 TInt32 aErrorId ) const |
296 { |
290 { |
297 TBool recoverable( ETrue ); |
291 TBool recoverable( ETrue ); |
298 |
292 |
299 // What is the error? |
293 // What is the error? |
302 // |
296 // |
303 // EDlAttrGlobalErrorId gives the system-wide code. |
297 // EDlAttrGlobalErrorId gives the system-wide code. |
304 TInt32 sysErrorId( 0 ); |
298 TInt32 sysErrorId( 0 ); |
305 User::LeaveIfError( aDownload.GetIntAttribute |
299 User::LeaveIfError( aDownload.GetIntAttribute |
306 ( EDlAttrGlobalErrorId, sysErrorId ) ); |
300 ( EDlAttrGlobalErrorId, sysErrorId ) ); |
307 |
301 |
308 TBool pausable( ETrue ); |
302 TBool pausable( ETrue ); |
309 User::LeaveIfError( aDownload.GetBoolAttribute( EDlAttrPausable, pausable ) ); |
303 User::LeaveIfError( aDownload.GetBoolAttribute( EDlAttrPausable, pausable ) ); |
310 if ( errorId == EObjectNotFound ) |
304 if ( errorId == EObjectNotFound ) |
311 // Other error situations can be added to the list. // |
305 // Other error situations can be added to the list. // |
312 { |
306 { |
313 recoverable = EFalse; |
307 recoverable = EFalse; |
314 } |
308 } |
315 else if ( errorId == ETransactionFailed ) |
309 else if ( errorId == ETransactionFailed ) |
316 { |
310 { |
317 if ( sysErrorId == KBadMimeType || sysErrorId == -20000 || sysErrorId == KErrHttpPartialResponseReceived || !pausable ) |
311 if ( sysErrorId == KBadMimeType || sysErrorId == -20000 || sysErrorId == KErrHttpPartialResponseReceived || !pausable ) |
318 // KBadMimeType and -20000 is from DRMFilter |
312 // KBadMimeType and -20000 is from DRMFilter |
319 // Transaction must be cancelled and download must be deleted |
313 // Transaction must be cancelled and download must be deleted |
320 { |
314 { |
321 recoverable = EFalse; |
315 recoverable = EFalse; |
353 void CUserInteractionsUtils::HandleContentL |
347 void CUserInteractionsUtils::HandleContentL |
354 ( RHttpDownload& aDownload, MDownloadHandlerObserver& aHandlerObserver ) |
348 ( RHttpDownload& aDownload, MDownloadHandlerObserver& aHandlerObserver ) |
355 { |
349 { |
356 CLOG_ENTERFN("CUserInteractionsUtils::HandleContentL"); |
350 CLOG_ENTERFN("CUserInteractionsUtils::HandleContentL"); |
357 |
351 |
358 __ASSERT_DEBUG( !iRegistryModel.UserInteractions().IsUiBusy(), |
352 __ASSERT_DEBUG( !iRegistryModel.UserInteractions().IsUiBusy(), |
359 Panic( EUiLibPanDocHandlerAlreadyRunning ) ); |
353 Panic( EUiLibPanDocHandlerAlreadyRunning ) ); |
360 |
354 |
361 if ( iRegistryModel.UserInteractions().IsUiBusy() ) |
355 if ( iRegistryModel.UserInteractions().IsUiBusy() ) |
362 { |
356 { |
363 CLOG_WRITE(" IsUiBusy() true"); |
357 CLOG_WRITE(" IsUiBusy() true"); |
364 } |
358 } |
365 else |
359 else |
366 { |
360 { |
367 iHandledDownload = &aDownload; |
361 iHandledDownload = &aDownload; |
368 iHandlerObserver = &aHandlerObserver; |
362 iHandlerObserver = &aHandlerObserver; |
369 |
363 |
370 // BEGIN: Get attributes for generic params |
364 // BEGIN: Get attributes for generic params |
371 //========================= |
365 //========================= |
372 // EDlAttrCurrentUrl |
366 // EDlAttrCurrentUrl |
373 //========================= |
367 //========================= |
374 HBufC* url = HBufC::NewLC( KMaxUrlLength ); |
368 HBufC* url = HBufC::NewLC( KMaxUrlLength ); |
375 TPtr urlPtr = url->Des(); |
369 TPtr urlPtr = url->Des(); |
399 if ( !IsDuplicateL( fileNamePtr ) ) |
393 if ( !IsDuplicateL( fileNamePtr ) ) |
400 { |
394 { |
401 HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND); |
395 HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND); |
402 CAknInformationNote* note = new(ELeave) CAknInformationNote(); |
396 CAknInformationNote* note = new(ELeave) CAknInformationNote(); |
403 note->ExecuteLD(*infoPrompt); |
397 note->ExecuteLD(*infoPrompt); |
404 CleanupStack::PopAndDestroy(infoPrompt); |
398 CleanupStack::PopAndDestroy(infoPrompt); |
405 |
399 |
406 CleanupStack::PopAndDestroy( fileName ); // fileName |
400 CleanupStack::PopAndDestroy( fileName ); // fileName |
407 CleanupStack::PopAndDestroy( url ); // url |
401 CleanupStack::PopAndDestroy( url ); // url |
408 return; |
402 return; |
409 } |
403 } |
410 |
404 |
411 //========================= |
405 //========================= |
412 // EDlAttrContentType |
406 // EDlAttrContentType |
486 TAiwVariant fileNameVariant( *fileName ); |
480 TAiwVariant fileNameVariant( *fileName ); |
487 TAiwGenericParam genericParamFileName |
481 TAiwGenericParam genericParamFileName |
488 ( EGenericParamFile, fileNameVariant ); |
482 ( EGenericParamFile, fileNameVariant ); |
489 genericParamList->AppendL( genericParamFileName ); |
483 genericParamList->AppendL( genericParamFileName ); |
490 } |
484 } |
491 |
485 |
492 CLOG_WRITE_FORMAT(" iDocHandler: %x",iDocHandler); |
486 CLOG_WRITE_FORMAT(" iDocHandler: %x",iDocHandler); |
493 delete iDocHandler; |
487 delete iDocHandler; |
494 iDocHandler = 0; |
488 iDocHandler = 0; |
495 iDocHandler = CDocumentHandler::NewL(); |
489 iDocHandler = CDocumentHandler::NewL(); |
496 iDocHandler->SetExitObserver( this ); |
490 iDocHandler->SetExitObserver( this ); |
497 |
491 |
498 RFile file; |
492 RFile file; |
499 iDocHandler->OpenTempFileL( *fileName, file ); |
493 iDocHandler->OpenTempFileL( *fileName, file ); |
500 CleanupClosePushL( file ); |
494 CleanupClosePushL( file ); |
501 |
495 |
502 TDataType dataType( *contentType ); |
496 TDataType dataType( *contentType ); |
503 TInt docErr( KErrNone ); |
497 TInt docErr( KErrNone ); |
504 TInt trappedError( KErrNone ); |
498 TInt trappedError( KErrNone ); |
505 iDocHandlerUsesTheUi = ETrue; |
499 iDocHandlerUsesTheUi = ETrue; |
506 TRAP( trappedError, |
500 TRAP( trappedError, |
507 docErr = iDocHandler->OpenFileEmbeddedL( file, |
501 docErr = iDocHandler->OpenFileEmbeddedL( file, |
508 dataType, |
502 dataType, |
509 *genericParamList ) ); |
503 *genericParamList ) ); |
510 CLOG_WRITE_FORMAT(" trappedError: %d",trappedError); |
504 CLOG_WRITE_FORMAT(" trappedError: %d",trappedError); |
511 CLOG_WRITE_FORMAT(" docErr: %d",docErr); |
505 CLOG_WRITE_FORMAT(" docErr: %d",docErr); |
512 CleanupStack::PopAndDestroy( &file ); // file |
506 CleanupStack::PopAndDestroy( &file ); // file |
513 CLOG_WRITE(" PopAndDestroy file OK"); |
507 CLOG_WRITE(" PopAndDestroy file OK"); |
514 |
508 |
515 if ( trappedError || docErr ) |
509 if ( trappedError || docErr ) |
516 { |
510 { |
517 delete iDocHandler; |
511 delete iDocHandler; |
518 iDocHandler = 0; |
512 iDocHandler = 0; |
519 iDocHandlerUsesTheUi = EFalse; |
513 iDocHandlerUsesTheUi = EFalse; |
520 // Since we know this is an open file error, we should handle it by calling |
514 // Since we know this is an open file error, we should handle it by calling |
521 // ShowErrorNotesL instead of propagating the error |
515 // ShowErrorNotesL instead of propagating the error |
522 if ( trappedError ) |
516 if ( trappedError ) |
523 { |
517 { |
524 ShowErrorNoteL (aDownload, trappedError ); |
518 ShowErrorNoteL (aDownload, trappedError ); |
525 } |
519 } |
526 else |
520 else |
527 { |
521 { |
528 ShowErrorNoteL (aDownload, docErr ); |
522 ShowErrorNoteL (aDownload, docErr ); |
529 } |
523 } |
530 } |
524 } |
531 |
525 |
532 CleanupStack::PopAndDestroy( genericParamList ); // genericParamList |
526 CleanupStack::PopAndDestroy( genericParamList ); // genericParamList |
533 CleanupStack::PopAndDestroy( refererUri ); // refererUri |
527 CleanupStack::PopAndDestroy( refererUri ); // refererUri |
534 CleanupStack::PopAndDestroy( charset ); // charset |
528 CleanupStack::PopAndDestroy( charset ); // charset |
574 HBufC* dlName = HBufC::NewLC( KMaxPath ); |
568 HBufC* dlName = HBufC::NewLC( KMaxPath ); |
575 TPtr dlNamePtr = dlName->Des(); |
569 TPtr dlNamePtr = dlName->Des(); |
576 User::LeaveIfError |
570 User::LeaveIfError |
577 ( aDownload.GetStringAttribute( EDlAttrName, dlNamePtr ) ); |
571 ( aDownload.GetStringAttribute( EDlAttrName, dlNamePtr ) ); |
578 CLOG_WRITE_FORMAT(" EDlAttrName: %S",&dlNamePtr); |
572 CLOG_WRITE_FORMAT(" EDlAttrName: %S",&dlNamePtr); |
579 |
573 |
580 HBufC8* contentType = HBufC8::NewLC( KMaxContentTypeLength ); |
574 HBufC8* contentType = HBufC8::NewLC( KMaxContentTypeLength ); |
581 TPtr8 contentTypePtr = contentType->Des(); |
575 TPtr8 contentTypePtr = contentType->Des(); |
582 User::LeaveIfError |
576 User::LeaveIfError |
583 ( aDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
577 ( aDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) ); |
584 CLOG_WRITE(" EDlAttrContentType OK"); |
578 CLOG_WRITE(" EDlAttrContentType OK"); |
598 dataType, |
592 dataType, |
599 KEntryAttNormal ) ); |
593 KEntryAttNormal ) ); |
600 CLOG_WRITE_FORMAT(" moveErr: %d",moveErr); |
594 CLOG_WRITE_FORMAT(" moveErr: %d",moveErr); |
601 CLOG_WRITE_FORMAT(" moveRet: %d",moveRet); |
595 CLOG_WRITE_FORMAT(" moveRet: %d",moveRet); |
602 |
596 |
603 // Delete DocHandler, otherwise IsUiBusy returns ETrue. |
597 // Delete DocHandler, otherwise IsUiBusy returns ETrue. |
604 delete iDocHandler; |
598 delete iDocHandler; |
605 iDocHandler = 0; |
599 iDocHandler = 0; |
606 iDocHandlerUsesTheUi = EFalse; |
600 iDocHandlerUsesTheUi = EFalse; |
607 CleanupStack::PopAndDestroy( contentType ); // contentType |
601 CleanupStack::PopAndDestroy( contentType ); // contentType |
608 contentType = 0; |
602 contentType = 0; |
609 CleanupStack::PopAndDestroy( dlName ); // dlName |
603 CleanupStack::PopAndDestroy( dlName ); // dlName |
610 dlName = 0; |
604 dlName = 0; |
611 CleanupStack::PopAndDestroy( fileName ); // fileName |
605 CleanupStack::PopAndDestroy( fileName ); // fileName |
612 fileName = 0; |
606 fileName = 0; |
613 |
607 |
614 if( moveRet == KUserCancel ) |
608 if( moveRet == KUserCancel ) |
615 { |
609 { |
616 // The user cancelled the operation. |
610 // The user cancelled the operation. |
617 } |
611 } |
618 else if( moveErr == KErrNone ) |
612 else if( moveErr == KErrNone ) |
649 |
643 |
650 TBool boolRet( EFalse ); |
644 TBool boolRet( EFalse ); |
651 |
645 |
652 // Select memory |
646 // Select memory |
653 iMemSelectionDialog = CAknMemorySelectionDialog::NewL |
647 iMemSelectionDialog = CAknMemorySelectionDialog::NewL |
654 ( ECFDDialogTypeSave, R_DMUL_MEMORY_SELECTION_DLG, |
648 ( ECFDDialogTypeSave, R_DMUL_MEMORY_SELECTION_DLG, |
655 /*aShowUnavailableDrives*/EFalse ); |
649 /*aShowUnavailableDrives*/EFalse ); |
656 CLOG_WRITE(" CAknMemorySelectionDialog::NewL OK"); |
650 CLOG_WRITE(" CAknMemorySelectionDialog::NewL OK"); |
657 CAknMemorySelectionDialog::TMemory mem( CAknMemorySelectionDialog::EPhoneMemory ); |
651 CAknMemorySelectionDialog::TMemory mem( CAknMemorySelectionDialog::EPhoneMemory ); |
658 boolRet = iMemSelectionDialog->ExecuteL( mem ); |
652 boolRet = iMemSelectionDialog->ExecuteL( mem ); |
659 CLOG_WRITE_FORMAT(" MEM boolRet: %d",boolRet); |
653 CLOG_WRITE_FORMAT(" MEM boolRet: %d",boolRet); |
660 delete iMemSelectionDialog; |
654 delete iMemSelectionDialog; |
661 iMemSelectionDialog = 0; |
655 iMemSelectionDialog = 0; |
662 |
656 |
663 if ( boolRet ) |
657 if ( boolRet ) |
664 { |
658 { |
665 CLOG_WRITE_FORMAT(" mem: %d",(TInt)mem); |
659 CLOG_WRITE_FORMAT(" mem: %d",(TInt)mem); |
666 TBool useMmc = (mem == CAknMemorySelectionDialog::EMemoryCard); |
660 TBool useMmc = (mem == CAknMemorySelectionDialog::EMemoryCard); |
667 |
661 |
668 __ASSERT_DEBUG( iFileSelectionDialog == 0, Panic( EUiLibPanNull ) ); // Only one can run |
662 __ASSERT_DEBUG( iFileSelectionDialog == 0, Panic( EUiLibPanNull ) ); // Only one can run |
669 |
663 |
670 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
664 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
671 TPtr fileNamePtr = fileName->Des(); |
665 TPtr fileNamePtr = fileName->Des(); |
672 User::LeaveIfError |
666 User::LeaveIfError |
673 ( aDownload.GetStringAttribute( EDlAttrName, fileNamePtr ) ); |
667 ( aDownload.GetStringAttribute( EDlAttrName, fileNamePtr ) ); |
674 CLOG_WRITE(" EDlAttrName OK"); |
668 CLOG_WRITE(" EDlAttrName OK"); |
675 |
669 |
676 // Select folder |
670 // Select folder |
677 TInt resourceId = useMmc ? R_DMUL_MMC_FILE_SELECTION_DLG : |
671 TInt resourceId = useMmc ? R_DMUL_MMC_FILE_SELECTION_DLG : |
678 R_DMUL_FILE_SELECTION_DLG; |
672 R_DMUL_FILE_SELECTION_DLG; |
679 iFileSelectionDialog = CAknFileSelectionDialog::NewL |
673 iFileSelectionDialog = CAknFileSelectionDialog::NewL |
680 ( ECFDDialogTypeSave, resourceId ); |
674 ( ECFDDialogTypeSave, resourceId ); |
681 CLOG_WRITE(" CAknFileSelectionDialog::NewL OK"); |
675 CLOG_WRITE(" CAknFileSelectionDialog::NewL OK"); |
682 TPath selectedPath( KNullDesC ); |
676 TPath selectedPath( KNullDesC ); |
683 // Execute dialog - it calls CActiveScheduler::Start(), so be careful |
677 // Execute dialog - it calls CActiveScheduler::Start(), so be careful |
684 // when using data members after ExecuteLD! |
678 // when using data members after ExecuteLD! |
685 // TODO introduce deleted, as it uses data after executeld. |
679 // TODO introduce deleted, as it uses data after executeld. |
686 boolRet = iFileSelectionDialog->ExecuteL( selectedPath ); |
680 boolRet = iFileSelectionDialog->ExecuteL( selectedPath ); |
687 CLOG_WRITE_FORMAT(" FILE boolRet: %d",boolRet); |
681 CLOG_WRITE_FORMAT(" FILE boolRet: %d",boolRet); |
688 delete iFileSelectionDialog; |
682 delete iFileSelectionDialog; |
865 // ----------------------------------------------------------------------------- |
859 // ----------------------------------------------------------------------------- |
866 // |
860 // |
867 TBool CUserInteractionsUtils::DeleteWithUserConfirmL( RHttpDownload& aDownload ) |
861 TBool CUserInteractionsUtils::DeleteWithUserConfirmL( RHttpDownload& aDownload ) |
868 { |
862 { |
869 CLOG_ENTERFN("CUserInteractionsUtils::DeleteWithUserConfirmL"); |
863 CLOG_ENTERFN("CUserInteractionsUtils::DeleteWithUserConfirmL"); |
870 |
864 |
871 TInt32 numMediaObjects(0); |
865 TInt32 numMediaObjects(0); |
872 aDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ); |
866 aDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ); |
873 |
867 |
874 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
868 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
875 TPtr fileNamePtr = fileName->Des(); |
869 TPtr fileNamePtr = fileName->Des(); |
876 |
870 |
877 // In case of album, show the album name. Otherwise show file name. |
871 // In case of album, show the album name. Otherwise show file name. |
878 TInt err(KErrNone); |
872 TInt err(KErrNone); |
879 if (numMediaObjects > 1) |
873 if (numMediaObjects > 1) |
880 { |
874 { |
881 err = aDownload.GetStringAttribute( EDlAttrAlbumName, fileNamePtr ); |
875 err = aDownload.GetStringAttribute( EDlAttrAlbumName, fileNamePtr ); |
882 } |
876 } |
883 else |
877 else |
884 { |
878 { |
885 err = aDownload.GetStringAttribute( EDlAttrName, fileNamePtr ); |
879 err = aDownload.GetStringAttribute( EDlAttrName, fileNamePtr ); |
886 } |
880 } |
887 |
881 |
888 if ( err != KErrNone && err != KErrNotFound ) |
882 if ( err != KErrNone && err != KErrNotFound ) |
889 { |
883 { |
890 User::LeaveIfError( err ); |
884 User::LeaveIfError( err ); |
891 } |
885 } |
892 TBool fileNameSet = ( err == KErrNone ); |
886 TBool fileNameSet = ( err == KErrNone ); |
897 |
891 |
898 HBufC* prompt = StringLoader::LoadLC( R_DMUL_DOWNLOAD_DEL_CONF, *fileName ); |
892 HBufC* prompt = StringLoader::LoadLC( R_DMUL_DOWNLOAD_DEL_CONF, *fileName ); |
899 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
893 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
900 delete iDeleteConfirmDlg; |
894 delete iDeleteConfirmDlg; |
901 iDeleteConfirmDlg = dlg; |
895 iDeleteConfirmDlg = dlg; |
902 // Execute dialog - it calls CActiveScheduler::Start(), so be careful |
896 // Execute dialog - it calls CActiveScheduler::Start(), so be careful |
903 // when using data members after ExecuteLD! |
897 // when using data members after ExecuteLD! |
904 TInt resp = iDeleteConfirmDlg->ExecuteLD |
898 TInt resp = iDeleteConfirmDlg->ExecuteLD |
905 ( R_DMUL_DOWNLOAD_YESNO_CONF_Q, *prompt ); |
899 ( R_DMUL_DOWNLOAD_YESNO_CONF_Q, *prompt ); |
906 iDeleteConfirmDlg = 0; |
900 iDeleteConfirmDlg = 0; |
907 CleanupStack::PopAndDestroy( 2, fileName ); // prompt, fileName |
901 CleanupStack::PopAndDestroy( 2, fileName ); // prompt, fileName |
908 |
902 |
909 if ( resp ) // We have to check only that the value is non-zero |
903 if ( resp ) // We have to check only that the value is non-zero |
910 { |
904 { |
911 |
905 |
912 aDownload.GetBoolAttribute( EDlAttrCodDownload,iCodDownload ); |
906 aDownload.GetBoolAttribute( EDlAttrCodDownload,iCodDownload ); |
913 |
907 |
914 |
908 |
915 if(iCodDownload) |
909 if(iCodDownload) |
916 { |
910 { |
917 |
911 |
918 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
912 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
919 CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL( |
913 CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL( |
920 CEikonEnv::Static()->FsSession() ); |
914 CEikonEnv::Static()->FsSession() ); |
921 |
915 |
922 #endif |
916 #endif |
923 |
917 |
924 //Assume that all files to be deleted are valid. |
918 //Assume that all files to be deleted are valid. |
925 TBool fileNotFound = EFalse; |
919 TBool fileNotFound = EFalse; |
926 |
920 |
927 for(TInt i = 1; i <= numMediaObjects; i++) |
921 for(TInt i = 1; i <= numMediaObjects; i++) |
928 { |
922 { |
929 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
923 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
930 TPtr fileNamePtr = fileName->Des(); |
924 TPtr fileNamePtr = fileName->Des(); |
931 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename,i,fileNamePtr )); |
925 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename,i,fileNamePtr )); |
932 RFs rfs; |
926 RFs rfs; |
933 User::LeaveIfError( rfs.Connect() ); |
927 User::LeaveIfError( rfs.Connect() ); |
934 CleanupClosePushL<RFs>( rfs ); |
928 CleanupClosePushL<RFs>( rfs ); |
935 TFindFile file(rfs); |
929 TFindFile file(rfs); |
936 TPtrC ptr(KNullDesC); |
930 TPtrC ptr(KNullDesC); |
952 } |
946 } |
953 else |
947 else |
954 { |
948 { |
955 TRAP_IGNORE( mgFileManager->UpdateL() ); |
949 TRAP_IGNORE( mgFileManager->UpdateL() ); |
956 } |
950 } |
957 |
951 |
958 #else |
952 #else |
959 if( fileNamePtr.Length() > 0 ) |
953 if( fileNamePtr.Length() > 0 ) |
960 { |
954 { |
961 TRAP_IGNORE( UpdateDCFRepositoryL( fileNamePtr ) ); |
955 TRAP_IGNORE( UpdateDCFRepositoryL( fileNamePtr ) ); |
962 } |
956 } |
963 |
957 |
964 #endif |
958 #endif |
965 |
959 |
966 CleanupStack::PopAndDestroy( &rfs ); |
960 CleanupStack::PopAndDestroy( &rfs ); |
967 CleanupStack::PopAndDestroy( fileName ); |
961 CleanupStack::PopAndDestroy( fileName ); |
968 } |
962 } |
969 |
963 |
970 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
964 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
971 delete mgFileManager; |
965 delete mgFileManager; |
972 mgFileManager = NULL; |
966 mgFileManager = NULL; |
973 #endif |
967 #endif |
974 |
968 |
975 //Inform the user that atleast one file not found. |
969 //Inform the user that atleast one file not found. |
976 if(fileNotFound) |
970 if(fileNotFound) |
977 { |
971 { |
978 HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND); |
972 HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND); |
979 CAknInformationNote* note = new(ELeave) CAknInformationNote(); |
973 CAknInformationNote* note = new(ELeave) CAknInformationNote(); |
980 note->ExecuteLD(*infoPrompt); |
974 note->ExecuteLD(*infoPrompt); |
981 CleanupStack::PopAndDestroy(infoPrompt); |
975 CleanupStack::PopAndDestroy(infoPrompt); |
982 } |
976 } |
983 } |
977 } |
984 |
978 |
985 User::LeaveIfError( aDownload.Delete() ); |
979 User::LeaveIfError( aDownload.Delete() ); |
986 CLOG_LEAVEFN("CUserInteractionsUtils::DeleteWithUserConfirmL"); |
980 CLOG_LEAVEFN("CUserInteractionsUtils::DeleteWithUserConfirmL"); |
987 return ETrue; // Deleted |
981 return ETrue; // Deleted |
988 } |
982 } |
989 else |
983 else |
1011 // ----------------------------------------------------------------------------- |
1005 // ----------------------------------------------------------------------------- |
1012 // |
1006 // |
1013 TBool CUserInteractionsUtils::CancelWithUserConfirmL( RHttpDownload& aDownload ) |
1007 TBool CUserInteractionsUtils::CancelWithUserConfirmL( RHttpDownload& aDownload ) |
1014 { |
1008 { |
1015 CLOG_ENTERFN("CUserInteractionsUtils::CancelWithUserConfirmL"); |
1009 CLOG_ENTERFN("CUserInteractionsUtils::CancelWithUserConfirmL"); |
1016 |
1010 |
1017 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
1011 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
1018 TPtr fileNamePtr = fileName->Des(); |
1012 TPtr fileNamePtr = fileName->Des(); |
1019 TInt err = aDownload.GetStringAttribute( EDlAttrName, fileNamePtr ); |
1013 TInt err = aDownload.GetStringAttribute( EDlAttrName, fileNamePtr ); |
1020 if ( err != KErrNone && err != KErrNotFound ) |
1014 if ( err != KErrNone && err != KErrNotFound ) |
1021 { |
1015 { |
1029 |
1023 |
1030 HBufC* prompt = StringLoader::LoadLC( R_DMUL_DOWNLOAD_CAN_CONF, *fileName ); |
1024 HBufC* prompt = StringLoader::LoadLC( R_DMUL_DOWNLOAD_CAN_CONF, *fileName ); |
1031 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
1025 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
1032 delete iCancelConfirmDlg; |
1026 delete iCancelConfirmDlg; |
1033 iCancelConfirmDlg = dlg; |
1027 iCancelConfirmDlg = dlg; |
1034 // Execute dialog - it calls CActiveScheduler::Start(), so be careful |
1028 // Execute dialog - it calls CActiveScheduler::Start(), so be careful |
1035 // when using data members after ExecuteLD! |
1029 // when using data members after ExecuteLD! |
1036 TInt resp = iCancelConfirmDlg->ExecuteLD |
1030 TInt resp = iCancelConfirmDlg->ExecuteLD |
1037 ( R_DMUL_DOWNLOAD_YESNO_CONF_Q, *prompt ); |
1031 ( R_DMUL_DOWNLOAD_YESNO_CONF_Q, *prompt ); |
1038 iCancelConfirmDlg = 0; |
1032 iCancelConfirmDlg = 0; |
1039 CleanupStack::PopAndDestroy( 2, fileName ); // prompt, fileName |
1033 CleanupStack::PopAndDestroy( 2, fileName ); // prompt, fileName |
1062 |
1056 |
1063 HBufC* prompt = StringLoader::LoadLC( R_DMUL_EXIT_CONF_PLUR ); |
1057 HBufC* prompt = StringLoader::LoadLC( R_DMUL_EXIT_CONF_PLUR ); |
1064 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
1058 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
1065 delete iCancelConfirmDlg; |
1059 delete iCancelConfirmDlg; |
1066 iCancelConfirmDlg = dlg; |
1060 iCancelConfirmDlg = dlg; |
1067 // Execute dialog - it calls CActiveScheduler::Start(), so be careful |
1061 // Execute dialog - it calls CActiveScheduler::Start(), so be careful |
1068 // when using data members after ExecuteLD! |
1062 // when using data members after ExecuteLD! |
1069 TInt resp = iCancelConfirmDlg->ExecuteLD |
1063 TInt resp = iCancelConfirmDlg->ExecuteLD |
1070 ( R_DMUL_DOWNLOAD_YESNO_CONF_Q, *prompt ); |
1064 ( R_DMUL_DOWNLOAD_YESNO_CONF_Q, *prompt ); |
1071 iCancelConfirmDlg = 0; |
1065 iCancelConfirmDlg = 0; |
1072 CleanupStack::PopAndDestroy(); // prompt |
1066 CleanupStack::PopAndDestroy(); // prompt |
1073 |
1067 |
1074 if ( resp ) // We have to check only that the value is non-zero |
1068 if ( resp ) // We have to check only that the value is non-zero |
1075 { |
1069 { |
1076 TInt count = iRegistryModel.DownloadMgr().CurrentDownloads().Count(); |
1070 TInt count = iRegistryModel.DownloadMgr().CurrentDownloads().Count(); |
1077 TInt32 dlState; |
1071 TInt32 dlState; |
1078 TInt i = 0; |
1072 TInt i = 0; |
1132 CLOG_ENTERFN("CUserInteractionsUtils::ShowMediaRemovedNoteL"); |
1126 CLOG_ENTERFN("CUserInteractionsUtils::ShowMediaRemovedNoteL"); |
1133 if ( iMediaRemovedNote == 0 ) |
1127 if ( iMediaRemovedNote == 0 ) |
1134 { |
1128 { |
1135 HBufC* value = iCoeEnv.AllocReadResourceLC |
1129 HBufC* value = iCoeEnv.AllocReadResourceLC |
1136 ( R_DMUL_ERROR_EXT_MEM_REMOVED ); |
1130 ( R_DMUL_ERROR_EXT_MEM_REMOVED ); |
1137 iMediaRemovedNote = |
1131 iMediaRemovedNote = |
1138 new (ELeave) CAknInformationNote( &iMediaRemovedNote ); |
1132 new (ELeave) CAknInformationNote( &iMediaRemovedNote ); |
1139 iMediaRemovedNote->ExecuteLD( *value ); |
1133 iMediaRemovedNote->ExecuteLD( *value ); |
1140 CleanupStack::PopAndDestroy( value ); // value |
1134 CleanupStack::PopAndDestroy( value ); // value |
1141 } |
1135 } |
1142 CLOG_LEAVEFN("CUserInteractionsUtils::ShowMediaRemovedNoteL"); |
1136 CLOG_LEAVEFN("CUserInteractionsUtils::ShowMediaRemovedNoteL"); |
1197 User::LeaveIfError( getErr ); |
1191 User::LeaveIfError( getErr ); |
1198 } |
1192 } |
1199 |
1193 |
1200 // Execute a wait dialog |
1194 // Execute a wait dialog |
1201 TBool resp = iDialogsProv->DialogUserAuthenticationLC |
1195 TBool resp = iDialogsProv->DialogUserAuthenticationLC |
1202 ( *url, *realm, *userName, username, password, |
1196 ( *url, *realm, *userName, username, password, |
1203 authScheme == EAuthBasic ); |
1197 authScheme == EAuthBasic ); |
1204 |
1198 |
1205 if ( resp ) |
1199 if ( resp ) |
1206 { |
1200 { |
1207 if ( authScheme == EAuthBasic && BrowserSettingSecWarningL() ) |
1201 if ( authScheme == EAuthBasic && BrowserSettingSecWarningL() ) |
1259 User::LeaveIfError( aDownload.GetStringAttribute |
1253 User::LeaveIfError( aDownload.GetStringAttribute |
1260 ( EDlAttrProxyRealm, realmPtr ) ); |
1254 ( EDlAttrProxyRealm, realmPtr ) ); |
1261 |
1255 |
1262 // Execute a wait dialog |
1256 // Execute a wait dialog |
1263 TBool resp = iDialogsProv->DialogUserAuthenticationLC |
1257 TBool resp = iDialogsProv->DialogUserAuthenticationLC |
1264 ( *url, *realm, *userName, username, password, |
1258 ( *url, *realm, *userName, username, password, |
1265 authScheme == EAuthBasic ); |
1259 authScheme == EAuthBasic ); |
1266 |
1260 |
1267 if ( resp ) |
1261 if ( resp ) |
1268 { |
1262 { |
1269 if ( authScheme == EAuthBasic && BrowserSettingSecWarningL() ) |
1263 if ( authScheme == EAuthBasic && BrowserSettingSecWarningL() ) |
1337 } |
1331 } |
1338 } |
1332 } |
1339 |
1333 |
1340 // ----------------------------------------------------------------------------- |
1334 // ----------------------------------------------------------------------------- |
1341 // CUserInteractionsUtils::BrowserSettingSecWarningL |
1335 // CUserInteractionsUtils::BrowserSettingSecWarningL |
1342 // This method must behave the same as |
1336 // This method must behave the same as |
1343 // CBrowserSettings::GetHttpSecurityWarnings(). |
1337 // CBrowserSettings::GetHttpSecurityWarnings(). |
1344 // See CBrowserSettings ! |
1338 // See CBrowserSettings ! |
1345 // ----------------------------------------------------------------------------- |
1339 // ----------------------------------------------------------------------------- |
1346 // |
1340 // |
1347 TBool CUserInteractionsUtils::BrowserSettingSecWarningL() |
1341 TBool CUserInteractionsUtils::BrowserSettingSecWarningL() |
1352 |
1346 |
1353 // ----------------------------------------------------------------------------- |
1347 // ----------------------------------------------------------------------------- |
1354 // CUserInteractionsUtils::InitializeSoftNotifStndL |
1348 // CUserInteractionsUtils::InitializeSoftNotifStndL |
1355 // ----------------------------------------------------------------------------- |
1349 // ----------------------------------------------------------------------------- |
1356 // |
1350 // |
1357 void CUserInteractionsUtils::InitializeSoftNotifStndL( TVwsViewId aViewId, |
1351 void CUserInteractionsUtils::InitializeSoftNotifStndL( TVwsViewId aViewId, |
1358 TUid aCustomMessageId, |
1352 TUid aCustomMessageId, |
1359 const TDesC8& aViewActivationMsg ) const |
1353 const TDesC8& aViewActivationMsg ) const |
1360 { |
1354 { |
1361 CLOG_ENTERFN("CUserInteractionsUtils::InitializeSoftNotifStndL"); |
1355 CLOG_ENTERFN("CUserInteractionsUtils::InitializeSoftNotifStndL"); |
1362 |
1356 |
1363 CAknSoftNotificationParameters* params = |
1357 CAknSoftNotificationParameters* params = |
1364 CAknSoftNotificationParameters::NewL |
1358 CAknSoftNotificationParameters::NewL |
1365 ( |
1359 ( |
1366 iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_STND, KMinimumSoftNotePriority, |
1360 iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_STND, KMinimumSoftNotePriority, |
1367 R_AVKON_SOFTKEYS_YES_NO__YES, |
1361 R_AVKON_SOFTKEYS_YES_NO__YES, |
1368 CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, |
1362 CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, |
1369 EAknSoftkeyYes, aViewActivationMsg |
1363 EAknSoftkeyYes, aViewActivationMsg |
1370 ); |
1364 ); |
1371 CLOG_WRITE(" params OK"); |
1365 CLOG_WRITE(" params OK"); |
1372 CleanupStack::PushL( params ); |
1366 CleanupStack::PushL( params ); |
1373 |
1367 |
1374 iSoftNotifier->AddCustomNotificationL( *params ); |
1368 iSoftNotifier->AddCustomNotificationL( *params ); |
1380 |
1374 |
1381 // ----------------------------------------------------------------------------- |
1375 // ----------------------------------------------------------------------------- |
1382 // CUserInteractionsUtils::InitializeSoftNotifEmbL |
1376 // CUserInteractionsUtils::InitializeSoftNotifEmbL |
1383 // ----------------------------------------------------------------------------- |
1377 // ----------------------------------------------------------------------------- |
1384 // |
1378 // |
1385 void CUserInteractionsUtils::InitializeSoftNotifEmbL( TVwsViewId aViewId, |
1379 void CUserInteractionsUtils::InitializeSoftNotifEmbL( TVwsViewId aViewId, |
1386 TUid aCustomMessageId, |
1380 TUid aCustomMessageId, |
1387 const TDesC8& aViewActivationMsg ) const |
1381 const TDesC8& aViewActivationMsg ) const |
1388 { |
1382 { |
1389 CLOG_ENTERFN("CUserInteractionsUtils::InitializeSoftNotifEmbL"); |
1383 CLOG_ENTERFN("CUserInteractionsUtils::InitializeSoftNotifEmbL"); |
1390 |
1384 |
1391 CAknSoftNotificationParameters* params = |
1385 CAknSoftNotificationParameters* params = |
1392 CAknSoftNotificationParameters::NewL |
1386 CAknSoftNotificationParameters::NewL |
1393 ( |
1387 ( |
1394 iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_EMB, KMinimumSoftNotePriority, |
1388 iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_EMB, KMinimumSoftNotePriority, |
1395 R_AVKON_SOFTKEYS_YES_NO__YES, |
1389 R_AVKON_SOFTKEYS_YES_NO__YES, |
1396 CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, |
1390 CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, |
1397 EAknSoftkeyYes, aViewActivationMsg |
1391 EAknSoftkeyYes, aViewActivationMsg |
1398 ); |
1392 ); |
1399 CLOG_WRITE(" params OK"); |
1393 CLOG_WRITE(" params OK"); |
1400 CleanupStack::PushL( params ); |
1394 CleanupStack::PushL( params ); |
1401 |
1395 |
1402 iSoftNotifier->AddCustomNotificationL( *params ); |
1396 iSoftNotifier->AddCustomNotificationL( *params ); |
1408 |
1402 |
1409 // ----------------------------------------------------------------------------- |
1403 // ----------------------------------------------------------------------------- |
1410 // CUserInteractionsUtils::CancelSoftNotifStndL |
1404 // CUserInteractionsUtils::CancelSoftNotifStndL |
1411 // ----------------------------------------------------------------------------- |
1405 // ----------------------------------------------------------------------------- |
1412 // |
1406 // |
1413 void CUserInteractionsUtils::CancelSoftNotifStndL( TVwsViewId aViewId, |
1407 void CUserInteractionsUtils::CancelSoftNotifStndL( TVwsViewId aViewId, |
1414 TUid aCustomMessageId, |
1408 TUid aCustomMessageId, |
1415 const TDesC8& aViewActivationMsg ) const |
1409 const TDesC8& aViewActivationMsg ) const |
1416 { |
1410 { |
1417 CLOG_ENTERFN("CUserInteractionsUtils::CancelSoftNotifStndL"); |
1411 CLOG_ENTERFN("CUserInteractionsUtils::CancelSoftNotifStndL"); |
1418 |
1412 |
1419 CAknSoftNotificationParameters* params = |
1413 CAknSoftNotificationParameters* params = |
1420 CAknSoftNotificationParameters::NewL |
1414 CAknSoftNotificationParameters::NewL |
1421 ( |
1415 ( |
1422 iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_STND, KMinimumSoftNotePriority, |
1416 iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_STND, KMinimumSoftNotePriority, |
1423 R_AVKON_SOFTKEYS_YES_NO__YES, |
1417 R_AVKON_SOFTKEYS_YES_NO__YES, |
1424 CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, |
1418 CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, |
1425 EAknSoftkeyYes, aViewActivationMsg |
1419 EAknSoftkeyYes, aViewActivationMsg |
1426 ); |
1420 ); |
1427 CLOG_WRITE(" params OK"); |
1421 CLOG_WRITE(" params OK"); |
1428 CleanupStack::PushL( params ); |
1422 CleanupStack::PushL( params ); |
1429 |
1423 |
1430 //TODO From avkon sources it seems that it identifies the soft notification |
1424 //TODO From avkon sources it seems that it identifies the soft notification |
1431 // with the AVKON_NOTE resource ID, which is the same in case of |
1425 // with the AVKON_NOTE resource ID, which is the same in case of |
1432 // all UI Lib clients!! |
1426 // all UI Lib clients!! |
1433 iSoftNotifier->CancelCustomSoftNotificationL( *params ); |
1427 iSoftNotifier->CancelCustomSoftNotificationL( *params ); |
1434 |
1428 |
1435 CleanupStack::PopAndDestroy( params ); // params |
1429 CleanupStack::PopAndDestroy( params ); // params |
1436 |
1430 |
1439 |
1433 |
1440 // ----------------------------------------------------------------------------- |
1434 // ----------------------------------------------------------------------------- |
1441 // CUserInteractionsUtils::CancelSoftNotifEmbL |
1435 // CUserInteractionsUtils::CancelSoftNotifEmbL |
1442 // ----------------------------------------------------------------------------- |
1436 // ----------------------------------------------------------------------------- |
1443 // |
1437 // |
1444 void CUserInteractionsUtils::CancelSoftNotifEmbL( TVwsViewId aViewId, |
1438 void CUserInteractionsUtils::CancelSoftNotifEmbL( TVwsViewId aViewId, |
1445 TUid aCustomMessageId, |
1439 TUid aCustomMessageId, |
1446 const TDesC8& aViewActivationMsg ) const |
1440 const TDesC8& aViewActivationMsg ) const |
1447 { |
1441 { |
1448 CLOG_ENTERFN("CUserInteractionsUtils::CancelSoftNotifEmbL"); |
1442 CLOG_ENTERFN("CUserInteractionsUtils::CancelSoftNotifEmbL"); |
1449 |
1443 |
1450 CAknSoftNotificationParameters* params = |
1444 CAknSoftNotificationParameters* params = |
1451 CAknSoftNotificationParameters::NewL |
1445 CAknSoftNotificationParameters::NewL |
1452 ( |
1446 ( |
1453 iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_EMB, KMinimumSoftNotePriority, |
1447 iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_EMB, KMinimumSoftNotePriority, |
1454 R_AVKON_SOFTKEYS_YES_NO__YES, |
1448 R_AVKON_SOFTKEYS_YES_NO__YES, |
1455 CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, |
1449 CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, |
1456 EAknSoftkeyYes, aViewActivationMsg |
1450 EAknSoftkeyYes, aViewActivationMsg |
1457 ); |
1451 ); |
1458 CLOG_WRITE(" params OK"); |
1452 CLOG_WRITE(" params OK"); |
1459 CleanupStack::PushL( params ); |
1453 CleanupStack::PushL( params ); |
1460 |
1454 |
1461 iSoftNotifier->CancelCustomSoftNotificationL( *params ); |
1455 iSoftNotifier->CancelCustomSoftNotificationL( *params ); |
1482 CancelDeleteConfirmationDialog(); |
1476 CancelDeleteConfirmationDialog(); |
1483 CancelCancelConfirmationDialog(); |
1477 CancelCancelConfirmationDialog(); |
1484 CancelMediaRemovedNote(); |
1478 CancelMediaRemovedNote(); |
1485 CancelCredentialsQueries(); |
1479 CancelCredentialsQueries(); |
1486 CancelSecurityWarning(); |
1480 CancelSecurityWarning(); |
1487 // The soft notifications should not be cancelled here, |
1481 // The soft notifications should not be cancelled here, |
1488 // because they are used in a different context. |
1482 // because they are used in a different context. |
1489 } |
1483 } |
1490 |
1484 |
1491 // ----------------------------------------------------------------------------- |
1485 // ----------------------------------------------------------------------------- |
1492 // CUserInteractionsUtils::InfoNoteL |
1486 // CUserInteractionsUtils::InfoNoteL |
1504 // ----------------------------------------------------------------------------- |
1498 // ----------------------------------------------------------------------------- |
1505 // |
1499 // |
1506 void CUserInteractionsUtils::InfoNoteL( TInt aDialogResourceId, const TDesC& aPrompt ) |
1500 void CUserInteractionsUtils::InfoNoteL( TInt aDialogResourceId, const TDesC& aPrompt ) |
1507 { |
1501 { |
1508 CLOG_ENTERFN("CUserInteractionsUtils::InfoNoteL"); |
1502 CLOG_ENTERFN("CUserInteractionsUtils::InfoNoteL"); |
1509 |
1503 |
1510 CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog |
1504 CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog |
1511 ( REINTERPRET_CAST( CEikDialog**, &dialog ) ); |
1505 ( REINTERPRET_CAST( CEikDialog**, &dialog ) ); |
1512 CLOG_WRITE(" new"); |
1506 CLOG_WRITE(" new"); |
1513 dialog->PrepareLC( aDialogResourceId ) ; |
1507 dialog->PrepareLC( aDialogResourceId ) ; |
1514 CLOG_WRITE(" PrepareLC"); |
1508 CLOG_WRITE(" PrepareLC"); |
1515 dialog->SetCurrentLabelL( EGeneralNote, aPrompt ); |
1509 dialog->SetCurrentLabelL( EGeneralNote, aPrompt ); |
1516 CLOG_WRITE(" SetCurrentLabelL"); |
1510 CLOG_WRITE(" SetCurrentLabelL"); |
1517 dialog->RunDlgLD( CAknNoteDialog::ELongTimeout, CAknNoteDialog::ENoTone ); |
1511 dialog->RunDlgLD( CAknNoteDialog::ELongTimeout, CAknNoteDialog::ENoTone ); |
1518 |
1512 |
1519 CLOG_LEAVEFN("CUserInteractionsUtils::InfoNoteL"); |
1513 CLOG_LEAVEFN("CUserInteractionsUtils::InfoNoteL"); |
1520 } |
1514 } |
1521 |
1515 |
1522 // ----------------------------------------------------------------------------- |
1516 // ----------------------------------------------------------------------------- |
1523 // CUserInteractionsUtils::IsUiBusy |
1517 // CUserInteractionsUtils::IsUiBusy |
1569 |
1563 |
1570 DRMCommon::TContentProtection prot; |
1564 DRMCommon::TContentProtection prot; |
1571 HBufC8* mimeType = 0; |
1565 HBufC8* mimeType = 0; |
1572 HBufC8* contentURI = 0; |
1566 HBufC8* contentURI = 0; |
1573 TUint dataLength = 0; |
1567 TUint dataLength = 0; |
1574 TInt err = drmCommon->GetFileInfo( *fileName, |
1568 TInt err = drmCommon->GetFileInfo( *fileName, |
1575 prot, mimeType, contentURI, dataLength ); |
1569 prot, mimeType, contentURI, dataLength ); |
1576 |
1570 |
1577 if ( err == DRMCommon::EVersionNotSupported || |
1571 if ( err == DRMCommon::EVersionNotSupported || |
1578 ( err == DRMCommon::EOk && ( !mimeType || !contentURI ) ) ) |
1572 ( err == DRMCommon::EOk && ( !mimeType || !contentURI ) ) ) |
1579 { |
1573 { |
1580 isCorruptedDcf = ETrue; |
1574 isCorruptedDcf = ETrue; |
1581 } |
1575 } |
1582 |
1576 |
1583 delete mimeType; |
1577 delete mimeType; |
1584 delete contentURI; |
1578 delete contentURI; |
1585 CleanupStack::PopAndDestroy( fileName ); |
1579 CleanupStack::PopAndDestroy( fileName ); |
1586 CleanupStack::PopAndDestroy( drmCommon ); |
1580 CleanupStack::PopAndDestroy( drmCommon ); |
1587 |
1581 |
1614 |
1608 |
1615 DRMCommon::TContentProtection prot; |
1609 DRMCommon::TContentProtection prot; |
1616 HBufC8* mimeType = 0; |
1610 HBufC8* mimeType = 0; |
1617 HBufC8* contentURI = 0; |
1611 HBufC8* contentURI = 0; |
1618 TUint dataLength = 0; |
1612 TUint dataLength = 0; |
1619 TInt err = drmCommon->GetFileInfo( *fileName, |
1613 TInt err = drmCommon->GetFileInfo( *fileName, |
1620 prot, mimeType, contentURI, dataLength ); |
1614 prot, mimeType, contentURI, dataLength ); |
1621 |
1615 |
1622 if ( err == DRMCommon::EOk ) |
1616 if ( err == DRMCommon::EOk ) |
1623 { |
1617 { |
1624 if ( !mimeType || !contentURI ) |
1618 if ( !mimeType || !contentURI ) |
1625 { |
1619 { |
1626 isBadMimeInDcfL = ETrue; |
1620 isBadMimeInDcfL = ETrue; |
1655 iHandledDownload = 0; |
1649 iHandledDownload = 0; |
1656 } |
1650 } |
1657 CLOG_LEAVEFN("CUserInteractionsUtils::DownloadHasBeenDeleted"); |
1651 CLOG_LEAVEFN("CUserInteractionsUtils::DownloadHasBeenDeleted"); |
1658 } |
1652 } |
1659 |
1653 |
1660 |
1654 |
1661 // ----------------------------------------------------------------------------- |
1655 // ----------------------------------------------------------------------------- |
1662 // CUserInteractionsUtils::LaunchPdAppL |
1656 // CUserInteractionsUtils::LaunchPdAppL |
1663 // ----------------------------------------------------------------------------- |
1657 // ----------------------------------------------------------------------------- |
1664 // |
1658 // |
1665 void CUserInteractionsUtils::LaunchPdAppL( RHttpDownload& aDownload, const TBool aProgressively ) |
1659 void CUserInteractionsUtils::LaunchPdAppL( RHttpDownload& aDownload, const TBool aProgressively ) |
1666 { |
1660 { |
1667 CLOG_ENTERFN("CUserInteractionsEventHandler::LaunchPdAppL"); |
1661 CLOG_ENTERFN("CUserInteractionsEventHandler::LaunchPdAppL"); |
1668 |
1662 |
1669 // Get the PD player application's UID for the download |
1663 // Get the PD player application's UID for the download |
1670 TUid pdPlayerUid = { 0 }; |
1664 TUid pdPlayerUid = { 0 }; |
1671 HBufC8* contentType = ContentTypeL( aDownload, ETrue, KFirstMoIndex ); |
1665 HBufC8* contentType = ContentTypeL( aDownload, ETrue, KFirstMoIndex ); |
1672 TDataType dataType( *contentType ); |
1666 TDataType dataType( *contentType ); |
1673 delete contentType; |
1667 delete contentType; |
1674 contentType = NULL; |
1668 contentType = NULL; |
1675 |
1669 |
1676 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
1670 CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
1677 TBool pdSupported = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); |
1671 TBool pdSupported = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); |
1678 CleanupStack::PopAndDestroy( docHandler ); // docHandler |
1672 CleanupStack::PopAndDestroy( docHandler ); // docHandler |
1679 |
1673 |
1680 if ( pdSupported ) |
1674 if ( pdSupported ) |
1681 { |
1675 { |
1682 |
|
1683 TInt downloadCnt = iRegistryModel.DownloadCount(); |
|
1684 TBool isProg(EFalse); |
|
1685 |
|
1686 const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads(); |
|
1687 |
|
1688 for ( TInt i = 0; i < downloadCnt ;i++ ) |
|
1689 { |
|
1690 RHttpDownload* dl = downloads.At(i); //current download |
|
1691 dl->GetBoolAttribute( EDlAttrProgressive, isProg ); |
|
1692 if (isProg ) |
|
1693 { |
|
1694 dl->SetBoolAttribute( EDlAttrProgressive, EFalse ); |
|
1695 } |
|
1696 } |
|
1697 |
|
1698 TInt32 numMediaObjects = 0; |
1676 TInt32 numMediaObjects = 0; |
1699 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ) ); |
1677 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ) ); |
1700 |
1678 |
1701 // Pack download ID into EGenericParamDownloadId. |
1679 // Pack download ID into EGenericParamDownloadId. |
1702 TInt32 downloadID( -1 ); |
1680 TInt32 downloadID( -1 ); |
1703 TInt32 activeDownloadID(-1); |
1681 TInt32 activeDownloadID(-1); |
1704 if ( aProgressively ) |
1682 if ( aProgressively ) |
1705 { |
1683 { |
1706 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrId, downloadID ) ); |
1684 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrId, downloadID ) ); |
1707 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, activeDownloadID ) ); |
1685 User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, activeDownloadID ) ); |
1708 } |
1686 } |
1709 |
1687 |
1710 |
1688 |
1711 CAiwGenericParamList* genParList = CAiwGenericParamList::NewLC(); |
1689 CAiwGenericParamList* genParList = CAiwGenericParamList::NewLC(); |
1712 TAiwVariant downloadIdVariant( downloadID ); |
1690 TAiwVariant downloadIdVariant( downloadID ); |
1713 TAiwGenericParam genericParam( EGenericParamDownloadId, downloadIdVariant ); |
1691 TAiwGenericParam genericParam( EGenericParamDownloadId, downloadIdVariant ); |
1714 genParList->AppendL( genericParam ); |
1692 genParList->AppendL( genericParam ); |
1715 |
1693 |
1719 // Get first track's name in case of album |
1697 // Get first track's name in case of album |
1720 if (numMediaObjects > KFirstMoIndex) |
1698 if (numMediaObjects > KFirstMoIndex) |
1721 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename, KFirstMoIndex, fileNamePtr ) ); |
1699 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename, KFirstMoIndex, fileNamePtr ) ); |
1722 else |
1700 else |
1723 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
1701 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
1724 |
1702 |
1725 // check if file exists, if does not , don't continue |
1703 // check if file exists, if does not , don't continue |
1726 if ( !IsDuplicateL( fileNamePtr ) ) |
1704 if ( !IsDuplicateL( fileNamePtr ) ) |
1727 { |
1705 { |
1728 HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND); |
1706 HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND); |
1729 CAknInformationNote* note = new(ELeave) CAknInformationNote(); |
1707 CAknInformationNote* note = new(ELeave) CAknInformationNote(); |
1730 note->ExecuteLD(*infoPrompt); |
1708 note->ExecuteLD(*infoPrompt); |
1731 CleanupStack::PopAndDestroy(infoPrompt); |
1709 CleanupStack::PopAndDestroy(infoPrompt); |
1732 |
1710 |
1733 CleanupStack::PopAndDestroy( fileName ); |
1711 CleanupStack::PopAndDestroy( fileName ); |
1734 CleanupStack::PopAndDestroy( genParList ); |
1712 CleanupStack::PopAndDestroy( genParList ); |
1735 |
1713 |
1736 return; |
1714 return; |
1737 } |
1715 } |
1738 |
1716 |
1739 |
1717 |
1740 TAiwVariant fileNameVariant( fileNamePtr ); |
1718 TAiwVariant fileNameVariant( fileNamePtr ); |
1741 TAiwGenericParam fileNameParam( EGenericParamFile, fileNameVariant ); |
1719 TAiwGenericParam fileNameParam( EGenericParamFile, fileNameVariant ); |
1742 genParList->AppendL( fileNameParam ); |
1720 genParList->AppendL( fileNameParam ); |
1743 |
1721 |
1744 |
1722 |
1745 // Since we don't have the EGenericParamId for track index we are using EGenericParamUnspecified. |
1723 // Since we don't have the EGenericParamId for track index we are using EGenericParamUnspecified. |
1746 // Once we get the generic parameter for the id in future,this will be changed. |
1724 // Once we get the generic parameter for the id in future,this will be changed. |
1747 TAiwVariant activeIndexVariant( activeDownloadID ); |
1725 TAiwVariant activeIndexVariant( activeDownloadID ); |
1748 TAiwGenericParam activeIndexParam( EGenericParamUnspecified, activeIndexVariant ); |
1726 TAiwGenericParam activeIndexParam( EGenericParamUnspecified, activeIndexVariant ); |
1749 genParList->AppendL( activeIndexParam ); |
1727 genParList->AppendL( activeIndexParam ); |
1750 |
1728 |
1751 HBufC8* param8 = HBufC8::NewLC( KMinLength ); // Must be large enough!! |
1729 HBufC8* param8 = HBufC8::NewLC( KMinLength ); // Must be large enough!! |
1752 TPtr8 paramPtr8 = param8->Des(); |
1730 TPtr8 paramPtr8 = param8->Des(); |
1753 RDesWriteStream writeStream( paramPtr8 ); |
1731 RDesWriteStream writeStream( paramPtr8 ); |
1754 |
1732 |
1755 genParList->ExternalizeL( writeStream ); |
1733 genParList->ExternalizeL( writeStream ); |
1759 |
1737 |
1760 //Instead of Selecting topmost task matching the UID from all the tasks, opening the standalone application |
1738 //Instead of Selecting topmost task matching the UID from all the tasks, opening the standalone application |
1761 CAknTaskList *taskList = CAknTaskList::NewL(CEikonEnv::Static()->WsSession()); |
1739 CAknTaskList *taskList = CAknTaskList::NewL(CEikonEnv::Static()->WsSession()); |
1762 TApaTask task = taskList->FindRootApp(pdPlayerUid); |
1740 TApaTask task = taskList->FindRootApp(pdPlayerUid); |
1763 TInt result = aDownload.SetBoolAttribute( EDlAttrProgressive, ETrue ); |
1741 TInt result = aDownload.SetBoolAttribute( EDlAttrProgressive, ETrue ); |
1764 |
1742 |
1765 if ( task.Exists() ) |
1743 if ( task.Exists() ) |
1766 { |
1744 { |
1767 task.BringToForeground(); |
1745 task.BringToForeground(); |
1768 // 8-bit buffer is required. |
1746 // 8-bit buffer is required. |
1769 task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used |
1747 task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used |
1770 } |
1748 } |
1771 else |
1749 else |
1772 { |
1750 { |
1773 HBufC* param = HBufC::NewLC( param8->Length() ); |
1751 HBufC* param = HBufC::NewLC( param8->Length() ); |
1774 param->Des().Copy( *param8 ); |
1752 param->Des().Copy( *param8 ); |
1775 |
1753 |
1776 RApaLsSession appArcSession; |
1754 RApaLsSession appArcSession; |
1777 User::LeaveIfError( appArcSession.Connect() ); |
1755 User::LeaveIfError( appArcSession.Connect() ); |
1778 CleanupClosePushL( appArcSession ); |
1756 CleanupClosePushL( appArcSession ); |
1779 TThreadId id; |
1757 TThreadId id; |
1780 User::LeaveIfError |
1758 User::LeaveIfError |
1781 ( |
1759 ( |
1782 appArcSession.StartDocument( *param, pdPlayerUid, id ) |
1760 appArcSession.StartDocument( *param, pdPlayerUid, id ) |
1783 ); |
1761 ); |
1784 |
1762 |
1785 CleanupStack::PopAndDestroy( &appArcSession ); |
1763 CleanupStack::PopAndDestroy( &appArcSession ); |
1786 CleanupStack::PopAndDestroy( param ); |
1764 CleanupStack::PopAndDestroy( param ); |
1787 } |
1765 } |
1788 |
1766 |
1789 //Store the information whether progressive play is launched or not |
1767 //Store the information whether progressive play is launched or not |
1790 iRegistryModel.UserInteractions().SetProgressiveDownloadLaunched( ETrue ); |
1768 iRegistryModel.UserInteractions().SetProgressiveDownloadLaunched( ETrue ); |
1791 if( aProgressively ) |
1769 if( aProgressively ) |
1792 { |
1770 { |
1793 User::LeaveIfError( aDownload.SetIntAttribute( EDlAttrActivePlayedDownload, activeDownloadID ) ); |
1771 User::LeaveIfError( aDownload.SetIntAttribute( EDlAttrActivePlayedDownload, activeDownloadID ) ); |
1794 } |
1772 } |
1795 |
1773 |
1796 CleanupStack::PopAndDestroy( param8 ); |
1774 CleanupStack::PopAndDestroy( param8 ); |
1797 CleanupStack::PopAndDestroy( fileName ); |
1775 CleanupStack::PopAndDestroy( fileName ); |
1798 CleanupStack::PopAndDestroy( genParList ); |
1776 CleanupStack::PopAndDestroy( genParList ); |
1799 } |
1777 } |
1800 |
1778 |
1801 CLOG_LEAVEFN("CUserInteractionsEventHandler::LaunchPdAppL"); |
1779 CLOG_LEAVEFN("CUserInteractionsEventHandler::LaunchPdAppL"); |
1802 } |
1780 } |
1803 |
1781 |
1804 |
1782 |
1805 #ifdef __DMGR_PD_TESTHARNESS |
1783 #ifdef __DMGR_PD_TESTHARNESS |
1806 // ----------------------------------------------------------------------------- |
1784 // ----------------------------------------------------------------------------- |
1827 TPtr fileNamePtr = fileName->Des(); |
1805 TPtr fileNamePtr = fileName->Des(); |
1828 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
1806 User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
1829 |
1807 |
1830 TAiwVariant fileNameVariant( fileNamePtr ); |
1808 TAiwVariant fileNameVariant( fileNamePtr ); |
1831 TAiwGenericParam fileNameParam( EGenericParamFile, fileNameVariant ); |
1809 TAiwGenericParam fileNameParam( EGenericParamFile, fileNameVariant ); |
1832 genParList->AppendL( fileNameParam ); |
1810 genParList->AppendL( fileNameParam ); |
1833 |
1811 |
1834 HBufC8* param8 = HBufC8::NewLC( KMinLength ); |
1812 HBufC8* param8 = HBufC8::NewLC( KMinLength ); |
1835 TPtr8 paramPtr8 = param8->Des(); |
1813 TPtr8 paramPtr8 = param8->Des(); |
1836 RDesWriteStream writeStream( paramPtr8 ); |
1814 RDesWriteStream writeStream( paramPtr8 ); |
1837 |
1815 |
1844 TApaTask task = taskList.FindApp( KTestPdPlayerUid ); |
1822 TApaTask task = taskList.FindApp( KTestPdPlayerUid ); |
1845 TInt result = aDownload.SetBoolAttribute( EDlAttrProgressive, ETrue ); |
1823 TInt result = aDownload.SetBoolAttribute( EDlAttrProgressive, ETrue ); |
1846 |
1824 |
1847 if ( task.Exists() ) |
1825 if ( task.Exists() ) |
1848 { |
1826 { |
1849 // 8-bit buffer is required. |
1827 // 8-bit buffer is required. |
1850 task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used |
1828 task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used |
1851 task.BringToForeground(); |
1829 task.BringToForeground(); |
1852 } |
1830 } |
1853 else |
1831 else |
1854 { |
1832 { |
1855 HBufC* param = HBufC::NewLC( param8->Length() ); |
1833 HBufC* param = HBufC::NewLC( param8->Length() ); |
1856 param->Des().Copy( *param8 ); |
1834 param->Des().Copy( *param8 ); |
1857 |
1835 |
1858 RApaLsSession appArcSession; |
1836 RApaLsSession appArcSession; |
1859 User::LeaveIfError( appArcSession.Connect() ); |
1837 User::LeaveIfError( appArcSession.Connect() ); |
1860 CleanupClosePushL( appArcSession ); |
1838 CleanupClosePushL( appArcSession ); |
1861 TThreadId id; |
1839 TThreadId id; |
1862 |
1840 |
1863 User::LeaveIfError(appArcSession.StartDocument( *param, KTestPdPlayerUid, id )); |
1841 User::LeaveIfError(appArcSession.StartDocument( *param, KTestPdPlayerUid, id )); |
1864 |
1842 |
1865 CleanupStack::PopAndDestroy( &appArcSession ); |
1843 CleanupStack::PopAndDestroy( &appArcSession ); |
1866 CleanupStack::PopAndDestroy( param ); |
1844 CleanupStack::PopAndDestroy( param ); |
1867 } |
1845 } |
1868 |
1846 |
1869 CleanupStack::PopAndDestroy( param8 ); |
1847 CleanupStack::PopAndDestroy( param8 ); |
1870 CleanupStack::PopAndDestroy( fileName ); |
1848 CleanupStack::PopAndDestroy( fileName ); |
1871 CleanupStack::PopAndDestroy( genParList ); |
1849 CleanupStack::PopAndDestroy( genParList ); |
1872 |
1850 |
1873 CLOG_LEAVEFN("CUserInteractionsEventHandler::TestLaunchPdAppL"); |
1851 CLOG_LEAVEFN("CUserInteractionsEventHandler::TestLaunchPdAppL"); |
1874 } |
1852 } |
1875 |
1853 |
1876 #endif // __DMGR_PD_TESTHARNESS |
1854 #endif // __DMGR_PD_TESTHARNESS |
1877 |
1855 |
1878 |
1856 |
1879 // ----------------------------------------------------------------------------- |
1857 // ----------------------------------------------------------------------------- |
1880 // CUserInteractionsUtils::HandleServerAppExit |
1858 // CUserInteractionsUtils::HandleServerAppExit |
1883 void CUserInteractionsUtils::HandleServerAppExit( TInt aReason ) |
1861 void CUserInteractionsUtils::HandleServerAppExit( TInt aReason ) |
1884 { |
1862 { |
1885 CLOG_ENTERFN("CUserInteractionsUtils::HandleServerAppExit"); |
1863 CLOG_ENTERFN("CUserInteractionsUtils::HandleServerAppExit"); |
1886 CLOG_WRITE_FORMAT(" aReason: %d", aReason); |
1864 CLOG_WRITE_FORMAT(" aReason: %d", aReason); |
1887 |
1865 |
1888 // DocHandler has finished its task. |
1866 // DocHandler has finished its task. |
1889 iDocHandlerUsesTheUi = EFalse; |
1867 iDocHandlerUsesTheUi = EFalse; |
1890 // Schedule the next download: |
1868 // Schedule the next download: |
1891 #ifdef _DEBUG |
1869 #ifdef _DEBUG |
1892 TRAPD( scheduleErr, iRegistryModel.UserInteractions().SchedulePostponedDownloadL() ); |
1870 TRAPD( scheduleErr, iRegistryModel.UserInteractions().SchedulePostponedDownloadL() ); |
1893 CLOG_WRITE_FORMAT(" scheduleErr: %d", scheduleErr); |
1871 CLOG_WRITE_FORMAT(" scheduleErr: %d", scheduleErr); |
1894 #else |
1872 #else |
1895 TRAP_IGNORE( iRegistryModel.UserInteractions().SchedulePostponedDownloadL() ); |
1873 TRAP_IGNORE( iRegistryModel.UserInteractions().SchedulePostponedDownloadL() ); |
1896 #endif // _DEBUG |
1874 #endif // _DEBUG |
1897 |
1875 |
1898 if ( iHandlerObserver ) |
1876 if ( iHandlerObserver ) |
1899 { |
1877 { |
1900 iHandlerObserver->NotifyHandlerExit( iHandledDownload, aReason ); |
1878 iHandlerObserver->NotifyHandlerExit( iHandledDownload, aReason ); |
1901 } |
1879 } |
1902 |
1880 |
1903 CLOG_LEAVEFN("CUserInteractionsUtils::HandleServerAppExit"); |
1881 CLOG_LEAVEFN("CUserInteractionsUtils::HandleServerAppExit"); |
1904 } |
1882 } |
1905 |
1883 |
1906 // ----------------------------------------------------------------------------- |
1884 // ----------------------------------------------------------------------------- |
1907 // CUserInteractionsUtils::IsNetworkPdCompatibleL() |
1885 // CUserInteractionsUtils::IsNetworkPdCompatibleL() |
1918 #if !defined( __WINS__ ) |
1896 #if !defined( __WINS__ ) |
1919 // this initialization needed for identifying 3G networks |
1897 // this initialization needed for identifying 3G networks |
1920 RTelServer telServer; |
1898 RTelServer telServer; |
1921 RMobilePhone mobilePhone; |
1899 RMobilePhone mobilePhone; |
1922 |
1900 |
1923 RMobilePhone::TMobilePhoneNetworkMode networkMode; |
1901 RMobilePhone::TMobilePhoneNetworkMode networkMode; |
1924 User::LeaveIfError( telServer.Connect() ); |
1902 User::LeaveIfError( telServer.Connect() ); |
1925 User::LeaveIfError( telServer.LoadPhoneModule( KMmTsyModuleName ) ); |
1903 User::LeaveIfError( telServer.LoadPhoneModule( KMmTsyModuleName ) ); |
1926 |
1904 |
1927 TInt numPhones; |
1905 TInt numPhones; |
1928 User::LeaveIfError( telServer.EnumeratePhones( numPhones ) ); |
1906 User::LeaveIfError( telServer.EnumeratePhones( numPhones ) ); |
1968 TInt32 browserTerminate( 1 ); |
1946 TInt32 browserTerminate( 1 ); |
1969 CAiwGenericParamList* genParList = CAiwGenericParamList::NewLC(); |
1947 CAiwGenericParamList* genParList = CAiwGenericParamList::NewLC(); |
1970 TAiwVariant terminateVariant( browserTerminate ); |
1948 TAiwVariant terminateVariant( browserTerminate ); |
1971 TAiwGenericParam genericParamTerm( EGenericParamTerminate, terminateVariant ); |
1949 TAiwGenericParam genericParamTerm( EGenericParamTerminate, terminateVariant ); |
1972 genParList->AppendL( genericParamTerm ); |
1950 genParList->AppendL( genericParamTerm ); |
1973 |
1951 |
1974 HBufC8* param8 = HBufC8::NewLC( KMinLength ); // Must be large enough!! |
1952 HBufC8* param8 = HBufC8::NewLC( KMinLength ); // Must be large enough!! |
1975 TPtr8 paramPtr8 = param8->Des(); |
1953 TPtr8 paramPtr8 = param8->Des(); |
1976 RDesWriteStream writeStream( paramPtr8 ); |
1954 RDesWriteStream writeStream( paramPtr8 ); |
1977 |
1955 |
1978 genParList->ExternalizeL( writeStream ); |
1956 genParList->ExternalizeL( writeStream ); |
1979 |
1957 |
1980 writeStream.CommitL(); |
1958 writeStream.CommitL(); |
1981 writeStream.Close(); |
1959 writeStream.Close(); |
1982 |
1960 |
1983 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
1961 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
1984 |
1962 |
1985 TBool isProgressive (EFalse); |
1963 TBool isProgressive (EFalse); |
1986 TInt downloadCnt = iRegistryModel.DownloadCount(); |
1964 TInt downloadCnt = iRegistryModel.DownloadCount(); |
1987 const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads(); |
1965 const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads(); |
1988 TInt j ; |
1966 TInt j ; |
1989 for( j = 0; j < downloadCnt; ++j ) |
1967 for( j = 0; j < downloadCnt; ++j ) |
1990 { |
1968 { |
1991 RHttpDownload* dl = downloads.At(j); // current download |
1969 RHttpDownload* dl = downloads.At(j); // current download |
1992 dl->GetBoolAttribute( EDlAttrProgressive, isProgressive ); |
1970 dl->GetBoolAttribute( EDlAttrProgressive, isProgressive ); |
1993 if(isProgressive) |
1971 if(isProgressive) |
1994 { |
1972 { |
1995 break; |
1973 break; |
1996 } |
1974 } |
1997 } |
1975 } |
1998 for( TInt i = 0; i < KDocPDAppUidCount; i++ ) |
1976 for( TInt i = 0; i < KDocPDAppUidCount; i++ ) |
1999 { |
1977 { |
2000 TUid KTestPdPlayerUid = {KDocPDAppUidList[ i ]}; |
1978 TUid KTestPdPlayerUid = {KDocPDAppUidList[ i ]}; |
2001 TApaTask task = taskList.FindApp(KTestPdPlayerUid ); // task for MP app |
1979 TApaTask task = taskList.FindApp(KTestPdPlayerUid ); // task for MP app |
2002 if ( task.Exists() && ( isProgressive || aProgressiveDownloadLaunched ) ) |
1980 if ( task.Exists() && ( isProgressive || aProgressiveDownloadLaunched ) ) |
2003 { |
1981 { |
2004 if ( isProgressive ) |
1982 if ( isProgressive ) |
2005 { |
1983 { |
2006 RHttpDownload* dl = downloads.At(j); // current download |
1984 RHttpDownload* dl = downloads.At(j); // current download |
2007 //This Atribute will tell if MP called Delete |
1985 //This Atribute will tell if MP called Delete |
2008 //on exit of Browser |
1986 //on exit of Browser |
2009 dl->SetBoolAttribute( EDlAttrProgressive, EFalse ); |
1987 dl->SetBoolAttribute( EDlAttrProgressive, EFalse ); |
2010 } |
1988 } |
2011 // 8-bit buffer is required. |
1989 // 8-bit buffer is required. |
2012 task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used |
1990 task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used |
2013 task.BringToForeground(); |
1991 task.BringToForeground(); |
2014 } |
1992 } |
2015 } |
1993 } |
2016 CleanupStack::PopAndDestroy( param8 ); |
1994 CleanupStack::PopAndDestroy( param8 ); |
2017 CleanupStack::PopAndDestroy( genParList ); |
1995 CleanupStack::PopAndDestroy( genParList ); |
2018 |
1996 |
2019 CLOG_LEAVEFN("CUserInteractionsEventHandler::SendMsgTerminateToPdAppsL"); |
1997 CLOG_LEAVEFN("CUserInteractionsEventHandler::SendMsgTerminateToPdAppsL"); |
2020 |
1998 |
2021 } |
1999 } |
2022 |
2000 |
2023 |
2001 |
2024 // ----------------------------------------------------------------------------- |
2002 // ----------------------------------------------------------------------------- |
2032 // Connection monitor |
2010 // Connection monitor |
2033 RConnectionMonitor connMon; |
2011 RConnectionMonitor connMon; |
2034 CleanupClosePushL( connMon ); |
2012 CleanupClosePushL( connMon ); |
2035 User::LeaveIfError( connMon.ConnectL() ); |
2013 User::LeaveIfError( connMon.ConnectL() ); |
2036 |
2014 |
2037 TConnMonIapInfoBuf infoBuf; |
2015 TConnMonIapInfoBuf infoBuf; |
2038 infoBuf().iCount = 0; |
2016 infoBuf().iCount = 0; |
2039 |
2017 |
2040 // Get WLAN IAPs to infoBuf |
2018 // Get WLAN IAPs to infoBuf |
2041 connMon.GetPckgAttribute( EBearerIdWLAN ,0 , KIapAvailability, infoBuf, status ); |
2019 connMon.GetPckgAttribute( EBearerIdWLAN ,0 , KIapAvailability, infoBuf, status ); |
2042 User::WaitForRequest( status ); |
2020 User::WaitForRequest( status ); |
2043 |
2021 |
2044 CleanupStack::PopAndDestroy( &connMon ); |
2022 CleanupStack::PopAndDestroy( &connMon ); |
2045 |
2023 |
2046 if ( !status.Int() && infoBuf().iCount ) |
2024 if ( !status.Int() && infoBuf().iCount ) |
2047 { |
2025 { |
2048 return ETrue; |
2026 return ETrue; |
2049 } |
2027 } |
2050 |
2028 |
2051 return EFalse; |
2029 return EFalse; |
2052 } |
2030 } |
2053 |
2031 |
2054 // ------------------------------------------------------------ |
2032 // ------------------------------------------------------------ |
2055 // CUserInteractionsUtils::CanLaunchAsProgDownload() |
2033 // CUserInteractionsUtils::CanLaunchAsProgDownload() |
2056 // Check if several conditions are met for Progressive Playback |
2034 // Check if several conditions are met for Progressive Playback |
2057 // ------------------------------------------------------------ |
2035 // ------------------------------------------------------------ |
2058 // |
2036 // |
2059 TBool CUserInteractionsUtils::CanLaunchAsProgDownload( |
2037 TBool CUserInteractionsUtils::CanLaunchAsProgDownload( |
2060 RHttpDownload& aDownload, |
2038 RHttpDownload& aDownload, |
2061 CDownloadMgrUiDownloadsList& dlList, |
2039 CDownloadMgrUiDownloadsList& dlList, |
2062 TBool isOma2Dl ) |
2040 TBool isOma2Dl ) |
2063 { |
2041 { |
2087 return progDlOk; |
2065 return progDlOk; |
2088 } |
2066 } |
2089 |
2067 |
2090 // --------------------------------------------------------- |
2068 // --------------------------------------------------------- |
2091 // CUserInteractionsUtils::UpdateDCFRepositoryL() |
2069 // CUserInteractionsUtils::UpdateDCFRepositoryL() |
2092 // Update saved file to DCFRepository |
2070 // Update saved file to DCFRepository |
2093 // --------------------------------------------------------- |
2071 // --------------------------------------------------------- |
2094 // |
2072 // |
2095 void CUserInteractionsUtils::UpdateDCFRepositoryL( |
2073 void CUserInteractionsUtils::UpdateDCFRepositoryL( |
2096 const TDesC& aFileName ) |
2074 const TDesC& aFileName ) |
2097 { |
2075 { |
2098 CLOG_ENTERFN( "CUserInteractionsUtils::UpdateDCFRepositoryL" ); |
2076 CLOG_ENTERFN( "CUserInteractionsUtils::UpdateDCFRepositoryL" ); |
2099 CLOG_WRITE_FORMAT( " :aFileName=%S", &aFileName ); |
2077 CLOG_WRITE_FORMAT( " :aFileName=%S", &aFileName ); |
2100 CDcfEntry* dcfEntry = NULL; |
2078 CDcfEntry* dcfEntry = NULL; |
2101 dcfEntry = CDcfEntry::NewL(); |
2079 dcfEntry = CDcfEntry::NewL(); |
2102 CleanupStack::PushL( dcfEntry ); |
2080 CleanupStack::PushL( dcfEntry ); |
2103 |
2081 |
2104 CDcfRep* dcfRep = NULL; |
2082 CDcfRep* dcfRep = NULL; |
2105 dcfRep = CDcfRep::NewL(); |
2083 dcfRep = CDcfRep::NewL(); |
2106 CleanupStack::PushL( dcfRep ); |
2084 CleanupStack::PushL( dcfRep ); |
2107 |
2085 |
2108 dcfEntry->SetLocationL( aFileName, 0 ); |
2086 dcfEntry->SetLocationL( aFileName, 0 ); |
2109 CLOG_WRITE(" : SetLocationL OK"); |
2087 CLOG_WRITE(" : SetLocationL OK"); |
2110 dcfRep->UpdateL( dcfEntry ); |
2088 dcfRep->UpdateL( dcfEntry ); |
2111 CLOG_WRITE(" :UpdateL OK"); |
2089 CLOG_WRITE(" :UpdateL OK"); |
2112 CleanupStack::PopAndDestroy(2); // dcfEntry, dcfRep |
2090 CleanupStack::PopAndDestroy(2); // dcfEntry, dcfRep |
2113 CLOG_LEAVEFN("CUserInteractionsUtils::UpdateDCFRepositoryL"); |
2091 CLOG_LEAVEFN("CUserInteractionsUtils::UpdateDCFRepositoryL"); |
2114 } |
2092 } |
2115 |
2093 |
2116 // --------------------------------------------------------- |
2094 // --------------------------------------------------------- |
2117 // CUserInteractionsUtils::IsCodDownload() |
2095 // CUserInteractionsUtils::IsCodDownload() |
2118 // return true if its a COD DL |
2096 // return true if its a COD DL |
2119 // --------------------------------------------------------- |
2097 // --------------------------------------------------------- |
2120 // |
2098 // |
2121 TBool CUserInteractionsUtils::IsCodDownload() |
2099 TBool CUserInteractionsUtils::IsCodDownload() |
2122 { |
2100 { |
2123 return iCodDownload; |
2101 return iCodDownload; |
2124 } |
2102 } |
2125 |
2103 |
2126 // End of file. |
2104 // End of file. |