diff -r 79859ed3eea9 -r 919f36ff910f browserutilities/browserdialogsprovider/Src/BrowserDialogsProvider.cpp --- a/browserutilities/browserdialogsprovider/Src/BrowserDialogsProvider.cpp Tue Aug 31 16:17:46 2010 +0300 +++ b/browserutilities/browserdialogsprovider/Src/BrowserDialogsProvider.cpp Wed Sep 01 12:28:30 2010 +0100 @@ -19,11 +19,11 @@ // INCLUDE Files // User includes -#include "BrowserDialogsProvider.h" // Class header +#include // Class header #include "BrowserDialogsProvider.hrh" #include "BrowserAuthenticationDialog.h" #include "BrowserDialogsProviderConstants.h" -#include "BrowserDialogsProviderObserver.h" //obs +#include //obs // Browser as a Plugin - own classes #include "BrowserViewImagesPopup.h" // For DialogDisplayPageImagesL @@ -32,7 +32,7 @@ #include "BrowserUploadProgressNote.h" // For UploadProgressNoteL // System Includes -#include // for Object Element Dialog +#include // for Object Element Dialog #include // DialogAlertL #include // File Selection Dialog @@ -47,27 +47,30 @@ #include #include // tooltip -#include -#include +#include +#include #include // Media Fetch // General #include // strings #include -#include +#include #include // Resources -#include +#include #include // Data Caging -#include +#include // CONSTANTS const TInt KBrCtlObjectElementMaxLength = 50; const TInt KBrCtlMBFormat = 4; const TInt KBrCtlGBFormat = 10; const TInt KBrCtlMegabyte = 1000; // although 1MB=1024 kB, treat as 1000kb for user simplicity +const TInt KBrowserFileNotFound = -26003; // Defined in ErrorDefs.h but not exported so define here +//There is an empty note popup is displayed because of this undefined error code that has been thrown by http layer +const TInt KHttpErrIgnore = -26173; // DLL resource file name with path _LIT( KBrowserDialogsProviderDirAndFile, "z:BrowserDialogsProvider.rsc" );// resource @@ -128,6 +131,8 @@ //----------------------------------------------------------------------------- CBrowserDialogsProvider::~CBrowserDialogsProvider() { + iDialogs.Close(); + iDialogs.ResetAndDestroy(); iResourceLoader.Close(); // Delete any dialogs @@ -147,6 +152,8 @@ //----------------------------------------------------------------------------- EXPORT_C void CBrowserDialogsProvider::DialogNotifyErrorL( TInt aErrCode ) { + if( aErrCode == KHttpErrIgnore ) + return; TInt httpErr = KBrCtlHttpErrorsOffset - aErrCode; CTextResolver* textresolver = CTextResolver::NewLC(); TPtrC msg; @@ -165,8 +172,17 @@ } default: { - // Handle all others as system error dialog - CCoeEnv::Static()->HandleError( aErrCode ); + // change error code to browser error code, when trying to open file + // that doesn't exist + if ( KErrNotFound == aErrCode ) + { + iCoeEnv.HandleError( KBrowserFileNotFound ); + } + else + { + // Handle all others as system error dialog + iCoeEnv.HandleError( aErrCode ); + } break; } } // end of switch @@ -428,17 +444,16 @@ TBrCtlSelectOptionType aBrCtlSelectOptionType, CArrayFix& aOptions ) { - CBrowserSelectElementDlg* dlg = CBrowserSelectElementDlg::NewL( aTitle, + iSelectDlg = CBrowserSelectElementDlg::NewL( aTitle, aBrCtlSelectOptionType, aOptions ); - - iDialogs.Append( dlg ); // Store a pointer to the dialog for CancelAll() + - TInt result = dlg->ExecuteLD(); + TInt result = iSelectDlg->ExecuteLD(); - RemoveDialogFromArray(); - + + iSelectDlg = 0; if ( iObserver ) { iObserver->ReportDialogEventL( @@ -677,11 +692,14 @@ HBufC*& aReturnedInput ) { TBool retVal; - - // defInput is not modified by the dialog. - TPtr defInput( (TUint16*) aDefaultInput.Ptr(), aDefaultInput.Length(), - KMaxAltTextLength ); - + TInt length = aDefaultInput.Length(); + if ( aDefaultInput.Length() > KMaxAltTextLength ) + { + length = KMaxAltTextLength; + } + // defInput is not modified by the dialog.Truncate if length is greater than KMaxAltTextLength + TPtr defInput( (TUint16*) aDefaultInput.Ptr(), length, KMaxAltTextLength ); + CBrowserScriptPromptDialog* dialog = new (ELeave) CBrowserScriptPromptDialog( defInput, aReturnedInput ); @@ -971,9 +989,10 @@ //----------------------------------------------------------------------------- // EXPORT_C void CBrowserDialogsProvider::CancelAll() - { - // Empty the array - iDialogs.ResetAndDestroy(); + { + if(iSelectDlg ) + iSelectDlg->CancelPopup(); + } //-----------------------------------------------------------------------------