ncdengine/engine/transport/src/catalogshttpdownload.cpp
branchRCL_3
changeset 11 3ba40be8e484
parent 0 ba25891c3a9e
child 25 7333d7932ef7
equal deleted inserted replaced
9:51c0f5edf5ef 11:3ba40be8e484
     1 /*
     1 /*
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  1042 	DLINFO( ("Global error id: %i", globalErrorId ) );
  1042 	DLINFO( ("Global error id: %i", globalErrorId ) );
  1043 	
  1043 	
  1044 
  1044 
  1045     // was >=, DL manager should give us proper errors but it doesn't always
  1045     // was >=, DL manager should give us proper errors but it doesn't always
  1046     if ( ( statusCode == KHttpErrorStatus ||
  1046     if ( ( statusCode == KHttpErrorStatus ||
  1047            globalErrorId == KGenericSymbianHttpError ) && 
  1047            globalErrorId == KGenericSymbianHttpError ||
       
  1048            globalErrorId == KErrDisMounted) && 
  1048          aEvent.iDownloadState != EHttpDlFailed ) 
  1049          aEvent.iDownloadState != EHttpDlFailed ) 
  1049         {
  1050         {
  1050         DLTRACE(("Setting download as failed because received a response >= 400" ));
  1051         DLTRACE(("Setting download as failed because received a response >= 400" ));
  1051         aEvent.iDownloadState = EHttpDlFailed;
  1052         aEvent.iDownloadState = EHttpDlFailed;
  1052         }
  1053         }
  2420     // the whole path and sets it to iConfig->Filename()
  2421     // the whole path and sets it to iConfig->Filename()
  2421     UpdateFilenameL();
  2422     UpdateFilenameL();
  2422     
  2423     
  2423     TFileName filename = iConfig->Filename();
  2424     TFileName filename = iConfig->Filename();
  2424     TDataType type( ContentType() );
  2425     TDataType type( ContentType() );
  2425     iOwner.DocumentHandler().CheckFileNameExtension( filename, type );
  2426     
       
  2427     // Doc handler does not yet support Widget extension change
       
  2428     TFileName mimeType;
       
  2429     mimeType.Copy(type.Des8());
       
  2430     if ( mimeType.Compare(KMimeTypeMatchWidget) == 0 )
       
  2431             {
       
  2432             ReplaceExtension( filename, KWidgetExtension );
       
  2433             }
       
  2434     else
       
  2435        iOwner.DocumentHandler().CheckFileNameExtension( filename, type );
  2426     
  2436     
  2427     iConfig->SetFilenameL( filename );        
  2437     iConfig->SetFilenameL( filename );        
  2428     }
  2438     }
  2429 
  2439 
  2430 
  2440 
  2648     {
  2658     {
  2649     DASSERT( iEncodedUri );
  2659     DASSERT( iEncodedUri );
  2650     return *iEncodedUri;
  2660     return *iEncodedUri;
  2651     }
  2661     }
  2652 
  2662 
       
  2663 // ---------------------------------------------------------
       
  2664 // CCatalogsHttpDownload::ReplaceExtension()
       
  2665 // Replace current extension at aName with extension given (eExt).
       
  2666 // ---------------------------------------------------------
       
  2667 //      
       
  2668 void CCatalogsHttpDownload::ReplaceExtension( TDes& aName, const TDesC& aExt )
       
  2669     {
       
  2670     
       
  2671     TInt dotPos = aName.LocateReverse( '.' );
       
  2672     if ( dotPos != KErrNotFound )
       
  2673        {
       
  2674        aName.Delete( dotPos, aName.Length()- dotPos );
       
  2675        aName.Append( aExt );
       
  2676        }
       
  2677     }