messagingapp/msgui/msgaudiofetcher/src/msgaudiopreview.cpp
changeset 37 518b245aa84c
equal deleted inserted replaced
25:84d9eb65b26f 37:518b245aa84c
       
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  * 
       
    12  * Contributors:
       
    13  * 
       
    14  * Description:
       
    15  *     The source file for tone previewing.
       
    16  *     
       
    17  */
       
    18 #include "msgaudiopreview.h"
       
    19 #include <AudioPreference.h>             // KAudioPriorityPreview
       
    20 #include <c3dringingtoneinterface.h>     // C3DRingingToneInterface
       
    21 #include <ctsydomainpskeys.h>            // for phone call states
       
    22 #include <MProfileEngine.h>
       
    23 #include <MProfile.h>
       
    24 #include <MProfileTones.h>
       
    25 #include "TProfileToneSettings.h"
       
    26 #include <MProfileExtraSettings.h>
       
    27 #include <MProfile3DToneSettings.h>
       
    28 #include <ProfileInternal.hrh>
       
    29 #include <ProfileEngineDomainCRKeys.h>   // KProEngDefaultRingingTone
       
    30 #include <XQConversions>
       
    31 #include <QChar>
       
    32 #include <QDir>
       
    33 
       
    34 
       
    35 CMFPreviewHandlerBase::CMFPreviewHandlerBase( QObject *parent  ) : QObject( parent )
       
    36     {
       
    37     iMediaType = KErrNotFound;
       
    38     iRingingVolume = KErrNotFound;
       
    39     iRingingType = KErrNotFound;
       
    40     iVibra = KErrNotFound;
       
    41     i3DEffect = KErrNotFound;
       
    42     i3DEcho = KErrNotFound;
       
    43     iFileSize = KErrNotFound;    
       
    44     iFullName = 0;    
       
    45     iActiveProfileRead = EFalse;
       
    46     iPlayerStatus = EPlayerNotCreated;
       
    47 
       
    48     }
       
    49 
       
    50 void CMFPreviewHandlerBase::ConstructL()
       
    51     {
       
    52     // To allow/not allow screensaver
       
    53     // Errors ignored, no actions needed if API is not available
       
    54     //iProperty.Attach( KPSUidScreenSaver, KScreenSaverAllowScreenSaver );    
       
    55     TRAP_IGNORE(User::LeaveIfError( iApaSession.Connect() ) );
       
    56     
       
    57     TRAP_IGNORE( ReadDefaultToneL() );
       
    58     // To keep backlight on while a video is being previewed
       
    59     iBacklightTimer = CPeriodic::NewL( EPriorityLow );
       
    60     }
       
    61 
       
    62 CMFPreviewHandlerBase::~CMFPreviewHandlerBase()
       
    63     {
       
    64     delete iFullName;
       
    65     iProperty.Close();
       
    66     iApaSession.Close();
       
    67     }
       
    68 
       
    69 void CMFPreviewHandlerBase::SetAttr(const QString &file )
       
    70     {
       
    71     if ( !file.isNull() )
       
    72         {
       
    73         QString path = normalizeSeperator(file);
       
    74         delete iFullName;
       
    75         iFullName = 0;
       
    76         iFullName = XQConversions::qStringToS60Desc( path );         
       
    77         }
       
    78     }
       
    79 
       
    80 TInt CMFPreviewHandlerBase::RingingVolume()
       
    81     {
       
    82     const TInt KDefaultVolumeLevel = 7; // see profile.hrh for volume levels
       
    83     
       
    84     if ( iRingingVolume != KErrNotFound )
       
    85         {
       
    86         return iRingingVolume;
       
    87         }
       
    88         
       
    89     if ( iActiveProfileRead )
       
    90         {
       
    91         return iActiveProfileRingingVolume;
       
    92         }
       
    93 
       
    94     return KDefaultVolumeLevel;
       
    95     }
       
    96 
       
    97 TInt CMFPreviewHandlerBase::RingingType()
       
    98     {
       
    99     if ( iRingingType != KErrNotFound )
       
   100         {
       
   101         return iRingingType;
       
   102         }
       
   103         
       
   104     if ( iActiveProfileRead )
       
   105         {
       
   106         return iActiveProfileRingingType;
       
   107         }
       
   108 
       
   109     return ERingingTypeRinging;
       
   110     }
       
   111 
       
   112 TInt CMFPreviewHandlerBase::Vibra()
       
   113     {
       
   114     if ( iVibra != KErrNotFound )
       
   115         {
       
   116         return iVibra;
       
   117         }
       
   118         
       
   119     if ( iActiveProfileRead )
       
   120         {
       
   121         return iActiveProfileVibra;
       
   122         }
       
   123     
       
   124     return 0;  // in case of error vibra is off
       
   125     }
       
   126 
       
   127 TInt CMFPreviewHandlerBase::Echo3D()
       
   128     {
       
   129     if ( i3DEcho != KErrNotFound )
       
   130         {
       
   131         return i3DEcho;
       
   132         }
       
   133     
       
   134     if ( iActiveProfileRead )
       
   135         {
       
   136         return iActiveProfile3DEcho;
       
   137         }
       
   138 
       
   139     return EProfile3DEchoOff;  // from ProfileInternal.hrh
       
   140     }
       
   141 
       
   142 TInt CMFPreviewHandlerBase::Effect3D()
       
   143     {
       
   144     if ( i3DEffect != KErrNotFound )
       
   145         {
       
   146         return i3DEffect;
       
   147         }
       
   148     
       
   149     if ( iActiveProfileRead )
       
   150         {
       
   151         return iActiveProfile3DEffect;
       
   152         }
       
   153 
       
   154     return EProfile3DEffectOff;
       
   155     }
       
   156 
       
   157 TInt CMFPreviewHandlerBase::ConvertVolume( TInt aVolume, TInt aMaxVolume )
       
   158     {
       
   159     const TInt KMinVolumeLevel = 1;
       
   160     const TInt KMaxVolumeLevel = 10;
       
   161         
       
   162     TInt result = aMaxVolume * aVolume / KMaxVolumeLevel;
       
   163     
       
   164     // if user has selected minimum volume level set HW volume 1
       
   165     if ( aVolume == KMinVolumeLevel && result == 0 )
       
   166         {
       
   167         result = 1;
       
   168         }
       
   169 
       
   170     return result;
       
   171     }
       
   172   
       
   173 void CMFPreviewHandlerBase::ReadActiveProfileL()
       
   174     {
       
   175     iActiveProfileRead = EFalse;
       
   176     
       
   177     MProfileEngine* profileEngine = CreateProfileEngineL();
       
   178     CleanupReleasePushL( *profileEngine );
       
   179     
       
   180     MProfile* activeProfile  = profileEngine->ActiveProfileL();
       
   181     CleanupReleasePushL( *activeProfile );
       
   182         
       
   183     const MProfileTones& profileTones = activeProfile->ProfileTones();
       
   184      
       
   185     const TProfileToneSettings& toneSettings = profileTones.ToneSettings();
       
   186     iActiveProfileVibra = toneSettings.iVibratingAlert;
       
   187     iActiveProfileRingingVolume = toneSettings.iRingingVolume;
       
   188     iActiveProfileRingingType = toneSettings.iRingingType;
       
   189           
       
   190     const MProfileExtraSettings& extra = activeProfile->ProfileExtraSettings();
       
   191     const MProfile3DToneSettings& threeD = extra.Profile3DToneSettings();
       
   192     
       
   193     iActiveProfile3DEffect = threeD.Effect();
       
   194     iActiveProfile3DEcho = threeD.Echo();
       
   195    
       
   196     CleanupStack::PopAndDestroy( activeProfile ); 
       
   197     CleanupStack::PopAndDestroy( profileEngine );
       
   198     
       
   199     iActiveProfileRead = ETrue;
       
   200     }
       
   201  
       
   202 void CMFPreviewHandlerBase::ReadDefaultToneL()
       
   203     {
       
   204     CRepository* cenrep = CRepository::NewLC( KCRUidProfileEngine );
       
   205 
       
   206     User::LeaveIfError( cenrep->Get( KProEngDefaultRingingTone, iDefaultTone ) );
       
   207     CleanupStack::PopAndDestroy( cenrep );
       
   208     }
       
   209 
       
   210 TInt CMFPreviewHandlerBase::GetDataType( const TDesC& aFileName, TDataType& aDataType )
       
   211     {
       
   212     TUid dummyUid( KNullUid );
       
   213     return iApaSession.AppForDocument( aFileName, dummyUid, aDataType );
       
   214     }
       
   215 
       
   216 TInt CMFPreviewHandlerBase::DoResetInactivityTimer( TAny* /*aObject*/ )
       
   217     {
       
   218     User::ResetInactivityTime();
       
   219     return KErrNone;
       
   220     }
       
   221 
       
   222 void CMFPreviewHandlerBase::DisableBackLight()
       
   223     {
       
   224         const TInt KResetInactivityTimerDelay = 2000000;
       
   225     iBacklightTimer->Cancel(); // Just in case
       
   226     // Disable backlight turn off during video preview
       
   227     iBacklightTimer->Start( KResetInactivityTimerDelay,
       
   228                             KResetInactivityTimerDelay,
       
   229                             TCallBack( DoResetInactivityTimer, 0 ) );
       
   230     
       
   231     }
       
   232 
       
   233 
       
   234 
       
   235 MsgAudioPreview::MsgAudioPreview( QObject *parent ) : CMFPreviewHandlerBase( parent )
       
   236     {
       
   237     iAudioPlayerStatus = EPlayerNotCreated;
       
   238     TRAP_IGNORE(CMFPreviewHandlerBase::ConstructL());
       
   239     iTonePlayerStatus = EPlayerNotCreated;
       
   240     }
       
   241 
       
   242 MsgAudioPreview::~MsgAudioPreview()
       
   243     {
       
   244     Cancel();
       
   245     
       
   246     delete iAudioPlayer;
       
   247     delete iTonePlayer;
       
   248     delete i3dRingingTonePlugin;
       
   249     }
       
   250 
       
   251 TBool MsgAudioPreview::IsPlaying()
       
   252     {
       
   253     if ( iAudioPlayerStatus != EPlayerNotCreated )
       
   254         {
       
   255         return ETrue;
       
   256         }
       
   257     
       
   258     if ( iTonePlayerStatus != EPlayerNotCreated )
       
   259         {
       
   260         return ETrue;
       
   261         }
       
   262 
       
   263     return EFalse;
       
   264     }
       
   265 
       
   266 void MsgAudioPreview::Play()
       
   267     {
       
   268     TRAP_IGNORE(PlayL());
       
   269     }
       
   270 
       
   271 void MsgAudioPreview::PlayL()
       
   272     {
       
   273     if( IsPlaying() )
       
   274         {
       
   275         Stop();
       
   276         return;
       
   277         }
       
   278     //sequence for playing a beep once sound
       
   279     _LIT8( KFileListBeepSequence, "\x00\x11\x06\x0A\x08\x73\x0A\x40\x28\x0A\xF7\
       
   280     \x05\xFC\x40\x64\x0A\x08\x40\x32\x0A\xF7\x06\x0B" ); 
       
   281 
       
   282     // rng mime type
       
   283     _LIT( KFileListRngMimeType, "application/vnd.nokia.ringing-tone" );
       
   284     
       
   285     Cancel(); // stop previous play
       
   286     
       
   287     if ( !iFullName || iFullName->Des().Length() == 0 )
       
   288         {
       
   289         User::Leave( KErrNotFound );
       
   290         }
       
   291 
       
   292     TRAP_IGNORE( ReadActiveProfileL() );
       
   293 
       
   294     TPtrC fileName( iFullName->Des() );
       
   295     TDataType dataType;
       
   296     TInt err = GetDataType( fileName, dataType );
       
   297     if ( err == KErrNotFound )
       
   298         {
       
   299         fileName.Set( iDefaultTone );
       
   300         if ( fileName.Length() == 0 )
       
   301              {
       
   302              User::Leave( KErrNotFound );
       
   303              }
       
   304         }
       
   305     else if ( err != KErrNone )
       
   306         {
       
   307         User::Leave( err );
       
   308         }
       
   309         
       
   310     TBool mimeTypeRng = EFalse;
       
   311     
       
   312     if ( err == KErrNone )
       
   313         {
       
   314         if( dataType.Des().CompareF( KFileListRngMimeType ) == 0 )
       
   315             {
       
   316             mimeTypeRng = ETrue;
       
   317             }
       
   318         }
       
   319 
       
   320     TInt ringingType = RingingType();
       
   321     if ( ringingType == ERingingTypeBeepOnce )
       
   322         {
       
   323         // Active profile ringing tone is set to Beep Once
       
   324         // Don't initialize a FileSequence but use DesSequence instead
       
   325         iTonePlayer = CMdaAudioToneUtility::NewL( *this );
       
   326         iTonePlayer->PrepareToPlayDesSequence( KFileListBeepSequence() );
       
   327         iTonePlayerStatus = EPlayerInitializing;
       
   328         }
       
   329     else
       
   330         {
       
   331         if( mimeTypeRng )
       
   332             {
       
   333             //Ringingtone is a RNG-file
       
   334             iTonePlayer = CMdaAudioToneUtility::NewL( *this );
       
   335             iTonePlayer->PrepareToPlayFileSequence( fileName );
       
   336             iTonePlayerStatus = EPlayerInitializing;
       
   337             }
       
   338         else
       
   339             {
       
   340             delete iAudioPlayer;
       
   341             iAudioPlayer = 0;
       
   342 
       
   343             iAudioPlayer = CDrmPlayerUtility::NewFilePlayerL(
       
   344                 fileName, *this, KAudioPriorityRingingTonePreview,
       
   345                 ( TMdaPriorityPreference )KAudioPrefRingFilePreview );
       
   346     
       
   347             iAudioPlayerStatus = EPlayerInitializing;
       
   348             }
       
   349         }
       
   350     DisableBackLight();
       
   351     }
       
   352 
       
   353 void MsgAudioPreview::Stop()
       
   354     {
       
   355     Cancel();
       
   356     }
       
   357 
       
   358 TInt MsgAudioPreview::ConvertVolume( TInt aVolume )
       
   359     {
       
   360     TInt result = 0;
       
   361     if ( iAudioPlayer )
       
   362         {
       
   363         result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iAudioPlayer->MaxVolume() );
       
   364         }
       
   365     else if ( iTonePlayer )
       
   366         {
       
   367         result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iTonePlayer->MaxVolume() );
       
   368         }
       
   369         
       
   370     //if user has selected silent ringing type, set volume off
       
   371     TInt ringingType = RingingType();
       
   372     if( ringingType == ERingingTypeSilent )
       
   373         {
       
   374         result = 0;
       
   375         }
       
   376 
       
   377     return result;
       
   378     }
       
   379 
       
   380 void MsgAudioPreview::SetToneRingingType( TInt aRingingType )
       
   381     {
       
   382     const TInt KToneInterval = 1000000; // 1 second pause between tones
       
   383     const TInt KAscendingVolumeInterval = 3000000; // 3 seconds
       
   384     
       
   385     if ( !iTonePlayer )
       
   386         {
       
   387         return;
       
   388         }   
       
   389 
       
   390 
       
   391     TInt ringingVolume = RingingVolume();
       
   392 
       
   393     switch( aRingingType )
       
   394         {
       
   395         case ERingingTypeRinging:
       
   396         case ERingingTypeSilent:
       
   397             {
       
   398             iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever,
       
   399                                      TTimeIntervalMicroSeconds( KToneInterval ) );
       
   400             break;
       
   401             }
       
   402         case ERingingTypeAscending:
       
   403             {
       
   404             iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever,
       
   405                                      TTimeIntervalMicroSeconds( KToneInterval ) );
       
   406             
       
   407             TInt volRamp = KAscendingVolumeInterval * ringingVolume;
       
   408             iTonePlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) );
       
   409             break;
       
   410             }
       
   411         case ERingingTypeRingOnce:
       
   412         case ERingingTypeBeepOnce:
       
   413             {
       
   414             iTonePlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) );
       
   415             break;
       
   416             }
       
   417         default:
       
   418             {
       
   419             break;
       
   420             }
       
   421         }
       
   422     }
       
   423 
       
   424 void MsgAudioPreview::SetAudioRingingType( TInt aRingingType )
       
   425     {
       
   426     const TInt KToneInterval = 1000000; // 1 second pause between tones
       
   427     const TInt KAscendingVolumeInterval = 3000000; // 3 seconds
       
   428     
       
   429     if ( !iAudioPlayer )
       
   430         {
       
   431         return;
       
   432         }
       
   433 
       
   434     TInt ringingVolume = RingingVolume();
       
   435         
       
   436     switch( aRingingType )
       
   437         {
       
   438         case ERingingTypeRinging:
       
   439         case ERingingTypeSilent:
       
   440             {
       
   441             iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever,
       
   442                                       TTimeIntervalMicroSeconds( KToneInterval ) );
       
   443             break;
       
   444             }
       
   445         case ERingingTypeAscending:
       
   446             {
       
   447             iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever,
       
   448                                       TTimeIntervalMicroSeconds( KToneInterval ) );
       
   449             TInt volRamp = KAscendingVolumeInterval * ringingVolume;
       
   450             iAudioPlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) );
       
   451             break;
       
   452             }
       
   453         case ERingingTypeRingOnce:
       
   454             {
       
   455             iAudioPlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) );
       
   456             break;
       
   457             }
       
   458 
       
   459         default:
       
   460             {
       
   461             break;
       
   462             }
       
   463         }
       
   464     }
       
   465 
       
   466 void MsgAudioPreview::Cancel()
       
   467     {
       
   468     TBool isPlaying = EFalse;
       
   469     
       
   470     if ( iAudioPlayer )
       
   471         {
       
   472         isPlaying = ETrue;
       
   473         if ( iAudioPlayerStatus == EPlayerPlayingWith3DEffect )
       
   474             {
       
   475             i3dRingingTonePlugin->Stop();
       
   476             // plugin calls AudioPlayer->Stop()
       
   477             iAudioPlayer->Close();
       
   478             }
       
   479         if ( iAudioPlayerStatus == EPlayerPlaying )
       
   480             {
       
   481             iAudioPlayer->Stop();
       
   482             iAudioPlayer->Close();
       
   483             }
       
   484         
       
   485         delete iAudioPlayer;
       
   486         iAudioPlayer = 0;
       
   487         iAudioPlayerStatus = EPlayerNotCreated;
       
   488         }
       
   489     
       
   490     if ( iTonePlayer )
       
   491         {
       
   492         isPlaying = ETrue;
       
   493         if ( iTonePlayerStatus == EPlayerPlaying )
       
   494             {
       
   495             iTonePlayer->CancelPlay();
       
   496             }
       
   497         
       
   498         delete iTonePlayer;
       
   499         iTonePlayer = 0;
       
   500         iTonePlayerStatus = EPlayerNotCreated;
       
   501         }
       
   502         
       
   503 
       
   504     if ( isPlaying )
       
   505         {
       
   506         //User::InfoPrint(_L("cancel"));
       
   507 //        EnableScreenSaver( ETrue );
       
   508         iBacklightTimer->Cancel();
       
   509         }
       
   510     }
       
   511 
       
   512 void MsgAudioPreview::MatoPlayComplete( TInt aError )
       
   513     {
       
   514     Q_UNUSED(aError);
       
   515     Cancel();
       
   516  //   emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError );
       
   517     }
       
   518 
       
   519 void MsgAudioPreview::MatoPrepareComplete( TInt aError )
       
   520     {
       
   521     if ( aError != KErrNone )
       
   522         {
       
   523         Cancel();
       
   524         
       
   525      //   emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError );        
       
   526         return;
       
   527         }
       
   528 
       
   529     TInt ringingVolume = RingingVolume();
       
   530     TInt ringingType = RingingType();
       
   531     TInt vibra = Vibra();
       
   532        
       
   533     iTonePlayerStatus = EPlayerInitialized;
       
   534     SetToneRingingType( ringingType );
       
   535     iTonePlayer->SetVolume( ConvertVolume( ringingVolume ) );
       
   536     
       
   537     TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview;               
       
   538     if ( vibra )
       
   539         {
       
   540         pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra;
       
   541         }
       
   542     iTonePlayer->SetPriority( KAudioPriorityPreview, pref );
       
   543                                              
       
   544     iTonePlayer->Play();
       
   545     iTonePlayerStatus = EPlayerPlaying;
       
   546     }
       
   547 
       
   548 void MsgAudioPreview::MdapcInitComplete( TInt aError, 
       
   549                         const TTimeIntervalMicroSeconds& /* aDuration */ )
       
   550     {
       
   551     if ( aError != KErrNone )
       
   552         {
       
   553         Cancel();
       
   554     //    emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError );
       
   555         return;
       
   556         }
       
   557         
       
   558 
       
   559     TInt ringingVolume = RingingVolume();
       
   560     TInt ringingType = RingingType();
       
   561     TInt vibra = Vibra();
       
   562     TInt echo3D = Echo3D();
       
   563     TInt effect3D = Effect3D();
       
   564 
       
   565     
       
   566 
       
   567     iAudioPlayerStatus = EPlayerInitialized;
       
   568     SetAudioRingingType( ringingType );
       
   569     iAudioPlayer->SetVolume( ConvertVolume( ringingVolume ) );
       
   570     
       
   571     TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview;               
       
   572     if ( vibra )
       
   573         {
       
   574         pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra;
       
   575         }
       
   576     iAudioPlayer->SetPriority( KAudioPriorityPreview, pref );
       
   577      
       
   578     iAudioPlayerStatus = EPlayerPlaying;
       
   579     
       
   580     if ( effect3D == EProfile3DEffectOff )
       
   581         {
       
   582         iAudioPlayer->Play();  // 3D not used
       
   583         return;
       
   584         }
       
   585 
       
   586     if ( !i3dRingingTonePlugin )
       
   587         {
       
   588         TUid emptyUid = { 0 };
       
   589         TRAPD( err, i3dRingingTonePlugin = C3DRingingToneInterface::NewL( emptyUid ) );
       
   590         if ( err != KErrNone || !i3dRingingTonePlugin )
       
   591             {
       
   592             iAudioPlayer->Play();
       
   593             return;
       
   594             }
       
   595         }       
       
   596    
       
   597     i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEffect, effect3D );
       
   598     i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEcho, echo3D );    
       
   599     i3dRingingTonePlugin->SetAttr( E3DRTIAttrDrmPlayerUtility, iAudioPlayer );
       
   600     TRAP_IGNORE( i3dRingingTonePlugin->PlayL() );
       
   601 
       
   602     iAudioPlayerStatus = EPlayerPlayingWith3DEffect;
       
   603     }
       
   604 
       
   605 void MsgAudioPreview::MdapcPlayComplete( TInt aError )
       
   606     {  
       
   607     Q_UNUSED(aError);
       
   608     Cancel();
       
   609   //  emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError );
       
   610     
       
   611     
       
   612     }
       
   613 
       
   614 
       
   615 QString CMFPreviewHandlerBase::normalizeSeperator(const QString &path)
       
   616 {
       
   617     QString standardpath( path );
       
   618     QChar c('/');
       
   619     QChar c1('\\');
       
   620     if (standardpath.contains(c, Qt::CaseSensitive)) {
       
   621         standardpath.replace(c, QDir::separator());
       
   622     }
       
   623     if (standardpath.contains(c1, Qt::CaseSensitive)) {
       
   624         standardpath.replace(c1, QDir::separator());
       
   625     }        
       
   626     return standardpath;
       
   627 }
       
   628 
       
   629