コード例 #1
0
void MsgAudioPreview::PlayL()
    {
    if( IsPlaying() )
        {
        Stop();
        return;
        }
    //sequence for playing a beep once sound
    _LIT8( KFileListBeepSequence, "\x00\x11\x06\x0A\x08\x73\x0A\x40\x28\x0A\xF7\
    \x05\xFC\x40\x64\x0A\x08\x40\x32\x0A\xF7\x06\x0B" ); 

    // rng mime type
    _LIT( KFileListRngMimeType, "application/vnd.nokia.ringing-tone" );
    
    Cancel(); // stop previous play
    
    if ( !iFullName || iFullName->Des().Length() == 0 )
        {
        User::Leave( KErrNotFound );
        }

    TRAP_IGNORE( ReadActiveProfileL() );

    TPtrC fileName( iFullName->Des() );
    TDataType dataType;
    TInt err = GetDataType( fileName, dataType );
    if ( err == KErrNotFound )
        {
        fileName.Set( iDefaultTone );
        if ( fileName.Length() == 0 )
             {
             User::Leave( KErrNotFound );
             }
        }
    else if ( err != KErrNone )
        {
        User::Leave( err );
        }
        
    TBool mimeTypeRng = EFalse;
    
    if ( err == KErrNone )
        {
        if( dataType.Des().CompareF( KFileListRngMimeType ) == 0 )
            {
            mimeTypeRng = ETrue;
            }
        }

    TInt ringingType = RingingType();
    if ( ringingType == ERingingTypeBeepOnce )
        {
        // Active profile ringing tone is set to Beep Once
        // Don't initialize a FileSequence but use DesSequence instead
        iTonePlayer = CMdaAudioToneUtility::NewL( *this );
        iTonePlayer->PrepareToPlayDesSequence( KFileListBeepSequence() );
        iTonePlayerStatus = EPlayerInitializing;
        }
    else
        {
        if( mimeTypeRng )
            {
            //Ringingtone is a RNG-file
            iTonePlayer = CMdaAudioToneUtility::NewL( *this );
            iTonePlayer->PrepareToPlayFileSequence( fileName );
            iTonePlayerStatus = EPlayerInitializing;
            }
        else
            {
            delete iAudioPlayer;
            iAudioPlayer = 0;

            iAudioPlayer = CDrmPlayerUtility::NewFilePlayerL(
                fileName, *this, KAudioPriorityRingingTonePreview,
                ( TMdaPriorityPreference )KAudioPrefRingFilePreview );
    
            iAudioPlayerStatus = EPlayerInitializing;
            }
        }
    DisableBackLight();
    }
コード例 #2
0
void CAknFileSelectionModel::AppendIconForFileL(const TDesC& aFileName)
    {
    //TFileName absFileName( iCurrentPath.DriveAndPath() );
    HBufC *bufAbsFileName = HBufC::NewLC(KMaxPath);
    *bufAbsFileName = iCurrentPath.DriveAndPath();
    TPtr absFileName = bufAbsFileName->Des();

    absFileName.Append( aFileName );
    TUid uidIgnore;
    TDataType dataType;
    TInt err = iApaSession.AppForDocument( absFileName, uidIgnore, dataType );
    TInt iconIndex = EUnknowTypeIcon;
    CleanupStack::PopAndDestroy(); //bufAbsFileName

    if( err != KErrNone )
        {
        // Couldn't find out the data type, use generic file icon:
        iconIndex = EUnknowTypeIcon;
        }
    else
        {
        HBufC *bufDataTypeBuf = HBufC::NewLC(KMaxDataTypeLength);
        *bufDataTypeBuf = dataType.Des();
        TPtr dataTypeBuf = bufDataTypeBuf->Des();

        if( dataTypeBuf.MatchF( KCFDMimeTypeAudioVoiceRec ) == 0 ||
            dataTypeBuf.MatchF( KCFDMimeTypeAudioVoiceRec2 ) == 0 )
            {
            iconIndex = EVoiceRecFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypePlaylist ) == 0 )
            {
            iconIndex = EPlaylistFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeRam ) == 0 )
            {
            iconIndex = ELinkFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeAudio ) == 0 )
            {
            iconIndex = ESoundFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeImageGms ) == 0 )
            {
            iconIndex = EGmsFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeImage ) == 0 )
            {
            iconIndex = EImageFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeVideo ) == 0 ||
                 dataTypeBuf.MatchF( KCFDMimeTypeVideoRealMedia ) == 0 ||
                 dataTypeBuf.MatchF( KCFDMimeTypeVideoSdp ) == 0 )
            {
            iconIndex = EVideoFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeGame ) == 0 )
            {
            iconIndex = EGameFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeNote ) == 0 )
            {
            iconIndex = ENoteFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeJava ) == 0 )
            {
            iconIndex = EJavaFileIcon;
            }
        else if ( dataTypeBuf.MatchF( KCFDMimeTypeFlash ) == 0 )
            {
            iconIndex = EFlashFileIcon;
            }
        else
            {
            // Check from the file name extension, if it's a SIS file:
            //TParse fileName;
            //fileName.Set( aFileName, NULL, NULL );

            HBufC * bufFileName = aFileName.AllocLC();
            TPtr ptrFileName = bufFileName->Des();
            TParsePtr fileName(ptrFileName);

            TPtrC ext( fileName.Ext() );
            if( ext.CompareF( KCFDFileExtSis ) == 0
                || ext.CompareF( KCFDFileExtSisx ) == 0 )
                {
                iconIndex = ESisFileIcon;
                }
            // RApaLsSession does not recognize .mid's:
            else if( ext.CompareF( KCFDFileExtMid ) == 0 )
                {
                iconIndex = ESoundFileIcon;
                }
            else
                {
                iconIndex = EUnknowTypeIcon;
                }
            CleanupStack::PopAndDestroy(); //bufFileName

            }

        CleanupStack::PopAndDestroy(); //bufDataTypeBuf
        }
    iImageIndexArray.Append( iconIndex );
    }
