browserutilities/browserdialogsprovider/Src/BrowserDialogsProvider.cpp
changeset 8 7c90e6132015
parent 0 dd21522fd290
child 27 60c5402cb945
--- a/browserutilities/browserdialogsprovider/Src/BrowserDialogsProvider.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/browserdialogsprovider/Src/BrowserDialogsProvider.cpp	Fri May 08 08:25:06 2009 +0300
@@ -54,11 +54,11 @@
 #include <StringLoader.h>				// strings
 #include <f32file.h>
 #include <THttpFields.h>
+#include <textresolver.h>
 
 // Resources
 #include <coneresloader.h>
 #include <BrowserDialogsProvider.rsg>
-#include <ErrorRes.rsg>
 
 // Data Caging
 #include <data_caging_path_literals.hrh>    
@@ -71,7 +71,6 @@
 
 // DLL resource file name with path
 _LIT( KBrowserDialogsProviderDirAndFile, "z:BrowserDialogsProvider.rsc" );// resource
-_LIT( KErrorResDirAndFile, "z:ErrorRes.rsc" );  // error resource
 
 //Mime Types
 _LIT( KMimeTypeImage, "image/*" );
@@ -91,9 +90,7 @@
 :   iCoeEnv( *CCoeEnv::Static() ), 
     iObserver( aObserver ),
     iResourceLoader( iCoeEnv ),    
-    iResourceOpened( EFalse ),    
-    iErrResourceLoader( iCoeEnv ),    
-    iErrResourceOpened( EFalse )    
+    iResourceOpened( EFalse )
 	{
 	}
 
@@ -132,7 +129,6 @@
 CBrowserDialogsProvider::~CBrowserDialogsProvider()
 	{
 	iResourceLoader.Close();
-	iErrResourceLoader.Close();
 
 	// Delete any dialogs
 	CancelAll();
@@ -152,7 +148,9 @@
 EXPORT_C void CBrowserDialogsProvider::DialogNotifyErrorL( TInt aErrCode )
 	{
     TInt httpErr = KBrCtlHttpErrorsOffset - aErrCode;
-
+	CTextResolver* textresolver = CTextResolver::NewLC(); 
+	TPtrC msg;
+		
     switch ( httpErr )
         {
         case EHttpMultipleChoices: 
@@ -160,21 +158,21 @@
         case EHttpMovedTemporarily:
         case EHttpTemporaryRedirect:
             {
-            // Handle the redirect error dialog
-            HBufC* msg = NULL;
-            msg = StringLoader::LoadLC( R_NW_STAT_TOO_MANY_REDIRECTS );
-            DialogNoteL( *msg );
-    		CleanupStack::PopAndDestroy();	// msg
+            // Id for r_nw_stat_too_many_redirects is -20019, browser errors start at -20000 
+            msg.Set( textresolver->ResolveErrorString( KErrTooManyRedirects ));  
             break;
             }
         default:
             {
             // Handle all others as system error dialog
-        	iCoeEnv.HandleError( aErrCode );
-        	break;
+            msg.Set( textresolver->ResolveErrorString( aErrCode ));            
+        	  break;
             }
         }   // end of switch
 	
+       DialogNoteL( msg );
+       CleanupStack::PopAndDestroy(); //textresolver
+       
 	if ( iObserver )
     	{
     	iObserver->ReportDialogEventL( 
@@ -192,6 +190,8 @@
 								TInt aErrCode, const TDesC& /*aUri*/ )
 	{
     TInt httpErr = KBrCtlHttpErrorsOffset - aErrCode;
+    CTextResolver* textresolver = CTextResolver::NewLC(); 
+	TPtrC msg;	
 
     switch ( httpErr )
         {
@@ -200,20 +200,29 @@
         case EHttpMovedTemporarily:
         case EHttpTemporaryRedirect:
             {
-            // Handle the redirect error dialog
-            HBufC* msg = NULL;
-            msg = StringLoader::LoadLC( R_NW_STAT_TOO_MANY_REDIRECTS );
-            DialogNoteL( *msg );
-    		CleanupStack::PopAndDestroy();	// msg
-            break;
+            // Handle the redirect error dialog browser errors start from -20000 ,id for r_nw_stat_malformed_url is -20019.
+			msg.Set( textresolver->ResolveErrorString( KErrTooManyRedirects ));  
+			DialogNoteL( msg );
+            break;     
             }
+        case EHttpBadGateway:
+	        {
+    	    // Handle the unresolved dns name error dialog
+    	    HBufC* msg = NULL;
+        	msg = StringLoader::LoadLC( R_BROWSER_NOT_VALID_DNS_NAME);
+			DialogNoteL( *msg );			
+			CleanupStack::PopAndDestroy();	// msg
+			break;
+        	}
         default:
             {
             // Handle all others as system error dialog
-        	iCoeEnv.HandleError( aErrCode );
-        	break;
+            msg.Set( textresolver->ResolveErrorString( aErrCode ));     
+			DialogNoteL( msg );
+            break;
             }
-        }   // end of switch
+        }   // end of switch			 
+    CleanupStack::PopAndDestroy(); //textresolver    
 	
     if ( iObserver )
         {
@@ -1220,33 +1229,6 @@
             User::Leave( error );
             }
         }
-
-    if ( !iErrResourceOpened )
-        {
-        // Add error resource file.
-        TParse* errfp = new(ELeave) TParse(); 
-
-        TInt err = errfp->Set( KErrorResDirAndFile, 
-                               &KDC_RESOURCE_FILES_DIR, 
-                               NULL ); 
-        if ( err != KErrNone)
-            {
-            User::Leave( err );
-            }   
-    
-        TFileName errResourceFileName = errfp->FullName();
-        delete errfp;
-
-        TRAPD( error, iErrResourceLoader.OpenL( errResourceFileName ) );
-        if ( !error )
-            {
-            iErrResourceOpened = ETrue;
-            }
-        else
-            {
-            User::Leave( error );
-            }
-        }
     }