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
41 * Added enumeration ESelectTypeWithFindPane at offset of 0x100 so that
42 * the limit of different types of dialog boxes can be upto 256.
43 * Any user who wants a list with find pane must "|" with a defined type
44 * above like ESelectTypeNone | ESelectTypeWithFindPane to obtain a list
47 ESelectTypeWithFindPane = 0x100
51 * Defines the type of image if it cannot be recognized by the
52 * Symbian image conversion library.
57 EImageTypeAny, ///< Automatically recognized by the image converter
58 EImageTypeWbmp, ///< Wireless Bitmap (WBMP) image
59 EImageTypeOta ///< Over The Air (OTA) image
63 // FORWARD DECLARATIONS
64 class TBrCtlSelectOptionData;
65 class CBrCtlObjectInfo;
66 class TBrCtlImageCarrier;
69 * The MBrDialogsProvider class provides functions implemented by
70 * the Browser Control to display dialogs, such as error notifications,
71 * authentication requests, and selection lists.
76 * #include <brctldialogsprovider.h>
79 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
80 * @lib BrowserEngine.lib
81 * @file brctldialogsprovider.h
84 class MBrCtlDialogsProvider
86 public: // New functions
89 * Notifies the user of an error encountered during a download.
90 * Some examples are: insufficient memory, unrecognized URL, and DNS not found.
92 * @param aErrCode The error that occured
95 virtual void DialogNotifyErrorL(TInt aErrCode) = 0;
98 * Notifies the user of an error from the HTTP server
99 * during a download. Some examples are: file not found, redirect error.
101 * @param aErrCode The error that occured
102 * @param aUri The uri of the request that failed
105 virtual void DialogNotifyHttpErrorL(TInt aErrCode, const TDesC& aUri) = 0;
108 * Navigates through your file system and selects a file;
109 * analogous to the Browse command in Windows.
111 * @param aStartPath The initial displayed directory
112 * @param aRootPath The top most directory that the user can go up to
113 * @param aSelectedFileName The selected file name.
114 * @return ETrue if the user selected a file
115 * EFalse if the user cancelled the transaction and did not select a file.
116 * @attiontion Returned on cleanup stack. Browser control will free the buffer.
118 virtual TBool DialogFileSelectLC(const TDesC& aStartPath,
119 const TDesC& aRootPath,
120 HBufC*& aSelectedFileName) = 0;
123 * List selection dialog
125 * @param Title of the selection dialog. This is optional.
126 * @param aBrCtlSelectOptionType The type of the list box.
127 * Values: One of the following:
128 * Check boxes (multiple selections allowed)
129 * Radio buttons (single selection only). For example, highlight a URL listed
130 * in the session History.
131 * No buttons (single selection only)
132 * No buttons (single selection only), OK softkey available
133 * For example, if you are about to download a plug-in, you can choose
134 * to display the content in the Web page or in a viewer application.
135 * @param aOptions A list of options to display
136 * @return EFalse if the user canceled the dialog selection
137 * ETrue if the user selected an option.
139 virtual TBool DialogSelectOptionL(const TDesC& aTitle,
140 TBrCtlSelectOptionType aBrCtlSelectOptionType,
141 CArrayFix<TBrCtlSelectOptionData>& aOptions) = 0;
144 * User Authentication dialog.
146 * @param aUrl The url requiring authentication
147 * @param aRealm The realm requiring authentication
148 * @param aDefaultUserName The user name that was used before for this realm and path, if any
149 * @param aReturnedUserName The user name entered by the user
150 * @param aReturnedPasswd The password entered by the user
151 * @param aBasicAuthentication ETrue if basic authentication is required.
152 * EFalse if another type of authentication is required; for example, Digest.
154 * @return EFalse if the user cancelled the selection
155 * ETrue if the user selected an option.
156 @ attiontion User name and password are returned on cleanup stack.
158 virtual TBool DialogUserAuthenticationLC(const TDesC& aUrl,
160 const TDesC& aDefaultUserName,
161 HBufC*& aReturnedUserName,
162 HBufC*& aReturnedPasswd,
163 TBool aBasicAuthentication = EFalse) = 0;
166 * Displays a message to the user.
167 * For example, the message may inform the user
168 * about an error encountered while processing a request.
170 * @param aMessage The message to display
172 * @attention Softkeys are not supported.
173 * The message disappears after a time out.
175 virtual void DialogNoteL(const TDesC& aMessage) = 0;
178 * Display a note to the user with ok softkey only
180 * @param aTitle The title, could be empty
181 * @param aMessage The message to display
183 * @attention The OK softkey is supported.
184 * The message displays until the user presses OK.
186 virtual void DialogAlertL(const TDesC& aTitle, const TDesC& aMessage) = 0;
189 * Display confirmation message to the user.
190 * For example, Are you sure you want to delete this?
192 * @param aTitle The title, could be empty
193 * @param aMessage The message to display
194 * @param aYesMessage The text to display on left softkey
195 * @param aNoMessage The text to display on right softkey
196 * @return EFalse if the user cancelled the selection
197 * ETrue if the user selected an option.
199 virtual TBool DialogConfirmL(const TDesC& aTitle,
200 const TDesC& aMessage,
201 const TDesC& aYesMessage,
202 const TDesC& aNoMessage) = 0;
205 * Displays an input dialog to the user. Asks the user to input data.
207 * @param aTitle The title, could be empty
208 * @param aMessage The message to display
209 * @param aDefaultInput The default input if available
210 * @param aReturnedInput The input entered by the user.
211 * @return EFalse if the user cancelled the selection
212 * ETrue if the user selected an option.
213 * @attention Returned on the cleanup stack.
215 virtual TBool DialogPromptLC(const TDesC& aTitle,
216 const TDesC& aMessage,
217 const TDesC& aDefaultInput,
218 HBufC*& aReturnedInput) = 0;
221 * Displays information about the Netscape plug-in object and
222 * requests confirmation before downloading the object.
224 * @param aBrCtlObjectInfo Information about the object to be downloaded.
225 * The following information is passes as part of this object:
228 * Flag to indicate whether a viewer application exists for this content
229 * Flag to indicate whether a Netscape plug-in exists that supports this content
230 * Name of the application or Netscape plug-in with which the content can
231 * be viewed on the mobile phone
232 * @return EFalse if the user cancelled the selection
233 * ETrue if the user selected an option.
235 virtual TBool DialogDownloadObjectL(CBrCtlObjectInfo* aBrCtlObjectInfo) = 0;
238 * Display the images that appear in the current page
240 * @param aPageImages Array describing the images that appear in the current page.
241 * The array contains the following elements for each image:
244 * Title for the image
246 * If the image type is WBMP or OTA, it must be specified.
247 * Symbian can detect any other image type.
250 virtual void DialogDisplayPageImagesL(CArrayFixFlat<TBrCtlImageCarrier>& aPageImages) = 0;
253 * Cancels the dialog displayed due to browser exit or destroyed pages.
257 virtual void CancelAll() = 0;
260 * Displays a dialog for searching on the page.
264 virtual void DialogFindL() = 0;
270 * The TBrCtlSelectOptionData class represents a list of elements
271 * to display in the list box. This class is used for the List Selection Dialog.
273 * #include <brctldialogsprovider.h>
274 * @lib BrowserEngine.lib
276 * @file brctldialogsprovider.h
279 class TBrCtlSelectOptionData
283 * Default Constructor
284 * @return TbrCtlSelectOptionData object
287 inline TBrCtlSelectOptionData()
290 iIsSelected = EFalse;
291 iIsOptGroup = EFalse;
298 * @param aText The text to display with this element
299 * @param aIsSelected If the element is selected
300 * @param aIsOptGroup If a title of option group or an element
301 * @param aHasOnPick If has onPick, The dialog should close when the element is selected
302 * @return TbrCtlSelectOptionData object
304 inline TBrCtlSelectOptionData( const TDesC& aText,
310 iIsSelected = aIsSelected;
311 iIsOptGroup = aIsOptGroup;
312 iHasOnPick = aHasOnPick;
315 * Gets the display text associated with a specified option.
317 * @return A reference to a Symbian TDesC object that
318 * contains the text associated with this option.
320 inline const TDesC& Text() const {return iText;}
322 * Indicates whether or not an option is selected.
324 * @return ETrue if the option is selected
325 * EFalse if the option is not selected
327 inline TBool IsSelected() const {return iIsSelected;}
329 * Indicates whether an option group member
330 * variable is a group title or a selectable option.
332 * @return ETrue if the listed item is the title of an option group
333 * EFalse if the listed item is one of the options from which to select
335 inline TBool IsOptGroup() const {return iIsOptGroup;}
337 * Indicates whether or not the dialog closes when an option is selected.
339 * @return ETrue if the dialog closes when the element is selected.
340 * This is known as having OnPick capability.
341 * EFalse if the dialog does not close when the element is selected
343 inline TBool HasOnPick() const {return iHasOnPick;}
345 * Sets the text of the option object.
347 * @param aText A reference to a TDesC object that contains the
348 * text to associate with a particular option.
352 inline void SetText( TDesC& aText ) { iText.Set( aText ); }
354 * Sets the selection state of an option.
356 * @param aIsSelected The state of the IsSelected member variable.
358 * ETrue if the option is selected
359 * EFalse if the option is not selected
362 inline void SetIsSelected( TBool aIsSelected ) { iIsSelected = aIsSelected; }
364 * Sets the state of the option group member variable.
365 * Indicates whether an option group member variable is a group title
366 * or a selectable option.
368 * @param aIsOptGroup The state of the option group.
370 * ETrue if the listed item is the title of an option group.
371 * EFalse if the listed item is one of the options from which to select.
374 inline void SetIsOptGroup( TBool aIsOptGroup ) { iIsOptGroup = aIsOptGroup; }
376 * Sets the state of the hasOnPick member variable.
377 * Indicates whether or not the dialog closes when an option is selected.
380 * ETrue if the dialog closes when the element is selected. This
381 * is known as having OnPick capability.
382 * EFalse if the dialog does not close when the element is selected
385 inline void SetHasOnPick( TBool aHasOnPick ) { iHasOnPick = aHasOnPick; }
388 // The text associated with the element
390 // Flag if the element is selected
392 // Flag if an element or oprion group title
394 // Flag if the element has onPick
399 * The CBrCtlObjectInfo class used to represent the information about the
402 * #include <brctldialogsprovider.h>
403 * @lib BrowserEngine.lib
405 * @file brctldialogsprovider.h
408 class CBrCtlObjectInfo : public CBase
412 * Default Constructor
420 * @param aAppSupported A flag if there is a viewer app for this object
421 * @param aPluginSupported A flag if there is a netscape plugin for this object
422 * @param aSize The size of the object
423 * @param aAppName The name of the viewer app or netscape plugin that supports this object
424 * @param aFileType The content type of the object
425 * @return CBrCtlObjectInfo object
427 CBrCtlObjectInfo(TBool aAppSupported, TBool aPluginSupported,
428 const TDesC& aSize, const TDesC& aAppName,
429 const TDesC& aFileType);
432 * Sets the flag if there is a viewer app for this object
434 * @param aAppSupported ETrue if there is a viewer app for this object
435 * EFalse if there is not a viewer app for this object.
438 inline void SetAppSupported(TBool aAppSupported) {iAppSupported = aAppSupported;}
440 * Sets the flag if there is a netscape plugin for this object
442 * @param aPluginSupported ETrue if there is a netscape plugin for this object
443 * EFalse if there is not a netscape plugin for this object.
446 inline void SetPluginSupported(TBool aPluginSupported) {iPluginSupported = aPluginSupported;}
448 * Sets the size of the object
450 * @param aSize Symbian descriptor containing the size of the object
453 inline void SetSize(const TDesC& aSize) {iSize.Set(aSize);}
455 * Sets the name of the viewer app or netscape plugin that supports this object
457 * @param aAppName Symbian descriptor containing the name of
458 * the viewer app or netscape plugin that supports this object.
461 inline void SetAppName(const TDesC& aAppName) {iAppName.Set(aAppName);}
463 * Sets the content type of the object
465 * @param aFileType Symbian descriptor holding content type of the object
468 inline void SetFileType(const TDesC& aFileType) {iFileType.Set(aFileType);}
470 * Tells if there is a viewer app for this object
473 * @return ETrue if there is a viewer app for this object
474 * EFalse if there is not a viewer app for this object.
476 inline TBool AppSupported() {return iAppSupported;}
478 * Tells if there is a netscape plugin for this object
481 * @return ETrue if there is a netscape plugin for this object
482 * EFalse if there is not a netscape plugin for this object.
484 inline TBool PluginSupported() {return iPluginSupported;}
486 * Gets the size of the object
489 * @return Symbian descriptor containing the size of the object
491 inline const TDesC& Size() const {return iSize;}
493 * Gets the name of the viewer app or netscape plugin that supports this object
496 * @return Symbian descriptor containing the name of
497 * the viewer app or netscape plugin that supports this object.
499 inline const TDesC& AppName() const {return iAppName;}
501 * Gets the content type of the object
504 * @return Symbian descriptor holding content type of the object
506 inline const TDesC& FileType() const {return iFileType;}
508 // A flag if there is a viewer app for this object
510 // A flag if there is a Netscape plugin for this object
511 TBool iPluginSupported;
512 // The size of the object
514 // The name of the viewer app or Netscape plugin
516 // The content type of the object
521 * TheTBrCtlImageCarrier class used to give the information about the
524 * #include <brctldialogsprovider.h>
525 * @lib BrowserEngine.lib
527 * @file brctldialogsprovider.h
530 class TBrCtlImageCarrier
536 * @param aRawData The image data
537 * @param aUrl The url of the image
538 * @param aAltText The alt text of the image
539 * @param aImageType The type of the image
541 TBrCtlImageCarrier(const TDesC8& aRawData, const TDesC& aUrl,
542 const TDesC& aAltText, TBrCtlImageType aImageType, const TDesC& aContentType ) :
543 iRawData( aRawData ),
545 iAltText( aAltText ),
546 iImageType(aImageType),
547 iContentType(aContentType)
551 * Provides the image data
554 * @return Symbian descriptor containing image data
556 inline const TDesC8& RawData() const {return iRawData;}
558 * Provides the url of the image
561 * @return Symbian descriptor containing url of the image
563 inline const TDesC& Url() const {return iUrl;}
565 * Provides the alt text of the image
568 * @return Symbian descriptor containing alt text of the image
570 inline const TDesC& AltText() const {return iAltText;}
572 * Provides the type of the image
575 * @return Symbian descriptor containing the type of the image
577 inline TBrCtlImageType ImageType() const {return iImageType;}
579 * Provides the content type of the image
582 * @return Symbian descriptor containing content type of the image
584 inline const TDesC& ContentType() const {return iContentType;}
589 TBrCtlImageType iImageType;
594 #endif // BRCTLDIALOGSPROVIDER_H