コード例 #3
0
TVerdict CMultipartContent::doTestStepL()
	{
	_LIT(KxcafMime, "application/x-caf");
	
	TPtrC contentXml;
	TPtrC contentXml2;
	TPtrC outputFile;
	TPtrC outputFile2;
	TPtrC contentFile;
	TPtrC contentFile2;
	GetStringFromConfig(ConfigSection(),_L("ContentDescription"),contentXml);
	GetStringFromConfig(ConfigSection(),_L("ContentDescription2"),contentXml2);
	GetStringFromConfig(ConfigSection(),_L("OutputFile"),outputFile);
	GetStringFromConfig(ConfigSection(),_L("OutputFile2"),outputFile2);
	GetStringFromConfig(ConfigSection(),_L("ContentFile"), contentFile);
	GetStringFromConfig(ConfigSection(),_L("ContentFile2"), contentFile2);
	__UHEAP_MARK;	
	
	INFO_PRINTF1(_L("Creating DRM archive using the following parameters"));
	INFO_PRINTF2(_L("		Content Xml Description : %S"),&contentXml);
	INFO_PRINTF2(_L("		Output File             : %S"),&outputFile);
	INFO_PRINTF2(_L("		Output File2             : %S"),&outputFile2);
	INFO_PRINTF2(_L("		Content File            : %S"),&contentFile);
	INFO_PRINTF2(_L("		Content File2            : %S"),&contentFile2);

	// will need to modify the output file name
	TFileName outputFileName;
	TFileName outputFileName2;
	outputFileName.Copy(outputFile);
	outputFileName2.Copy(outputFile2);

	TBuf8 <KMaxDataTypeLength> mimeType;
	
	// Pass empty path to rights file to produce a ".content" file
	User::LeaveIfError(CRefTestAgentArchive::CreateArchive(contentXml, _L(""), outputFileName, mimeType));
	User::LeaveIfError(CRefTestAgentArchive::CreateArchive(contentXml2, _L(""), outputFileName2, mimeType));


	TDataType dataType;
	TUid uid = KNullUid;

	// Use the Application Architecture Server to find the Mime type 

	RApaLsSession apparcSession;
	User::LeaveIfError(apparcSession.Connect());
	CleanupClosePushL(apparcSession);
	User::LeaveIfError(apparcSession.AppForDocument(contentFile, uid, dataType));
	// dataType should be of type "application/x-caf"
	if (dataType.Des() != KxcafMime)
    	{
    	SetTestStepResult(EFail);
    	}
	User::LeaveIfError(apparcSession.AppForDocument(contentFile2, uid, dataType));
	// dataType should not be of type "application/x-caf"
	if (dataType.Des() == KxcafMime)
    	{
    	SetTestStepResult(EFail);
    	}
    
    CleanupStack::PopAndDestroy(&apparcSession);
    
    __UHEAP_MARKEND;
    
    
    
	return TestStepResult();
	}