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 |
32 #include "BrowserUploadProgressNote.h" // For UploadProgressNoteL |
32 #include "BrowserUploadProgressNote.h" // For UploadProgressNoteL |
33 |
33 |
34 // System Includes |
34 // System Includes |
35 #include <aknLists.h> // for Object Element Dialog |
35 #include <aknlists.h> // for Object Element Dialog |
36 #include <aknmessagequerydialog.h> // DialogAlertL |
36 #include <aknmessagequerydialog.h> // DialogAlertL |
37 #include <CAknFileSelectionDialog.h> // File Selection Dialog |
37 #include <CAknFileSelectionDialog.h> // File Selection Dialog |
38 |
38 |
39 #ifdef RD_MULTIPLE_DRIVE |
39 #ifdef RD_MULTIPLE_DRIVE |
40 #include <driveinfo.h> |
40 #include <driveinfo.h> |
45 #include <AknCommonDialogs.h> // File Selection Dialog |
45 #include <AknCommonDialogs.h> // File Selection Dialog |
46 #endif |
46 #endif |
47 |
47 |
48 #include <aknnotewrappers.h> |
48 #include <aknnotewrappers.h> |
49 #include <AknInfoPopupNoteController.h> // tooltip |
49 #include <AknInfoPopupNoteController.h> // tooltip |
50 #include <PathConfiguration.hrh> |
50 #include <pathconfiguration.hrh> |
51 #include <FeatMgr.h> |
51 #include <featmgr.h> |
52 #include <MGFetch.h> // Media Fetch |
52 #include <MGFetch.h> // Media Fetch |
53 // General |
53 // General |
54 #include <StringLoader.h> // strings |
54 #include <StringLoader.h> // strings |
55 #include <f32file.h> |
55 #include <f32file.h> |
56 #include <THttpFields.h> |
56 #include <thttpfields.h> |
57 #include <textresolver.h> |
57 #include <textresolver.h> |
58 |
58 |
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 //There is an empty note popup is displayed because of this undefined error code that has been thrown by http layer |
|
73 const TInt KHttpErrIgnore = -26173; |
|
74 |
71 |
75 // DLL resource file name with path |
72 // DLL resource file name with path |
76 _LIT( KBrowserDialogsProviderDirAndFile, "z:BrowserDialogsProvider.rsc" );// resource |
73 _LIT( KBrowserDialogsProviderDirAndFile, "z:BrowserDialogsProvider.rsc" );// resource |
77 |
74 |
78 //Mime Types |
75 //Mime Types |
129 // CBrowserDialogsProvider::~CBrowserDialogsProvider() |
126 // CBrowserDialogsProvider::~CBrowserDialogsProvider() |
130 // |
127 // |
131 //----------------------------------------------------------------------------- |
128 //----------------------------------------------------------------------------- |
132 CBrowserDialogsProvider::~CBrowserDialogsProvider() |
129 CBrowserDialogsProvider::~CBrowserDialogsProvider() |
133 { |
130 { |
134 iDialogs.Close(); |
|
135 iDialogs.ResetAndDestroy(); |
|
136 iResourceLoader.Close(); |
131 iResourceLoader.Close(); |
137 |
132 |
138 // Delete any dialogs |
133 // Delete any dialogs |
139 CancelAll(); |
134 CancelAll(); |
140 |
135 |
150 // CBrowserDialogsProvider::DialogNotifyErrorL( TInt aErrCode ) |
145 // CBrowserDialogsProvider::DialogNotifyErrorL( TInt aErrCode ) |
151 // |
146 // |
152 //----------------------------------------------------------------------------- |
147 //----------------------------------------------------------------------------- |
153 EXPORT_C void CBrowserDialogsProvider::DialogNotifyErrorL( TInt aErrCode ) |
148 EXPORT_C void CBrowserDialogsProvider::DialogNotifyErrorL( TInt aErrCode ) |
154 { |
149 { |
155 if( aErrCode == KHttpErrIgnore ) |
|
156 return; |
|
157 TInt httpErr = KBrCtlHttpErrorsOffset - aErrCode; |
150 TInt httpErr = KBrCtlHttpErrorsOffset - aErrCode; |
158 CTextResolver* textresolver = CTextResolver::NewLC(); |
151 CTextResolver* textresolver = CTextResolver::NewLC(); |
159 TPtrC msg; |
152 TPtrC msg; |
160 |
153 |
161 switch ( httpErr ) |
154 switch ( httpErr ) |
170 DialogNoteL( msg ); |
163 DialogNoteL( msg ); |
171 break; |
164 break; |
172 } |
165 } |
173 default: |
166 default: |
174 { |
167 { |
175 // change error code to browser error code, when trying to open file |
168 // Handle all others as system error dialog |
176 // that doesn't exist |
169 CCoeEnv::Static()->HandleError( aErrCode ); |
177 if ( KErrNotFound == aErrCode ) |
|
178 { |
|
179 iCoeEnv.HandleError( KBrowserFileNotFound ); |
|
180 } |
|
181 else |
|
182 { |
|
183 // Handle all others as system error dialog |
|
184 iCoeEnv.HandleError( aErrCode ); |
|
185 } |
|
186 break; |
170 break; |
187 } |
171 } |
188 } // end of switch |
172 } // end of switch |
189 |
173 |
190 CleanupStack::PopAndDestroy(); //textresolver |
174 CleanupStack::PopAndDestroy(); //textresolver |
442 EXPORT_C TBool CBrowserDialogsProvider::DialogSelectOptionL( |
426 EXPORT_C TBool CBrowserDialogsProvider::DialogSelectOptionL( |
443 const TDesC& aTitle, |
427 const TDesC& aTitle, |
444 TBrCtlSelectOptionType aBrCtlSelectOptionType, |
428 TBrCtlSelectOptionType aBrCtlSelectOptionType, |
445 CArrayFix<TBrCtlSelectOptionData>& aOptions ) |
429 CArrayFix<TBrCtlSelectOptionData>& aOptions ) |
446 { |
430 { |
447 iSelectDlg = CBrowserSelectElementDlg::NewL( aTitle, |
431 CBrowserSelectElementDlg* dlg = CBrowserSelectElementDlg::NewL( aTitle, |
448 aBrCtlSelectOptionType, |
432 aBrCtlSelectOptionType, |
449 aOptions ); |
433 aOptions ); |
450 |
434 |
451 |
435 |
452 |
436 iDialogs.Append( dlg ); // Store a pointer to the dialog for CancelAll() |
453 TInt result = iSelectDlg->ExecuteLD(); |
437 |
454 |
438 TInt result = dlg->ExecuteLD(); |
455 |
439 |
456 iSelectDlg = 0; |
440 RemoveDialogFromArray(); |
|
441 |
457 if ( iObserver ) |
442 if ( iObserver ) |
458 { |
443 { |
459 iObserver->ReportDialogEventL( |
444 iObserver->ReportDialogEventL( |
460 MBrowserDialogsProviderObserver::ESelectOption, |
445 MBrowserDialogsProviderObserver::ESelectOption, |
461 ( TInt ) result ); |
446 ( TInt ) result ); |
690 const TDesC& aMessage, |
675 const TDesC& aMessage, |
691 const TDesC& aDefaultInput, |
676 const TDesC& aDefaultInput, |
692 HBufC*& aReturnedInput ) |
677 HBufC*& aReturnedInput ) |
693 { |
678 { |
694 TBool retVal; |
679 TBool retVal; |
695 TInt length = aDefaultInput.Length(); |
680 |
696 if ( aDefaultInput.Length() > KMaxAltTextLength ) |
681 // defInput is not modified by the dialog. |
697 { |
682 TPtr defInput( (TUint16*) aDefaultInput.Ptr(), aDefaultInput.Length(), |
698 length = KMaxAltTextLength; |
683 KMaxAltTextLength ); |
699 } |
684 |
700 // defInput is not modified by the dialog.Truncate if length is greater than KMaxAltTextLength |
|
701 TPtr defInput( (TUint16*) aDefaultInput.Ptr(), length, KMaxAltTextLength ); |
|
702 |
|
703 CBrowserScriptPromptDialog* dialog = |
685 CBrowserScriptPromptDialog* dialog = |
704 new (ELeave) CBrowserScriptPromptDialog( defInput, aReturnedInput ); |
686 new (ELeave) CBrowserScriptPromptDialog( defInput, aReturnedInput ); |
705 |
687 |
706 iDialogs.Append( dialog ); // Store a pointer to the dialog for CancelAll() |
688 iDialogs.Append( dialog ); // Store a pointer to the dialog for CancelAll() |
707 |
689 |
987 // CBrowserDialogsProvider::CancelAll() |
969 // CBrowserDialogsProvider::CancelAll() |
988 // |
970 // |
989 //----------------------------------------------------------------------------- |
971 //----------------------------------------------------------------------------- |
990 // |
972 // |
991 EXPORT_C void CBrowserDialogsProvider::CancelAll() |
973 EXPORT_C void CBrowserDialogsProvider::CancelAll() |
992 { |
974 { |
993 if(iSelectDlg ) |
975 // Empty the array |
994 iSelectDlg->CancelPopup(); |
976 iDialogs.ResetAndDestroy(); |
995 |
|
996 } |
977 } |
997 |
978 |
998 //----------------------------------------------------------------------------- |
979 //----------------------------------------------------------------------------- |
999 // CBrowserDialogsProvider::RemoveDialogFromArray() |
980 // CBrowserDialogsProvider::RemoveDialogFromArray() |
1000 // |
981 // |