diff -r d39add9822e2 -r 5bfc169077b2 browserutilities/downloadmgr/DownloadMgrUiLib/Src/CUserInteractionsUtils.cpp --- a/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CUserInteractionsUtils.cpp Tue Feb 02 00:56:45 2010 +0200 +++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CUserInteractionsUtils.cpp Fri Mar 19 09:52:28 2010 +0200 @@ -15,18 +15,21 @@ * */ + + // INCLUDE FILES -#include +//#include +#include #include "CUserInteractionsUtils.h" #include "MDownloadHandlerObserver.h" -#include -#include -#include -#include +#include "CDownloadMgrUiBase.h" +#include "CDownloadMgrUiLibRegistry.h" +#include "CDownloadMgrUiDownloadsList.h" +#include "CDownloadMgrUiUserInteractions.h" #include "UiLibLogger.h" #include "DMgrUiLibPanic.h" #include -#include +#include #include #include #include @@ -40,8 +43,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -49,13 +52,16 @@ #include #include #include -#include +#include "bautils.h" #include #include #include #include #include +// following line is temporary: AVKON dependency removal +#undef BRDO_APP_GALLERY_SUPPORTED_FF + #ifdef BRDO_APP_GALLERY_SUPPORTED_FF #include #include @@ -75,9 +81,9 @@ // CUserInteractionsUtils::CUserInteractionsUtils // ----------------------------------------------------------------------------- // -CUserInteractionsUtils::CUserInteractionsUtils( CDownloadMgrUiBase& aDMgrUiBase, +CUserInteractionsUtils::CUserInteractionsUtils( CDownloadMgrUiBase& aDMgrUiBase, MDownloadMgrUiLibRegModel& aRegistryModel ) -: iCoeEnv( *CCoeEnv::Static() ), +: iCoeEnv( *CCoeEnv::Static() ), iDMgrUiBase( aDMgrUiBase ), iRegistryModel( aRegistryModel ), iDocHandlerUsesTheUi( EFalse ) @@ -112,7 +118,7 @@ CUserInteractionsUtils* CUserInteractionsUtils::NewL ( CDownloadMgrUiBase& aDMgrUiBase, MDownloadMgrUiLibRegModel& aRegistryModel ) { - CUserInteractionsUtils* self = + CUserInteractionsUtils* self = new ( ELeave ) CUserInteractionsUtils( aDMgrUiBase, aRegistryModel ); CleanupStack::PushL( self ); self->ConstructL(); @@ -136,7 +142,7 @@ delete iUnderTenFormatter; CLOG_WRITE(" iUnderTenFormatter OK"); delete iOverTenFormatter; - CLOG_WRITE(" iOverTenFormatter OK"); + CLOG_WRITE(" iOverTenFormatter OK"); CLOG_LEAVEFN("CUserInteractionsUtils::~CUserInteractionsUtils"); } @@ -144,7 +150,7 @@ // CUserInteractionsUtils::ShowErrorNoteL // ----------------------------------------------------------------------------- // -void CUserInteractionsUtils::ShowErrorNoteL( RHttpDownload& aDownload, +void CUserInteractionsUtils::ShowErrorNoteL( RHttpDownload& aDownload, TInt32 aErrorId ) { TInt32 sysErrorId( KErrNone ); // Global (system-wide) error ID @@ -242,7 +248,7 @@ case EHttpRestartFailed: { // Show error note by ourself - HBufC* errorString = + HBufC* errorString = iCoeEnv.AllocReadResourceLC( R_DMUL_ERROR_START_FROM_BEGINNING ); CAknGlobalNote* globalNote = CAknGlobalNote::NewL(); CleanupStack::PushL( globalNote ); @@ -261,7 +267,7 @@ if ( sysErrorId != KErrNone ) { if ( sysErrorId == KErrHttpPartialResponseReceived ) - { // FMLK-72653Y : as server closed connection unexpectedly, + { // FMLK-72653Y : as server closed connection unexpectedly, // and there is no good error note, use KErrDisconnected instead. iErrorUi->ShowGlobalErrorNoteL( KErrDisconnected, CTextResolver::ECtxAutomatic ); } @@ -285,7 +291,7 @@ // CUserInteractionsUtils::IsRecoverableFailL // ----------------------------------------------------------------------------- // -TBool CUserInteractionsUtils::IsRecoverableFailL( RHttpDownload& aDownload, +TBool CUserInteractionsUtils::IsRecoverableFailL( RHttpDownload& aDownload, TInt32 aErrorId ) const { TBool recoverable( ETrue ); @@ -298,7 +304,7 @@ TInt32 sysErrorId( 0 ); User::LeaveIfError( aDownload.GetIntAttribute ( EDlAttrGlobalErrorId, sysErrorId ) ); - + TBool pausable( ETrue ); User::LeaveIfError( aDownload.GetBoolAttribute( EDlAttrPausable, pausable ) ); if ( errorId == EObjectNotFound ) @@ -307,7 +313,7 @@ recoverable = EFalse; } else if ( errorId == ETransactionFailed ) - { + { if ( sysErrorId == KBadMimeType || sysErrorId == -20000 || sysErrorId == KErrHttpPartialResponseReceived || !pausable ) // KBadMimeType and -20000 is from DRMFilter // Transaction must be cancelled and download must be deleted @@ -322,11 +328,11 @@ else if ( errorId == EGeneral ) { if ( sysErrorId == KErrNoMemory || sysErrorId == KErrDiskFull ) - //Memory full or Disk Full can be Recoverable error if Download is Pausable + //Memory full or Disk Full can be Recoverable error if Download is Pausable { recoverable = pausable; } - else + else { recoverable = EFalse; } @@ -349,9 +355,9 @@ { CLOG_ENTERFN("CUserInteractionsUtils::HandleContentL"); - __ASSERT_DEBUG( !iRegistryModel.UserInteractions().IsUiBusy(), + __ASSERT_DEBUG( !iRegistryModel.UserInteractions().IsUiBusy(), Panic( EUiLibPanDocHandlerAlreadyRunning ) ); - + if ( iRegistryModel.UserInteractions().IsUiBusy() ) { CLOG_WRITE(" IsUiBusy() true"); @@ -361,7 +367,7 @@ iHandledDownload = &aDownload; iHandlerObserver = &aHandlerObserver; - // BEGIN: Get attributes for generic params + // BEGIN: Get attributes for generic params //========================= // EDlAttrCurrentUrl //========================= @@ -395,10 +401,10 @@ HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND); CAknInformationNote* note = new(ELeave) CAknInformationNote(); note->ExecuteLD(*infoPrompt); - CleanupStack::PopAndDestroy(infoPrompt); + CleanupStack::PopAndDestroy(infoPrompt); CleanupStack::PopAndDestroy( fileName ); // fileName - CleanupStack::PopAndDestroy( url ); // url + CleanupStack::PopAndDestroy( url ); // url return; } @@ -446,7 +452,7 @@ { User::Leave( retVal ); } - // END: Get attributes for generic params + // END: Get attributes for generic params //Creating generic param list CAiwGenericParamList* genericParamList = CAiwGenericParamList::NewLC(); @@ -482,13 +488,13 @@ ( EGenericParamFile, fileNameVariant ); genericParamList->AppendL( genericParamFileName ); } - + CLOG_WRITE_FORMAT(" iDocHandler: %x",iDocHandler); delete iDocHandler; iDocHandler = 0; iDocHandler = CDocumentHandler::NewL(); iDocHandler->SetExitObserver( this ); - + RFile file; iDocHandler->OpenTempFileL( *fileName, file ); CleanupClosePushL( file ); @@ -497,30 +503,30 @@ TInt docErr( KErrNone ); TInt trappedError( KErrNone ); iDocHandlerUsesTheUi = ETrue; - TRAP( trappedError, - docErr = iDocHandler->OpenFileEmbeddedL( file, - dataType, + TRAP( trappedError, + docErr = iDocHandler->OpenFileEmbeddedL( file, + dataType, *genericParamList ) ); CLOG_WRITE_FORMAT(" trappedError: %d",trappedError); CLOG_WRITE_FORMAT(" docErr: %d",docErr); CleanupStack::PopAndDestroy( &file ); // file CLOG_WRITE(" PopAndDestroy file OK"); - + if ( trappedError || docErr ) { delete iDocHandler; iDocHandler = 0; iDocHandlerUsesTheUi = EFalse; - // Since we know this is an open file error, we should handle it by calling - // ShowErrorNotesL instead of propagating the error - if ( trappedError ) + // Since we know this is an open file error, we should handle it by calling + // ShowErrorNotesL instead of propagating the error + if ( trappedError ) { ShowErrorNoteL (aDownload, trappedError ); } - else + else { ShowErrorNoteL (aDownload, docErr ); - } + } } CleanupStack::PopAndDestroy( genericParamList ); // genericParamList @@ -544,7 +550,7 @@ __ASSERT_DEBUG( iMemSelectionDialog == 0, Panic( EUiLibPanNull ) ); // Only one can run TBool boolRet( EFalse ); - + if ( !DrmDownloadL( aDownload ) ) { boolRet = SaveContentWithPathSelectionL( aDownload ); @@ -570,7 +576,7 @@ User::LeaveIfError ( aDownload.GetStringAttribute( EDlAttrName, dlNamePtr ) ); CLOG_WRITE_FORMAT(" EDlAttrName: %S",&dlNamePtr); - + HBufC8* contentType = HBufC8::NewLC( KMaxContentTypeLength ); TPtr8 contentTypePtr = contentType->Des(); User::LeaveIfError @@ -594,7 +600,7 @@ CLOG_WRITE_FORMAT(" moveErr: %d",moveErr); CLOG_WRITE_FORMAT(" moveRet: %d",moveRet); - // Delete DocHandler, otherwise IsUiBusy returns ETrue. + // Delete DocHandler, otherwise IsUiBusy returns ETrue. delete iDocHandler; iDocHandler = 0; iDocHandlerUsesTheUi = EFalse; @@ -604,7 +610,7 @@ dlName = 0; CleanupStack::PopAndDestroy( fileName ); // fileName fileName = 0; - + if( moveRet == KUserCancel ) { // The user cancelled the operation. @@ -645,7 +651,7 @@ // Select memory iMemSelectionDialog = CAknMemorySelectionDialog::NewL - ( ECFDDialogTypeSave, R_DMUL_MEMORY_SELECTION_DLG, + ( ECFDDialogTypeSave, R_DMUL_MEMORY_SELECTION_DLG, /*aShowUnavailableDrives*/EFalse ); CLOG_WRITE(" CAknMemorySelectionDialog::NewL OK"); CAknMemorySelectionDialog::TMemory mem( CAknMemorySelectionDialog::EPhoneMemory ); @@ -653,12 +659,12 @@ CLOG_WRITE_FORMAT(" MEM boolRet: %d",boolRet); delete iMemSelectionDialog; iMemSelectionDialog = 0; - + if ( boolRet ) { CLOG_WRITE_FORMAT(" mem: %d",(TInt)mem); TBool useMmc = (mem == CAknMemorySelectionDialog::EMemoryCard); - + __ASSERT_DEBUG( iFileSelectionDialog == 0, Panic( EUiLibPanNull ) ); // Only one can run HBufC* fileName = HBufC::NewLC( KMaxPath ); @@ -668,13 +674,13 @@ CLOG_WRITE(" EDlAttrName OK"); // Select folder - TInt resourceId = useMmc ? R_DMUL_MMC_FILE_SELECTION_DLG : + TInt resourceId = useMmc ? R_DMUL_MMC_FILE_SELECTION_DLG : R_DMUL_FILE_SELECTION_DLG; iFileSelectionDialog = CAknFileSelectionDialog::NewL ( ECFDDialogTypeSave, resourceId ); CLOG_WRITE(" CAknFileSelectionDialog::NewL OK"); TPath selectedPath( KNullDesC ); - // Execute dialog - it calls CActiveScheduler::Start(), so be careful + // Execute dialog - it calls CActiveScheduler::Start(), so be careful // when using data members after ExecuteLD! // TODO introduce deleted, as it uses data after executeld. boolRet = iFileSelectionDialog->ExecuteL( selectedPath ); @@ -696,7 +702,7 @@ User::LeaveIfError( aDownload.Move() ); CLOG_WRITE(" Move OK"); } - + CleanupStack::PopAndDestroy( fileName ); // fileName } @@ -808,7 +814,7 @@ CleanupStack::PopAndDestroy( 2, original ); // nameBuf, original return ret; } - + // ----------------------------------------------------------------------------- // CUserInteractionsUtils::IsDuplicateL // ----------------------------------------------------------------------------- @@ -861,13 +867,13 @@ TBool CUserInteractionsUtils::DeleteWithUserConfirmL( RHttpDownload& aDownload ) { CLOG_ENTERFN("CUserInteractionsUtils::DeleteWithUserConfirmL"); - + TInt32 numMediaObjects(0); aDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ); - + HBufC* fileName = HBufC::NewLC( KMaxPath ); TPtr fileNamePtr = fileName->Des(); - + // In case of album, show the album name. Otherwise show file name. TInt err(KErrNone); if (numMediaObjects > 1) @@ -878,7 +884,7 @@ { err = aDownload.GetStringAttribute( EDlAttrName, fileNamePtr ); } - + if ( err != KErrNone && err != KErrNotFound ) { User::LeaveIfError( err ); @@ -893,7 +899,7 @@ CAknQueryDialog* dlg = CAknQueryDialog::NewL(); delete iDeleteConfirmDlg; iDeleteConfirmDlg = dlg; - // Execute dialog - it calls CActiveScheduler::Start(), so be careful + // Execute dialog - it calls CActiveScheduler::Start(), so be careful // when using data members after ExecuteLD! TInt resp = iDeleteConfirmDlg->ExecuteLD ( R_DMUL_DOWNLOAD_YESNO_CONF_Q, *prompt ); @@ -903,26 +909,26 @@ if ( resp ) // We have to check only that the value is non-zero { - aDownload.GetBoolAttribute( EDlAttrCodDownload,iCodDownload ); - - + aDownload.GetBoolAttribute( EDlAttrCodDownload,iCodDownload ); + + if(iCodDownload) { - + #ifdef BRDO_APP_GALLERY_SUPPORTED_FF CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL( CEikonEnv::Static()->FsSession() ); - + #endif - + //Assume that all files to be deleted are valid. TBool fileNotFound = EFalse; - + for(TInt i = 1; i <= numMediaObjects; i++) { HBufC* fileName = HBufC::NewLC( KMaxPath ); TPtr fileNamePtr = fileName->Des(); - User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename,i,fileNamePtr )); + User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename,i,fileNamePtr )); RFs rfs; User::LeaveIfError( rfs.Connect() ); CleanupClosePushL( rfs ); @@ -936,7 +942,7 @@ } rfs.Delete( fileNamePtr ); - + #ifdef BRDO_APP_GALLERY_SUPPORTED_FF // Notify Media Gallery about new media file if( fileNamePtr.Length() > 0 ) @@ -948,34 +954,34 @@ { TRAP_IGNORE( mgFileManager->UpdateL() ); } - + #else if( fileNamePtr.Length() > 0 ) { TRAP_IGNORE( UpdateDCFRepositoryL( fileNamePtr ) ); } - - #endif - + + #endif + CleanupStack::PopAndDestroy( &rfs ); - CleanupStack::PopAndDestroy( fileName ); + CleanupStack::PopAndDestroy( fileName ); } - + #ifdef BRDO_APP_GALLERY_SUPPORTED_FF delete mgFileManager; mgFileManager = NULL; #endif - - //Inform the user that atleast one file not found. + + //Inform the user that atleast one file not found. if(fileNotFound) { HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND); CAknInformationNote* note = new(ELeave) CAknInformationNote(); note->ExecuteLD(*infoPrompt); - CleanupStack::PopAndDestroy(infoPrompt); + CleanupStack::PopAndDestroy(infoPrompt); } - } - + } + User::LeaveIfError( aDownload.Delete() ); CLOG_LEAVEFN("CUserInteractionsUtils::DeleteWithUserConfirmL"); return ETrue; // Deleted @@ -1007,7 +1013,7 @@ TBool CUserInteractionsUtils::CancelWithUserConfirmL( RHttpDownload& aDownload ) { CLOG_ENTERFN("CUserInteractionsUtils::CancelWithUserConfirmL"); - + HBufC* fileName = HBufC::NewLC( KMaxPath ); TPtr fileNamePtr = fileName->Des(); TInt err = aDownload.GetStringAttribute( EDlAttrName, fileNamePtr ); @@ -1025,7 +1031,7 @@ CAknQueryDialog* dlg = CAknQueryDialog::NewL(); delete iCancelConfirmDlg; iCancelConfirmDlg = dlg; - // Execute dialog - it calls CActiveScheduler::Start(), so be careful + // Execute dialog - it calls CActiveScheduler::Start(), so be careful // when using data members after ExecuteLD! TInt resp = iCancelConfirmDlg->ExecuteLD ( R_DMUL_DOWNLOAD_YESNO_CONF_Q, *prompt ); @@ -1045,7 +1051,7 @@ return EFalse; } } - + // ----------------------------------------------------------------------------- // CUserInteractionsUtils::CancelAllWithUserConfirmL // ----------------------------------------------------------------------------- @@ -1058,13 +1064,13 @@ CAknQueryDialog* dlg = CAknQueryDialog::NewL(); delete iCancelConfirmDlg; iCancelConfirmDlg = dlg; - // Execute dialog - it calls CActiveScheduler::Start(), so be careful + // Execute dialog - it calls CActiveScheduler::Start(), so be careful // when using data members after ExecuteLD! TInt resp = iCancelConfirmDlg->ExecuteLD ( R_DMUL_DOWNLOAD_YESNO_CONF_Q, *prompt ); iCancelConfirmDlg = 0; CleanupStack::PopAndDestroy(); // prompt - + if ( resp ) // We have to check only that the value is non-zero { TInt count = iRegistryModel.DownloadMgr().CurrentDownloads().Count(); @@ -1086,7 +1092,7 @@ { dlState = EHttpDlMultipleMOFailed; } - + if(dlState == EHttpDlInprogress || dlState == EHttpDlPaused ) { i--; @@ -1128,7 +1134,7 @@ { HBufC* value = iCoeEnv.AllocReadResourceLC ( R_DMUL_ERROR_EXT_MEM_REMOVED ); - iMediaRemovedNote = + iMediaRemovedNote = new (ELeave) CAknInformationNote( &iMediaRemovedNote ); iMediaRemovedNote->ExecuteLD( *value ); CleanupStack::PopAndDestroy( value ); // value @@ -1159,7 +1165,7 @@ ( RHttpDownload& aDownload ) { CLOG_ENTERFN("CUserInteractionsUtils::GetAndSetHttpAuthCredentialsL"); - + HBufC* username = 0; HBufC* password = 0; @@ -1193,7 +1199,7 @@ // Execute a wait dialog TBool resp = iDialogsProv->DialogUserAuthenticationLC - ( *url, *realm, *userName, username, password, + ( *url, *realm, *userName, username, password, authScheme == EAuthBasic ); if ( resp ) @@ -1216,7 +1222,7 @@ CleanupStack::PopAndDestroy( realm ); // realm CleanupStack::PopAndDestroy( url ); // url CleanupStack::PopAndDestroy( userName ); // userName - + CLOG_LEAVEFN("CUserInteractionsUtils::GetAndSetHttpAuthCredentialsL"); return ( resp ); } @@ -1229,7 +1235,7 @@ ( RHttpDownload& aDownload ) { CLOG_ENTERFN("CUserInteractionsUtils::GetAndSetProxyAuthCredentialsL"); - + HBufC* username = 0; HBufC* password = 0; @@ -1255,7 +1261,7 @@ // Execute a wait dialog TBool resp = iDialogsProv->DialogUserAuthenticationLC - ( *url, *realm, *userName, username, password, + ( *url, *realm, *userName, username, password, authScheme == EAuthBasic ); if ( resp ) @@ -1278,7 +1284,7 @@ CleanupStack::PopAndDestroy( realm ); // realm CleanupStack::PopAndDestroy( url ); // url CleanupStack::PopAndDestroy( userName ); // userName - + CLOG_LEAVEFN("CUserInteractionsUtils::GetAndSetProxyAuthCredentialsL"); return ( resp ); } @@ -1313,7 +1319,7 @@ ( KNullDesC, *message, *okMsg, *cancelMsg ); // Clean up the basic authentication dialog memory - CleanupStack::PopAndDestroy( 3, message ); + CleanupStack::PopAndDestroy( 3, message ); // message, okMsg, cancelMsg return resp; @@ -1333,7 +1339,7 @@ // ----------------------------------------------------------------------------- // CUserInteractionsUtils::BrowserSettingSecWarningL -// This method must behave the same as +// This method must behave the same as // CBrowserSettings::GetHttpSecurityWarnings(). // See CBrowserSettings ! // ----------------------------------------------------------------------------- @@ -1348,19 +1354,19 @@ // CUserInteractionsUtils::InitializeSoftNotifStndL // ----------------------------------------------------------------------------- // -void CUserInteractionsUtils::InitializeSoftNotifStndL( TVwsViewId aViewId, - TUid aCustomMessageId, +void CUserInteractionsUtils::InitializeSoftNotifStndL( TVwsViewId aViewId, + TUid aCustomMessageId, const TDesC8& aViewActivationMsg ) const { CLOG_ENTERFN("CUserInteractionsUtils::InitializeSoftNotifStndL"); - CAknSoftNotificationParameters* params = + CAknSoftNotificationParameters* params = CAknSoftNotificationParameters::NewL ( - iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_STND, KMinimumSoftNotePriority, - R_AVKON_SOFTKEYS_YES_NO__YES, - CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, - EAknSoftkeyYes, aViewActivationMsg + iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_STND, KMinimumSoftNotePriority, + R_AVKON_SOFTKEYS_YES_NO__YES, + CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, + EAknSoftkeyYes, aViewActivationMsg ); CLOG_WRITE(" params OK"); CleanupStack::PushL( params ); @@ -1376,19 +1382,19 @@ // CUserInteractionsUtils::InitializeSoftNotifEmbL // ----------------------------------------------------------------------------- // -void CUserInteractionsUtils::InitializeSoftNotifEmbL( TVwsViewId aViewId, - TUid aCustomMessageId, +void CUserInteractionsUtils::InitializeSoftNotifEmbL( TVwsViewId aViewId, + TUid aCustomMessageId, const TDesC8& aViewActivationMsg ) const { CLOG_ENTERFN("CUserInteractionsUtils::InitializeSoftNotifEmbL"); - CAknSoftNotificationParameters* params = + CAknSoftNotificationParameters* params = CAknSoftNotificationParameters::NewL ( - iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_EMB, KMinimumSoftNotePriority, - R_AVKON_SOFTKEYS_YES_NO__YES, - CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, - EAknSoftkeyYes, aViewActivationMsg + iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_EMB, KMinimumSoftNotePriority, + R_AVKON_SOFTKEYS_YES_NO__YES, + CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, + EAknSoftkeyYes, aViewActivationMsg ); CLOG_WRITE(" params OK"); CleanupStack::PushL( params ); @@ -1404,25 +1410,25 @@ // CUserInteractionsUtils::CancelSoftNotifStndL // ----------------------------------------------------------------------------- // -void CUserInteractionsUtils::CancelSoftNotifStndL( TVwsViewId aViewId, - TUid aCustomMessageId, +void CUserInteractionsUtils::CancelSoftNotifStndL( TVwsViewId aViewId, + TUid aCustomMessageId, const TDesC8& aViewActivationMsg ) const { CLOG_ENTERFN("CUserInteractionsUtils::CancelSoftNotifStndL"); - CAknSoftNotificationParameters* params = + CAknSoftNotificationParameters* params = CAknSoftNotificationParameters::NewL ( - iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_STND, KMinimumSoftNotePriority, - R_AVKON_SOFTKEYS_YES_NO__YES, - CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, - EAknSoftkeyYes, aViewActivationMsg + iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_STND, KMinimumSoftNotePriority, + R_AVKON_SOFTKEYS_YES_NO__YES, + CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, + EAknSoftkeyYes, aViewActivationMsg ); CLOG_WRITE(" params OK"); CleanupStack::PushL( params ); //TODO From avkon sources it seems that it identifies the soft notification - // with the AVKON_NOTE resource ID, which is the same in case of + // with the AVKON_NOTE resource ID, which is the same in case of // all UI Lib clients!! iSoftNotifier->CancelCustomSoftNotificationL( *params ); @@ -1435,19 +1441,19 @@ // CUserInteractionsUtils::CancelSoftNotifEmbL // ----------------------------------------------------------------------------- // -void CUserInteractionsUtils::CancelSoftNotifEmbL( TVwsViewId aViewId, - TUid aCustomMessageId, +void CUserInteractionsUtils::CancelSoftNotifEmbL( TVwsViewId aViewId, + TUid aCustomMessageId, const TDesC8& aViewActivationMsg ) const { CLOG_ENTERFN("CUserInteractionsUtils::CancelSoftNotifEmbL"); - CAknSoftNotificationParameters* params = + CAknSoftNotificationParameters* params = CAknSoftNotificationParameters::NewL ( - iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_EMB, KMinimumSoftNotePriority, - R_AVKON_SOFTKEYS_YES_NO__YES, - CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, - EAknSoftkeyYes, aViewActivationMsg + iDMgrUiBase.ResourceFileName(), R_DMUL_GSN_EMB, KMinimumSoftNotePriority, + R_AVKON_SOFTKEYS_YES_NO__YES, + CAknNoteDialog::EConfirmationTone, aViewId, aCustomMessageId, + EAknSoftkeyYes, aViewActivationMsg ); CLOG_WRITE(" params OK"); CleanupStack::PushL( params ); @@ -1478,7 +1484,7 @@ CancelMediaRemovedNote(); CancelCredentialsQueries(); CancelSecurityWarning(); - // The soft notifications should not be cancelled here, + // The soft notifications should not be cancelled here, // because they are used in a different context. } @@ -1500,7 +1506,7 @@ void CUserInteractionsUtils::InfoNoteL( TInt aDialogResourceId, const TDesC& aPrompt ) { CLOG_ENTERFN("CUserInteractionsUtils::InfoNoteL"); - + CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog ( REINTERPRET_CAST( CEikDialog**, &dialog ) ); CLOG_WRITE(" new"); @@ -1509,7 +1515,7 @@ dialog->SetCurrentLabelL( EGeneralNote, aPrompt ); CLOG_WRITE(" SetCurrentLabelL"); dialog->RunDlgLD( CAknNoteDialog::ELongTimeout, CAknNoteDialog::ENoTone ); - + CLOG_LEAVEFN("CUserInteractionsUtils::InfoNoteL"); } @@ -1565,15 +1571,15 @@ HBufC8* mimeType = 0; HBufC8* contentURI = 0; TUint dataLength = 0; - TInt err = drmCommon->GetFileInfo( *fileName, + TInt err = drmCommon->GetFileInfo( *fileName, prot, mimeType, contentURI, dataLength ); - - if ( err == DRMCommon::EVersionNotSupported || + + if ( err == DRMCommon::EVersionNotSupported || ( err == DRMCommon::EOk && ( !mimeType || !contentURI ) ) ) { isCorruptedDcf = ETrue; } - + delete mimeType; delete contentURI; CleanupStack::PopAndDestroy( fileName ); @@ -1610,9 +1616,9 @@ HBufC8* mimeType = 0; HBufC8* contentURI = 0; TUint dataLength = 0; - TInt err = drmCommon->GetFileInfo( *fileName, + TInt err = drmCommon->GetFileInfo( *fileName, prot, mimeType, contentURI, dataLength ); - + if ( err == DRMCommon::EOk ) { if ( !mimeType || !contentURI ) @@ -1626,7 +1632,7 @@ isBadMimeInDcfL = ETrue; } } - + delete mimeType; delete contentURI; CleanupStack::PopAndDestroy( fileName ); @@ -1651,7 +1657,7 @@ CLOG_LEAVEFN("CUserInteractionsUtils::DownloadHasBeenDeleted"); } - + // ----------------------------------------------------------------------------- // CUserInteractionsUtils::LaunchPdAppL // ----------------------------------------------------------------------------- @@ -1661,7 +1667,7 @@ CLOG_ENTERFN("CUserInteractionsEventHandler::LaunchPdAppL"); // Get the PD player application's UID for the download - TUid pdPlayerUid = { 0 }; + TUid pdPlayerUid = { 0 }; HBufC8* contentType = ContentTypeL( aDownload, ETrue, KFirstMoIndex ); TDataType dataType( *contentType ); delete contentType; @@ -1670,38 +1676,38 @@ CDocumentHandler* docHandler = CDocumentHandler::NewLC(); TBool pdSupported = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid ); CleanupStack::PopAndDestroy( docHandler ); // docHandler - + if ( pdSupported ) { - + TInt downloadCnt = iRegistryModel.DownloadCount(); TBool isProg(EFalse); - + const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads(); - + for ( TInt i = 0; i < downloadCnt ;i++ ) { RHttpDownload* dl = downloads.At(i); //current download dl->GetBoolAttribute( EDlAttrProgressive, isProg ); - if (isProg ) + if (isProg ) { dl->SetBoolAttribute( EDlAttrProgressive, EFalse ); } } - + TInt32 numMediaObjects = 0; User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ) ); - + // Pack download ID into EGenericParamDownloadId. TInt32 downloadID( -1 ); TInt32 activeDownloadID(-1); if ( aProgressively ) { - User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrId, downloadID ) ); - User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, activeDownloadID ) ); + User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrId, downloadID ) ); + User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, activeDownloadID ) ); } - + CAiwGenericParamList* genParList = CAiwGenericParamList::NewLC(); TAiwVariant downloadIdVariant( downloadID ); TAiwGenericParam genericParam( EGenericParamDownloadId, downloadIdVariant ); @@ -1715,33 +1721,33 @@ User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename, KFirstMoIndex, fileNamePtr ) ); else User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); - + // check if file exists, if does not , don't continue if ( !IsDuplicateL( fileNamePtr ) ) { HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND); CAknInformationNote* note = new(ELeave) CAknInformationNote(); note->ExecuteLD(*infoPrompt); - CleanupStack::PopAndDestroy(infoPrompt); + CleanupStack::PopAndDestroy(infoPrompt); CleanupStack::PopAndDestroy( fileName ); CleanupStack::PopAndDestroy( genParList ); return; } - + TAiwVariant fileNameVariant( fileNamePtr ); TAiwGenericParam fileNameParam( EGenericParamFile, fileNameVariant ); - genParList->AppendL( fileNameParam ); - - + genParList->AppendL( fileNameParam ); + + // Since we don't have the EGenericParamId for track index we are using EGenericParamUnspecified. // Once we get the generic parameter for the id in future,this will be changed. TAiwVariant activeIndexVariant( activeDownloadID ); TAiwGenericParam activeIndexParam( EGenericParamUnspecified, activeIndexVariant ); - genParList->AppendL( activeIndexParam ); - + genParList->AppendL( activeIndexParam ); + HBufC8* param8 = HBufC8::NewLC( KMinLength ); // Must be large enough!! TPtr8 paramPtr8 = param8->Des(); RDesWriteStream writeStream( paramPtr8 ); @@ -1755,18 +1761,18 @@ CAknTaskList *taskList = CAknTaskList::NewL(CEikonEnv::Static()->WsSession()); TApaTask task = taskList->FindRootApp(pdPlayerUid); TInt result = aDownload.SetBoolAttribute( EDlAttrProgressive, ETrue ); - + if ( task.Exists() ) { task.BringToForeground(); - // 8-bit buffer is required. + // 8-bit buffer is required. task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used } - else + else { HBufC* param = HBufC::NewLC( param8->Length() ); param->Des().Copy( *param8 ); - + RApaLsSession appArcSession; User::LeaveIfError( appArcSession.Connect() ); CleanupClosePushL( appArcSession ); @@ -1775,24 +1781,24 @@ ( appArcSession.StartDocument( *param, pdPlayerUid, id ) ); - + CleanupStack::PopAndDestroy( &appArcSession ); CleanupStack::PopAndDestroy( param ); } - + //Store the information whether progressive play is launched or not iRegistryModel.UserInteractions().SetProgressiveDownloadLaunched( ETrue ); if( aProgressively ) { User::LeaveIfError( aDownload.SetIntAttribute( EDlAttrActivePlayedDownload, activeDownloadID ) ); - } + } CleanupStack::PopAndDestroy( param8 ); CleanupStack::PopAndDestroy( fileName ); CleanupStack::PopAndDestroy( genParList ); } - - CLOG_LEAVEFN("CUserInteractionsEventHandler::LaunchPdAppL"); + + CLOG_LEAVEFN("CUserInteractionsEventHandler::LaunchPdAppL"); } @@ -1823,7 +1829,7 @@ TAiwVariant fileNameVariant( fileNamePtr ); TAiwGenericParam fileNameParam( EGenericParamFile, fileNameVariant ); - genParList->AppendL( fileNameParam ); + genParList->AppendL( fileNameParam ); HBufC8* param8 = HBufC8::NewLC( KMinLength ); TPtr8 paramPtr8 = param8->Des(); @@ -1840,22 +1846,22 @@ if ( task.Exists() ) { - // 8-bit buffer is required. + // 8-bit buffer is required. task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used task.BringToForeground(); } - else + else { HBufC* param = HBufC::NewLC( param8->Length() ); param->Des().Copy( *param8 ); - + RApaLsSession appArcSession; User::LeaveIfError( appArcSession.Connect() ); CleanupClosePushL( appArcSession ); TThreadId id; User::LeaveIfError(appArcSession.StartDocument( *param, KTestPdPlayerUid, id )); - + CleanupStack::PopAndDestroy( &appArcSession ); CleanupStack::PopAndDestroy( param ); } @@ -1863,10 +1869,10 @@ CleanupStack::PopAndDestroy( param8 ); CleanupStack::PopAndDestroy( fileName ); CleanupStack::PopAndDestroy( genParList ); - + CLOG_LEAVEFN("CUserInteractionsEventHandler::TestLaunchPdAppL"); } - + #endif // __DMGR_PD_TESTHARNESS @@ -1879,7 +1885,7 @@ CLOG_ENTERFN("CUserInteractionsUtils::HandleServerAppExit"); CLOG_WRITE_FORMAT(" aReason: %d", aReason); - // DocHandler has finished its task. + // DocHandler has finished its task. iDocHandlerUsesTheUi = EFalse; // Schedule the next download: #ifdef _DEBUG @@ -1888,12 +1894,12 @@ #else TRAP_IGNORE( iRegistryModel.UserInteractions().SchedulePostponedDownloadL() ); #endif // _DEBUG - + if ( iHandlerObserver ) { iHandlerObserver->NotifyHandlerExit( iHandledDownload, aReason ); } - + CLOG_LEAVEFN("CUserInteractionsUtils::HandleServerAppExit"); } @@ -1914,7 +1920,7 @@ RTelServer telServer; RMobilePhone mobilePhone; - RMobilePhone::TMobilePhoneNetworkMode networkMode; + RMobilePhone::TMobilePhoneNetworkMode networkMode; User::LeaveIfError( telServer.Connect() ); User::LeaveIfError( telServer.LoadPhoneModule( KMmTsyModuleName ) ); @@ -1964,7 +1970,7 @@ TAiwVariant terminateVariant( browserTerminate ); TAiwGenericParam genericParamTerm( EGenericParamTerminate, terminateVariant ); genParList->AppendL( genericParamTerm ); - + HBufC8* param8 = HBufC8::NewLC( KMinLength ); // Must be large enough!! TPtr8 paramPtr8 = param8->Des(); RDesWriteStream writeStream( paramPtr8 ); @@ -1973,9 +1979,9 @@ writeStream.CommitL(); writeStream.Close(); - + TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); - + TBool isProgressive (EFalse); TInt downloadCnt = iRegistryModel.DownloadCount(); const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads(); @@ -1986,31 +1992,31 @@ dl->GetBoolAttribute( EDlAttrProgressive, isProgressive ); if(isProgressive) { - break; + break; } - } + } for( TInt i = 0; i < KDocPDAppUidCount; i++ ) { TUid KTestPdPlayerUid = {KDocPDAppUidList[ i ]}; - TApaTask task = taskList.FindApp(KTestPdPlayerUid ); // task for MP app + TApaTask task = taskList.FindApp(KTestPdPlayerUid ); // task for MP app if ( task.Exists() && ( isProgressive || aProgressiveDownloadLaunched ) ) { if ( isProgressive ) - { + { RHttpDownload* dl = downloads.At(j); // current download - //This Atribute will tell if MP called Delete - //on exit of Browser + //This Atribute will tell if MP called Delete + //on exit of Browser dl->SetBoolAttribute( EDlAttrProgressive, EFalse ); } - // 8-bit buffer is required. + // 8-bit buffer is required. task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used task.BringToForeground(); } } CleanupStack::PopAndDestroy( param8 ); CleanupStack::PopAndDestroy( genParList ); - - CLOG_LEAVEFN("CUserInteractionsEventHandler::SendMsgTerminateToPdAppsL"); + + CLOG_LEAVEFN("CUserInteractionsEventHandler::SendMsgTerminateToPdAppsL"); } @@ -2028,28 +2034,28 @@ CleanupClosePushL( connMon ); User::LeaveIfError( connMon.ConnectL() ); - TConnMonIapInfoBuf infoBuf; - infoBuf().iCount = 0; - + TConnMonIapInfoBuf infoBuf; + infoBuf().iCount = 0; + // Get WLAN IAPs to infoBuf connMon.GetPckgAttribute( EBearerIdWLAN ,0 , KIapAvailability, infoBuf, status ); - User::WaitForRequest( status ); + User::WaitForRequest( status ); - CleanupStack::PopAndDestroy( &connMon ); + CleanupStack::PopAndDestroy( &connMon ); if ( !status.Int() && infoBuf().iCount ) { return ETrue; - } - + } + return EFalse; - } + } // ------------------------------------------------------------ // CUserInteractionsUtils::CanLaunchAsProgDownload() -// Check if several conditions are met for Progressive Playback +// Check if several conditions are met for Progressive Playback // ------------------------------------------------------------ -// +// TBool CUserInteractionsUtils::CanLaunchAsProgDownload( RHttpDownload& aDownload, CDownloadMgrUiDownloadsList& dlList, @@ -2083,38 +2089,38 @@ // --------------------------------------------------------- // CUserInteractionsUtils::UpdateDCFRepositoryL() -// Update saved file to DCFRepository +// Update saved file to DCFRepository // --------------------------------------------------------- -// +// void CUserInteractionsUtils::UpdateDCFRepositoryL( const TDesC& aFileName ) { CLOG_ENTERFN( "CUserInteractionsUtils::UpdateDCFRepositoryL" ); CLOG_WRITE_FORMAT( " :aFileName=%S", &aFileName ); CDcfEntry* dcfEntry = NULL; - dcfEntry = CDcfEntry::NewL(); + dcfEntry = CDcfEntry::NewL(); CleanupStack::PushL( dcfEntry ); - + CDcfRep* dcfRep = NULL; dcfRep = CDcfRep::NewL(); CleanupStack::PushL( dcfRep ); - dcfEntry->SetLocationL( aFileName, 0 ); + dcfEntry->SetLocationL( aFileName, 0 ); CLOG_WRITE(" : SetLocationL OK"); dcfRep->UpdateL( dcfEntry ); CLOG_WRITE(" :UpdateL OK"); CleanupStack::PopAndDestroy(2); // dcfEntry, dcfRep CLOG_LEAVEFN("CUserInteractionsUtils::UpdateDCFRepositoryL"); - } - + } + // --------------------------------------------------------- // CUserInteractionsUtils::IsCodDownload() -// return true if its a COD DL +// return true if its a COD DL // --------------------------------------------------------- -// +// TBool CUserInteractionsUtils::IsCodDownload() { return iCodDownload; - } + } // End of file.