ncdengine/engine/transport/src/catalogshttpdownload.cpp
branchRCL_3
changeset 11 3ba40be8e484
parent 0 ba25891c3a9e
child 25 7333d7932ef7
--- a/ncdengine/engine/transport/src/catalogshttpdownload.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/engine/transport/src/catalogshttpdownload.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -1044,7 +1044,8 @@
 
     // was >=, DL manager should give us proper errors but it doesn't always
     if ( ( statusCode == KHttpErrorStatus ||
-           globalErrorId == KGenericSymbianHttpError ) && 
+           globalErrorId == KGenericSymbianHttpError ||
+           globalErrorId == KErrDisMounted) && 
          aEvent.iDownloadState != EHttpDlFailed ) 
         {
         DLTRACE(("Setting download as failed because received a response >= 400" ));
@@ -2422,7 +2423,16 @@
     
     TFileName filename = iConfig->Filename();
     TDataType type( ContentType() );
-    iOwner.DocumentHandler().CheckFileNameExtension( filename, type );
+    
+    // Doc handler does not yet support Widget extension change
+    TFileName mimeType;
+    mimeType.Copy(type.Des8());
+    if ( mimeType.Compare(KMimeTypeMatchWidget) == 0 )
+            {
+            ReplaceExtension( filename, KWidgetExtension );
+            }
+    else
+       iOwner.DocumentHandler().CheckFileNameExtension( filename, type );
     
     iConfig->SetFilenameL( filename );        
     }
@@ -2650,3 +2660,18 @@
     return *iEncodedUri;
     }
 
+// ---------------------------------------------------------
+// CCatalogsHttpDownload::ReplaceExtension()
+// Replace current extension at aName with extension given (eExt).
+// ---------------------------------------------------------
+//      
+void CCatalogsHttpDownload::ReplaceExtension( TDes& aName, const TDesC& aExt )
+    {
+    
+    TInt dotPos = aName.LocateReverse( '.' );
+    if ( dotPos != KErrNotFound )
+       {
+       aName.Delete( dotPos, aName.Length()- dotPos );
+       aName.Append( aExt );
+       }
+    }