browserutilities/browserdialogsprovider/Src/BrowserDialogsProvider.cpp
changeset 65 5bfc169077b2
parent 37 cb62a4f66ebe
child 68 92a765b5b3e7
equal deleted inserted replaced
42:d39add9822e2 65:5bfc169077b2
    17 
    17 
    18 
    18 
    19 // INCLUDE Files
    19 // INCLUDE Files
    20 
    20 
    21 // User includes
    21 // User includes
    22 #include <browserdialogsprovider.h>	// Class header
    22 #include "BrowserDialogsProvider.h"	// Class header
    23 #include "BrowserDialogsProvider.hrh"
    23 #include "BrowserDialogsProvider.hrh"
    24 #include "BrowserAuthenticationDialog.h"
    24 #include "BrowserAuthenticationDialog.h"
    25 #include "BrowserDialogsProviderConstants.h"
    25 #include "BrowserDialogsProviderConstants.h"
    26 #include <browserdialogsproviderobserver.h> //obs
    26 #include "BrowserDialogsProviderObserver.h" //obs
    27 
    27 
    28 // Browser as a Plugin - own classes
    28 // Browser as a Plugin - own classes
    29 #include "BrowserViewImagesPopup.h"		// For DialogDisplayPageImagesL
    29 #include "BrowserViewImagesPopup.h"		// For DialogDisplayPageImagesL
    30 #include "BrowserScriptPromptDialog.h"	// For DialogPromptLC
    30 #include "BrowserScriptPromptDialog.h"	// For DialogPromptLC
    31 #include "BrowserSelectElementDlg.h"	// For DialogFileSelectLC
    31 #include "BrowserSelectElementDlg.h"	// For DialogFileSelectLC
    59 // Resources
    59 // Resources
    60 #include <coneresloader.h>
    60 #include <coneresloader.h>
    61 #include <BrowserDialogsProvider.rsg>
    61 #include <BrowserDialogsProvider.rsg>
    62 
    62 
    63 // Data Caging
    63 // Data Caging
    64 #include <data_caging_path_literals.hrh>
    64 #include <data_caging_path_literals.hrh>    
    65 
    65 
    66 // CONSTANTS
    66 // CONSTANTS
    67 const TInt KBrCtlObjectElementMaxLength = 50;
    67 const TInt KBrCtlObjectElementMaxLength = 50;
    68 const TInt KBrCtlMBFormat = 4;
    68 const TInt KBrCtlMBFormat = 4;
    69 const TInt KBrCtlGBFormat = 10;
    69 const TInt KBrCtlGBFormat = 10;
    70 const TInt KBrCtlMegabyte = 1000;	// although 1MB=1024 kB, treat as 1000kb for user simplicity
    70 const TInt KBrCtlMegabyte = 1000;	// although 1MB=1024 kB, treat as 1000kb for user simplicity
    71 const TInt KBrowserFileNotFound  = -26003; // Defined in ErrorDefs.h but not exported so define here
       
    72 
    71 
    73 // DLL resource file name with path
    72 // DLL resource file name with path
    74 _LIT( KBrowserDialogsProviderDirAndFile, "z:BrowserDialogsProvider.rsc" );// resource
    73 _LIT( KBrowserDialogsProviderDirAndFile, "z:BrowserDialogsProvider.rsc" );// resource
    75 
    74 
    76 //Mime Types
    75 //Mime Types
   164             DialogNoteL( msg );
   163             DialogNoteL( msg );
   165             break;
   164             break;
   166             }
   165             }
   167         default:
   166         default:
   168             {
   167             {
   169             // change error code to browser error code, when trying to open file
   168             // Handle all others as system error dialog
   170             // that doesn't exist
   169             CCoeEnv::Static()->HandleError( aErrCode );
   171             if ( KErrNotFound == aErrCode )
       
   172             	{
       
   173             	iCoeEnv.HandleError( KBrowserFileNotFound );
       
   174             	}
       
   175             else
       
   176             	{
       
   177 				// Handle all others as system error dialog
       
   178             	iCoeEnv.HandleError( aErrCode );
       
   179             	}
       
   180         	break;
   170         	break;
   181             }
   171             }
   182         }   // end of switch
   172         }   // end of switch
   183 	
   173 	
   184    CleanupStack::PopAndDestroy(); //textresolver
   174    CleanupStack::PopAndDestroy(); //textresolver
   436 EXPORT_C TBool CBrowserDialogsProvider::DialogSelectOptionL(
   426 EXPORT_C TBool CBrowserDialogsProvider::DialogSelectOptionL(
   437 								const TDesC& aTitle, 
   427 								const TDesC& aTitle, 
   438 								TBrCtlSelectOptionType aBrCtlSelectOptionType,
   428 								TBrCtlSelectOptionType aBrCtlSelectOptionType,
   439 								CArrayFix<TBrCtlSelectOptionData>& aOptions )
   429 								CArrayFix<TBrCtlSelectOptionData>& aOptions )
   440 	{
   430 	{
   441      iSelectDlg = CBrowserSelectElementDlg::NewL(	aTitle, 
   431     CBrowserSelectElementDlg* dlg = CBrowserSelectElementDlg::NewL(	aTitle, 
   442 												aBrCtlSelectOptionType, 
   432 												aBrCtlSelectOptionType, 
   443 												aOptions );
   433 												aOptions );
   444 
   434 
   445 
   435 	
   446 
   436     iDialogs.Append( dlg );     // Store a pointer to the dialog for CancelAll()
   447 	TInt result = iSelectDlg->ExecuteLD();
   437 
   448 
   438 	TInt result = dlg->ExecuteLD();
   449 
   439 
   450     iSelectDlg = 0;
   440     RemoveDialogFromArray();
       
   441     
   451     if ( iObserver )
   442     if ( iObserver )
   452         {
   443         {
   453         iObserver->ReportDialogEventL( 
   444         iObserver->ReportDialogEventL( 
   454     	                        MBrowserDialogsProviderObserver::ESelectOption,
   445     	                        MBrowserDialogsProviderObserver::ESelectOption,
   455     	                        ( TInt ) result );    
   446     	                        ( TInt ) result );    
   978 //  CBrowserDialogsProvider::CancelAll()
   969 //  CBrowserDialogsProvider::CancelAll()
   979 //
   970 //
   980 //-----------------------------------------------------------------------------
   971 //-----------------------------------------------------------------------------
   981 //
   972 //
   982 EXPORT_C void CBrowserDialogsProvider::CancelAll()
   973 EXPORT_C void CBrowserDialogsProvider::CancelAll()
   983     {
   974 	{
   984 	 if(iSelectDlg  )
       
   985         iSelectDlg->CancelPopup();
       
   986 		
       
   987     iDialogs.Close();
       
   988     // Empty the array
   975     // Empty the array
   989     iDialogs.ResetAndDestroy();
   976     iDialogs.ResetAndDestroy();
   990 	}
   977 	}
   991 
   978 
   992 //-----------------------------------------------------------------------------
   979 //-----------------------------------------------------------------------------