2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Handle dialogs needed for browser operation
19 #ifndef BRCTLDIALOGSPROVIDER_H
20 #define BRCTLDIALOGSPROVIDER_H
27 * Type of selection list
29 enum TBrCtlSelectOptionType
31 ESelectTypeMultiple, ///< Multiple select - Display a checkbox
32 ESelectTypeSingle, ///< Single select - Display a radio button
33 ESelectTypeNone, ///< Single select - Do not display any button
35 * No buttons (single selection only)
36 * OK softkey is available
37 * Cancel button is not available
43 * Defines the type of image if it cannot be recognized by the
44 * Symbian image conversion library.
49 EImageTypeAny, ///< Automatically recognized by the image converter
50 EImageTypeWbmp, ///< Wireless Bitmap (WBMP) image
51 EImageTypeOta ///< Over The Air (OTA) image
55 // FORWARD DECLARATIONS
56 class TBrCtlSelectOptionData;
57 class CBrCtlObjectInfo;
58 class TBrCtlImageCarrier;
61 * The MBrDialogsProvider class provides functions implemented by
62 * the Browser Control to display dialogs, such as error notifications,
63 * authentication requests, and selection lists.
68 * #include <BrCtlDialogsProvider.h>
71 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
72 * @lib BrowserEngine.lib
73 * @file BrCtlDialogsProvider.h
76 class MBrCtlDialogsProvider
78 public: // New functions
81 * Notifies the user of an error encountered during a download.
82 * Some examples are: insufficient memory, unrecognized URL, and DNS not found.
84 * @param aErrCode The error that occured
87 virtual void DialogNotifyErrorL(TInt aErrCode) = 0;
90 * Notifies the user of an error from the HTTP server
91 * during a download. Some examples are: file not found, redirect error.
93 * @param aErrCode The error that occured
94 * @param aUri The uri of the request that failed
97 virtual void DialogNotifyHttpErrorL(TInt aErrCode, const TDesC& aUri) = 0;
100 * Navigates through your file system and selects a file;
101 * analogous to the Browse command in Windows.
103 * @param aStartPath The initial displayed directory
104 * @param aRootPath The top most directory that the user can go up to
105 * @param aSelectedFileName The selected file name.
106 * @return ETrue if the user selected a file
107 * EFalse if the user cancelled the transaction and did not select a file.
108 * @attiontion Returned on cleanup stack. Browser control will free the buffer.
110 virtual TBool DialogFileSelectLC(const TDesC& aStartPath,
111 const TDesC& aRootPath,
112 HBufC*& aSelectedFileName) = 0;
115 * List selection dialog
117 * @param Title of the selection dialog. This is optional.
118 * @param aBrCtlSelectOptionType The type of the list box.
119 * Values: One of the following:
120 * Check boxes (multiple selections allowed)
121 * Radio buttons (single selection only). For example, highlight a URL listed
122 * in the session History.
123 * No buttons (single selection only)
124 * No buttons (single selection only), OK softkey available
125 * For example, if you are about to download a plug-in, you can choose
126 * to display the content in the Web page or in a viewer application.
127 * @param aOptions A list of options to display
128 * @return EFalse if the user canceled the dialog selection
129 * ETrue if the user selected an option.
131 virtual TBool DialogSelectOptionL(const TDesC& aTitle,
132 TBrCtlSelectOptionType aBrCtlSelectOptionType,
133 CArrayFix<TBrCtlSelectOptionData>& aOptions) = 0;
136 * User Authentication dialog.
138 * @param aUrl The url requiring authentication
139 * @param aRealm The realm requiring authentication
140 * @param aDefaultUserName The user name that was used before for this realm and path, if any
141 * @param aReturnedUserName The user name entered by the user
142 * @param aReturnedPasswd The password entered by the user
143 * @param aBasicAuthentication ETrue if basic authentication is required.
144 * EFalse if another type of authentication is required; for example, Digest.
146 * @return EFalse if the user cancelled the selection
147 * ETrue if the user selected an option.
148 @ attiontion User name and password are returned on cleanup stack.
150 virtual TBool DialogUserAuthenticationLC(const TDesC& aUrl,
152 const TDesC& aDefaultUserName,
153 HBufC*& aReturnedUserName,
154 HBufC*& aReturnedPasswd,
155 TBool aBasicAuthentication = EFalse) = 0;
158 * Displays a message to the user.
159 * For example, the message may inform the user
160 * about an error encountered while processing a request.
162 * @param aMessage The message to display
164 * @attention Softkeys are not supported.
165 * The message disappears after a time out.
167 virtual void DialogNoteL(const TDesC& aMessage) = 0;
170 * Display a note to the user with ok softkey only
172 * @param aTitle The title, could be empty
173 * @param aMessage The message to display
175 * @attention The OK softkey is supported.
176 * The message displays until the user presses OK.
178 virtual void DialogAlertL(const TDesC& aTitle, const TDesC& aMessage) = 0;
181 * Display confirmation message to the user.
182 * For example, Are you sure you want to delete this?
184 * @param aTitle The title, could be empty
185 * @param aMessage The message to display
186 * @param aYesMessage The text to display on left softkey
187 * @param aNoMessage The text to display on right softkey
188 * @return EFalse if the user cancelled the selection
189 * ETrue if the user selected an option.
191 virtual TBool DialogConfirmL(const TDesC& aTitle,
192 const TDesC& aMessage,
193 const TDesC& aYesMessage,
194 const TDesC& aNoMessage) = 0;
197 * Displays an input dialog to the user. Asks the user to input data.
199 * @param aTitle The title, could be empty
200 * @param aMessage The message to display
201 * @param aDefaultInput The default input if available
202 * @param aReturnedInput The input entered by the user.
203 * @return EFalse if the user cancelled the selection
204 * ETrue if the user selected an option.
205 * @attention Returned on the cleanup stack.
207 virtual TBool DialogPromptLC(const TDesC& aTitle,
208 const TDesC& aMessage,
209 const TDesC& aDefaultInput,
210 HBufC*& aReturnedInput) = 0;
213 * Displays information about the Netscape plug-in object and
214 * requests confirmation before downloading the object.
216 * @param aBrCtlObjectInfo Information about the object to be downloaded.
217 * The following information is passes as part of this object:
220 * Flag to indicate whether a viewer application exists for this content
221 * Flag to indicate whether a Netscape plug-in exists that supports this content
222 * Name of the application or Netscape plug-in with which the content can
223 * be viewed on the mobile phone
224 * @return EFalse if the user cancelled the selection
225 * ETrue if the user selected an option.
227 virtual TBool DialogDownloadObjectL(CBrCtlObjectInfo* aBrCtlObjectInfo) = 0;
230 * Display the images that appear in the current page
232 * @param aPageImages Array describing the images that appear in the current page.
233 * The array contains the following elements for each image:
236 * Title for the image
238 * If the image type is WBMP or OTA, it must be specified.
239 * Symbian can detect any other image type.
242 virtual void DialogDisplayPageImagesL(CArrayFixFlat<TBrCtlImageCarrier>& aPageImages) = 0;
245 * Cancels the dialog displayed due to browser exit or destroyed pages.
249 virtual void CancelAll() = 0;
252 * Displays a dialog for searching on the page.
256 virtual void DialogFindL() = 0;
262 * The TBrCtlSelectOptionData class represents a list of elements
263 * to display in the list box. This class is used for the List Selection Dialog.
265 * #include <BrCtlDialogsProvider.h>
266 * @lib BrowserEngine.lib
268 * @file BrCtlDialogsProvider.h
271 class TBrCtlSelectOptionData
275 * Default Constructor
276 * @return TbrCtlSelectOptionData object
279 inline TBrCtlSelectOptionData()
282 iIsSelected = EFalse;
283 iIsOptGroup = EFalse;
290 * @param aText The text to display with this element
291 * @param aIsSelected If the element is selected
292 * @param aIsOptGroup If a title of option group or an element
293 * @param aHasOnPick If has onPick, The dialog should close when the element is selected
294 * @return TbrCtlSelectOptionData object
296 inline TBrCtlSelectOptionData( const TDesC& aText,
302 iIsSelected = aIsSelected;
303 iIsOptGroup = aIsOptGroup;
304 iHasOnPick = aHasOnPick;
307 * Gets the display text associated with a specified option.
309 * @return A reference to a Symbian TDesC object that
310 * contains the text associated with this option.
312 inline const TDesC& Text() const {return iText;}
314 * Indicates whether or not an option is selected.
316 * @return ETrue if the option is selected
317 * EFalse if the option is not selected
319 inline TBool IsSelected() const {return iIsSelected;}
321 * Indicates whether an option group member
322 * variable is a group title or a selectable option.
324 * @return ETrue if the listed item is the title of an option group
325 * EFalse if the listed item is one of the options from which to select
327 inline TBool IsOptGroup() const {return iIsOptGroup;}
329 * Indicates whether or not the dialog closes when an option is selected.
331 * @return ETrue if the dialog closes when the element is selected.
332 * This is known as having OnPick capability.
333 * EFalse if the dialog does not close when the element is selected
335 inline TBool HasOnPick() const {return iHasOnPick;}
337 * Sets the text of the option object.
339 * @param aText A reference to a TDesC object that contains the
340 * text to associate with a particular option.
344 inline void SetText( TDesC& aText ) { iText.Set( aText ); }
346 * Sets the selection state of an option.
348 * @param aIsSelected The state of the IsSelected member variable.
350 * ETrue if the option is selected
351 * EFalse if the option is not selected
354 inline void SetIsSelected( TBool aIsSelected ) { iIsSelected = aIsSelected; }
356 * Sets the state of the option group member variable.
357 * Indicates whether an option group member variable is a group title
358 * or a selectable option.
360 * @param aIsOptGroup The state of the option group.
362 * ETrue if the listed item is the title of an option group.
363 * EFalse if the listed item is one of the options from which to select.
366 inline void SetIsOptGroup( TBool aIsOptGroup ) { iIsOptGroup = aIsOptGroup; }
368 * Sets the state of the hasOnPick member variable.
369 * Indicates whether or not the dialog closes when an option is selected.
372 * ETrue if the dialog closes when the element is selected. This
373 * is known as having OnPick capability.
374 * EFalse if the dialog does not close when the element is selected
377 inline void SetHasOnPick( TBool aHasOnPick ) { iHasOnPick = aHasOnPick; }
380 // The text associated with the element
382 // Flag if the element is selected
384 // Flag if an element or oprion group title
386 // Flag if the element has onPick
391 * The CBrCtlObjectInfo class used to represent the information about the
394 * #include <BrCtlDialogsProvider.h>
395 * @lib BrowserEngine.lib
397 * @file BrCtlDialogsProvider.h
400 class CBrCtlObjectInfo : public CBase
404 * Default Constructor
412 * @param aAppSupported A flag if there is a viewer app for this object
413 * @param aPluginSupported A flag if there is a netscape plugin for this object
414 * @param aSize The size of the object
415 * @param aAppName The name of the viewer app or netscape plugin that supports this object
416 * @param aFileType The content type of the object
417 * @return CBrCtlObjectInfo object
419 CBrCtlObjectInfo(TBool aAppSupported, TBool aPluginSupported,
420 const TDesC& aSize, const TDesC& aAppName,
421 const TDesC& aFileType);
424 * Sets the flag if there is a viewer app for this object
426 * @param aAppSupported ETrue if there is a viewer app for this object
427 * EFalse if there is not a viewer app for this object.
430 inline void SetAppSupported(TBool aAppSupported) {iAppSupported = aAppSupported;}
432 * Sets the flag if there is a netscape plugin for this object
434 * @param aPluginSupported ETrue if there is a netscape plugin for this object
435 * EFalse if there is not a netscape plugin for this object.
438 inline void SetPluginSupported(TBool aPluginSupported) {iPluginSupported = aPluginSupported;}
440 * Sets the size of the object
442 * @param aSize Symbian descriptor containing the size of the object
445 inline void SetSize(const TDesC& aSize) {iSize.Set(aSize);}
447 * Sets the name of the viewer app or netscape plugin that supports this object
449 * @param aAppName Symbian descriptor containing the name of
450 * the viewer app or netscape plugin that supports this object.
453 inline void SetAppName(const TDesC& aAppName) {iAppName.Set(aAppName);}
455 * Sets the content type of the object
457 * @param aFileType Symbian descriptor holding content type of the object
460 inline void SetFileType(const TDesC& aFileType) {iFileType.Set(aFileType);}
462 * Tells if there is a viewer app for this object
465 * @return ETrue if there is a viewer app for this object
466 * EFalse if there is not a viewer app for this object.
468 inline TBool AppSupported() {return iAppSupported;}
470 * Tells if there is a netscape plugin for this object
473 * @return ETrue if there is a netscape plugin for this object
474 * EFalse if there is not a netscape plugin for this object.
476 inline TBool PluginSupported() {return iPluginSupported;}
478 * Gets the size of the object
481 * @return Symbian descriptor containing the size of the object
483 inline const TDesC& Size() const {return iSize;}
485 * Gets the name of the viewer app or netscape plugin that supports this object
488 * @return Symbian descriptor containing the name of
489 * the viewer app or netscape plugin that supports this object.
491 inline const TDesC& AppName() const {return iAppName;}
493 * Gets the content type of the object
496 * @return Symbian descriptor holding content type of the object
498 inline const TDesC& FileType() const {return iFileType;}
500 // A flag if there is a viewer app for this object
502 // A flag if there is a Netscape plugin for this object
503 TBool iPluginSupported;
504 // The size of the object
506 // The name of the viewer app or Netscape plugin
508 // The content type of the object
513 * TheTBrCtlImageCarrier class used to give the information about the
516 * #include <BrCtlDialogsProvider.h>
517 * @lib BrowserEngine.lib
519 * @file BrCtlDialogsProvider.h
522 class TBrCtlImageCarrier
528 * @param aRawData The image data
529 * @param aUrl The url of the image
530 * @param aAltText The alt text of the image
531 * @param aImageType The type of the image
533 TBrCtlImageCarrier(const TDesC8& aRawData, const TDesC& aUrl,
534 const TDesC& aAltText, TBrCtlImageType aImageType, const TDesC& aContentType ) :
535 iRawData( aRawData ),
537 iAltText( aAltText ),
538 iImageType(aImageType),
539 iContentType(aContentType)
543 * Provides the image data
546 * @return Symbian descriptor containing image data
548 inline const TDesC8& RawData() const {return iRawData;}
550 * Provides the url of the image
553 * @return Symbian descriptor containing url of the image
555 inline const TDesC& Url() const {return iUrl;}
557 * Provides the alt text of the image
560 * @return Symbian descriptor containing alt text of the image
562 inline const TDesC& AltText() const {return iAltText;}
564 * Provides the type of the image
567 * @return Symbian descriptor containing the type of the image
569 inline TBrCtlImageType ImageType() const {return iImageType;}
571 * Provides the content type of the image
574 * @return Symbian descriptor containing content type of the image
576 inline const TDesC& ContentType() const {return iContentType;}
581 TBrCtlImageType iImageType;
586 #endif // BRCTLDIALOGSPROVIDER_H