williamr@2: /* williamr@2: * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Handle dialogs needed for browser operation williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef BRCTLDIALOGSPROVIDER_H williamr@2: #define BRCTLDIALOGSPROVIDER_H williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: williamr@2: /** williamr@2: * Type of selection list williamr@2: */ williamr@2: enum TBrCtlSelectOptionType williamr@2: { williamr@2: ESelectTypeMultiple, ///< Multiple select - Display a checkbox williamr@2: ESelectTypeSingle, ///< Single select - Display a radio button williamr@2: ESelectTypeNone, ///< Single select - Do not display any button williamr@2: /** williamr@2: * No buttons (single selection only) williamr@2: * OK softkey is available williamr@2: * Cancel button is not available williamr@2: */ williamr@2: ESelectTypeOkOnly williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Defines the type of image if it cannot be recognized by the williamr@2: * Symbian image conversion library. williamr@2: */ williamr@2: williamr@2: enum TBrCtlImageType williamr@2: { williamr@2: EImageTypeAny, ///< Automatically recognized by the image converter williamr@2: EImageTypeWbmp, ///< Wireless Bitmap (WBMP) image williamr@2: EImageTypeOta ///< Over The Air (OTA) image williamr@2: }; williamr@2: williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class TBrCtlSelectOptionData; williamr@2: class CBrCtlObjectInfo; williamr@2: class TBrCtlImageCarrier; williamr@2: williamr@2: /** williamr@2: * The MBrDialogsProvider class provides functions implemented by williamr@2: * the Browser Control to display dialogs, such as error notifications, williamr@2: * authentication requests, and selection lists. williamr@2: * williamr@2: * Usage: williamr@2: * williamr@2: * @code williamr@2: * #include williamr@2: * williamr@2: * williamr@2: * @see S60 Platform: Browser Control API Developer's Guide Version 2.0 williamr@2: * @lib BrowserEngine.lib williamr@2: * @file BrCtlDialogsProvider.h williamr@2: * @endcode * williamr@2: */ williamr@2: class MBrCtlDialogsProvider williamr@2: { williamr@2: public: // New functions williamr@2: williamr@2: /** williamr@2: * Notifies the user of an error encountered during a download. williamr@2: * Some examples are: insufficient memory, unrecognized URL, and DNS not found. williamr@2: * @since 2.8 williamr@2: * @param aErrCode The error that occured williamr@2: * @return void williamr@2: */ williamr@2: virtual void DialogNotifyErrorL(TInt aErrCode) = 0; williamr@2: williamr@2: /** williamr@2: * Notifies the user of an error from the HTTP server williamr@2: * during a download. Some examples are: file not found, redirect error. williamr@2: * @since 2.8 williamr@2: * @param aErrCode The error that occured williamr@2: * @param aUri The uri of the request that failed williamr@2: * @return void williamr@2: */ williamr@2: virtual void DialogNotifyHttpErrorL(TInt aErrCode, const TDesC& aUri) = 0; williamr@2: williamr@2: /** williamr@2: * Navigates through your file system and selects a file; williamr@2: * analogous to the Browse command in Windows. williamr@2: * @since 2.8 williamr@2: * @param aStartPath The initial displayed directory williamr@2: * @param aRootPath The top most directory that the user can go up to williamr@2: * @param aSelectedFileName The selected file name. williamr@2: * @return ETrue if the user selected a file williamr@2: * EFalse if the user cancelled the transaction and did not select a file. williamr@2: * @attiontion Returned on cleanup stack. Browser control will free the buffer. williamr@2: */ williamr@2: virtual TBool DialogFileSelectLC(const TDesC& aStartPath, williamr@2: const TDesC& aRootPath, williamr@2: HBufC*& aSelectedFileName) = 0; williamr@2: williamr@2: /** williamr@2: * List selection dialog williamr@2: * @since 2.8 williamr@2: * @param Title of the selection dialog. This is optional. williamr@2: * @param aBrCtlSelectOptionType The type of the list box. williamr@2: * Values: One of the following: williamr@2: * Check boxes (multiple selections allowed) williamr@2: * Radio buttons (single selection only). For example, highlight a URL listed williamr@2: * in the session History. williamr@2: * No buttons (single selection only) williamr@2: * No buttons (single selection only), OK softkey available williamr@2: * For example, if you are about to download a plug-in, you can choose williamr@2: * to display the content in the Web page or in a viewer application. williamr@2: * @param aOptions A list of options to display williamr@2: * @return EFalse if the user canceled the dialog selection williamr@2: * ETrue if the user selected an option. williamr@2: */ williamr@2: virtual TBool DialogSelectOptionL(const TDesC& aTitle, williamr@2: TBrCtlSelectOptionType aBrCtlSelectOptionType, williamr@2: CArrayFix& aOptions) = 0; williamr@2: williamr@2: /** williamr@2: * User Authentication dialog. williamr@2: * @since 2.8 williamr@2: * @param aUrl The url requiring authentication williamr@2: * @param aRealm The realm requiring authentication williamr@2: * @param aDefaultUserName The user name that was used before for this realm and path, if any williamr@2: * @param aReturnedUserName The user name entered by the user williamr@2: * @param aReturnedPasswd The password entered by the user williamr@2: * @param aBasicAuthentication ETrue if basic authentication is required. williamr@2: * EFalse if another type of authentication is required; for example, Digest. williamr@2: * Default: EFalse williamr@2: * @return EFalse if the user cancelled the selection williamr@2: * ETrue if the user selected an option. williamr@2: @ attiontion User name and password are returned on cleanup stack. williamr@2: */ williamr@2: virtual TBool DialogUserAuthenticationLC(const TDesC& aUrl, williamr@2: const TDesC& aRealm, williamr@2: const TDesC& aDefaultUserName, williamr@2: HBufC*& aReturnedUserName, williamr@2: HBufC*& aReturnedPasswd, williamr@2: TBool aBasicAuthentication = EFalse) = 0; williamr@2: williamr@2: /** williamr@2: * Displays a message to the user. williamr@2: * For example, the message may inform the user williamr@2: * about an error encountered while processing a request. williamr@2: * @since 2.8 williamr@2: * @param aMessage The message to display williamr@2: * @return void williamr@2: * @attention Softkeys are not supported. williamr@2: * The message disappears after a time out. williamr@2: */ williamr@2: virtual void DialogNoteL(const TDesC& aMessage) = 0; williamr@2: williamr@2: /** williamr@2: * Display a note to the user with ok softkey only williamr@2: * @since 2.8 williamr@2: * @param aTitle The title, could be empty williamr@2: * @param aMessage The message to display williamr@2: * @return void williamr@2: * @attention The OK softkey is supported. williamr@2: * The message displays until the user presses OK. williamr@2: */ williamr@2: virtual void DialogAlertL(const TDesC& aTitle, const TDesC& aMessage) = 0; williamr@2: williamr@2: /** williamr@2: * Display confirmation message to the user. williamr@2: * For example, Are you sure you want to delete this? williamr@2: * @since 2.8 williamr@2: * @param aTitle The title, could be empty williamr@2: * @param aMessage The message to display williamr@2: * @param aYesMessage The text to display on left softkey williamr@2: * @param aNoMessage The text to display on right softkey williamr@2: * @return EFalse if the user cancelled the selection williamr@2: * ETrue if the user selected an option. williamr@2: */ williamr@2: virtual TBool DialogConfirmL(const TDesC& aTitle, williamr@2: const TDesC& aMessage, williamr@2: const TDesC& aYesMessage, williamr@2: const TDesC& aNoMessage) = 0; williamr@2: williamr@2: /** williamr@2: * Displays an input dialog to the user. Asks the user to input data. williamr@2: * @since 2.8 williamr@2: * @param aTitle The title, could be empty williamr@2: * @param aMessage The message to display williamr@2: * @param aDefaultInput The default input if available williamr@2: * @param aReturnedInput The input entered by the user. williamr@2: * @return EFalse if the user cancelled the selection williamr@2: * ETrue if the user selected an option. williamr@2: * @attention Returned on the cleanup stack. williamr@2: */ williamr@2: virtual TBool DialogPromptLC(const TDesC& aTitle, williamr@2: const TDesC& aMessage, williamr@2: const TDesC& aDefaultInput, williamr@2: HBufC*& aReturnedInput) = 0; williamr@2: williamr@2: /** williamr@2: * Displays information about the Netscape plug-in object and williamr@2: * requests confirmation before downloading the object. williamr@2: * @since 2.8 williamr@2: * @param aBrCtlObjectInfo Information about the object to be downloaded. williamr@2: * The following information is passes as part of this object: williamr@2: * Content type williamr@2: * Size williamr@2: * Flag to indicate whether a viewer application exists for this content williamr@2: * Flag to indicate whether a Netscape plug-in exists that supports this content williamr@2: * Name of the application or Netscape plug-in with which the content can williamr@2: * be viewed on the mobile phone williamr@2: * @return EFalse if the user cancelled the selection williamr@2: * ETrue if the user selected an option. williamr@2: */ williamr@2: virtual TBool DialogDownloadObjectL(CBrCtlObjectInfo* aBrCtlObjectInfo) = 0; williamr@2: williamr@2: /** williamr@2: * Display the images that appear in the current page williamr@2: * @since 2.8 williamr@2: * @param aPageImages Array describing the images that appear in the current page. williamr@2: * The array contains the following elements for each image: williamr@2: * Image data williamr@2: * URL of the image williamr@2: * Title for the image williamr@2: * Image type williamr@2: * If the image type is WBMP or OTA, it must be specified. williamr@2: * Symbian can detect any other image type. williamr@2: * @return void williamr@2: */ williamr@2: virtual void DialogDisplayPageImagesL(CArrayFixFlat& aPageImages) = 0; williamr@2: williamr@2: /** williamr@2: * Cancels the dialog displayed due to browser exit or destroyed pages. williamr@2: * @since 2.8 williamr@2: * @return void williamr@2: */ williamr@2: virtual void CancelAll() = 0; williamr@2: williamr@2: /** williamr@2: * Displays a dialog for searching on the page. williamr@2: * @since 3.0 williamr@2: * @return void williamr@2: */ williamr@2: virtual void DialogFindL() = 0; williamr@2: williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * The TBrCtlSelectOptionData class represents a list of elements williamr@2: * to display in the list box. This class is used for the List Selection Dialog. williamr@2: * @code williamr@2: * #include williamr@2: * @lib BrowserEngine.lib williamr@2: * @since 2.8 williamr@2: * @file BrCtlDialogsProvider.h williamr@2: * @endcode * williamr@2: */ williamr@2: class TBrCtlSelectOptionData williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Default Constructor williamr@2: * @return TbrCtlSelectOptionData object williamr@2: * @since 2.8 williamr@2: */ williamr@2: inline TBrCtlSelectOptionData() williamr@2: { williamr@2: iText.Set(NULL, 0); williamr@2: iIsSelected = EFalse; williamr@2: iIsOptGroup = EFalse; williamr@2: iHasOnPick = EFalse; williamr@2: } williamr@2: williamr@2: /** williamr@2: * Constructor williamr@2: * @since 2.8 williamr@2: * @param aText The text to display with this element williamr@2: * @param aIsSelected If the element is selected williamr@2: * @param aIsOptGroup If a title of option group or an element williamr@2: * @param aHasOnPick If has onPick, The dialog should close when the element is selected williamr@2: * @return TbrCtlSelectOptionData object williamr@2: */ williamr@2: inline TBrCtlSelectOptionData( const TDesC& aText, williamr@2: TBool aIsSelected, williamr@2: TBool aIsOptGroup, williamr@2: TBool aHasOnPick ) williamr@2: { williamr@2: iText.Set(aText); williamr@2: iIsSelected = aIsSelected; williamr@2: iIsOptGroup = aIsOptGroup; williamr@2: iHasOnPick = aHasOnPick; williamr@2: } williamr@2: /** williamr@2: * Gets the display text associated with a specified option. williamr@2: * @since 2.8 williamr@2: * @return A reference to a Symbian TDesC object that williamr@2: * contains the text associated with this option. williamr@2: */ williamr@2: inline const TDesC& Text() const {return iText;} williamr@2: /** williamr@2: * Indicates whether or not an option is selected. williamr@2: * @since 2.8 williamr@2: * @return ETrue if the option is selected williamr@2: * EFalse if the option is not selected williamr@2: */ williamr@2: inline TBool IsSelected() const {return iIsSelected;} williamr@2: /** williamr@2: * Indicates whether an option group member williamr@2: * variable is a group title or a selectable option. williamr@2: * @since 2.8 williamr@2: * @return ETrue if the listed item is the title of an option group williamr@2: * EFalse if the listed item is one of the options from which to select williamr@2: */ williamr@2: inline TBool IsOptGroup() const {return iIsOptGroup;} williamr@2: /** williamr@2: * Indicates whether or not the dialog closes when an option is selected. williamr@2: * @since 2.8 williamr@2: * @return ETrue if the dialog closes when the element is selected. williamr@2: * This is known as having OnPick capability. williamr@2: * EFalse if the dialog does not close when the element is selected williamr@2: */ williamr@2: inline TBool HasOnPick() const {return iHasOnPick;} williamr@2: /** williamr@2: * Sets the text of the option object. williamr@2: * @since 2.8 williamr@2: * @param aText A reference to a TDesC object that contains the williamr@2: * text to associate with a particular option. williamr@2: * @return None williamr@2: */ williamr@2: williamr@2: inline void SetText( TDesC& aText ) { iText.Set( aText ); } williamr@2: /** williamr@2: * Sets the selection state of an option. williamr@2: * @since 2.8 williamr@2: * @param aIsSelected The state of the IsSelected member variable. williamr@2: * Value: williamr@2: * ETrue if the option is selected williamr@2: * EFalse if the option is not selected williamr@2: * @return None williamr@2: */ williamr@2: inline void SetIsSelected( TBool aIsSelected ) { iIsSelected = aIsSelected; } williamr@2: /** williamr@2: * Sets the state of the option group member variable. williamr@2: * Indicates whether an option group member variable is a group title williamr@2: * or a selectable option. williamr@2: * @since 2.8 williamr@2: * @param aIsOptGroup The state of the option group. williamr@2: * Value: williamr@2: * ETrue if the listed item is the title of an option group. williamr@2: * EFalse if the listed item is one of the options from which to select. williamr@2: * @return None williamr@2: */ williamr@2: inline void SetIsOptGroup( TBool aIsOptGroup ) { iIsOptGroup = aIsOptGroup; } williamr@2: /** williamr@2: * Sets the state of the hasOnPick member variable. williamr@2: * Indicates whether or not the dialog closes when an option is selected. williamr@2: * @since 2.8 williamr@2: * @param aHasOnPick williamr@2: * ETrue if the dialog closes when the element is selected. This williamr@2: * is known as having OnPick capability. williamr@2: * EFalse if the dialog does not close when the element is selected williamr@2: * @return None williamr@2: */ williamr@2: inline void SetHasOnPick( TBool aHasOnPick ) { iHasOnPick = aHasOnPick; } williamr@2: williamr@2: private: // Data williamr@2: // The text associated with the element williamr@2: TPtrC iText; williamr@2: // Flag if the element is selected williamr@2: TBool iIsSelected; williamr@2: // Flag if an element or oprion group title williamr@2: TBool iIsOptGroup; williamr@2: // Flag if the element has onPick williamr@2: TBool iHasOnPick; williamr@2: }; williamr@2: williamr@2: /** williamr@2: * The CBrCtlObjectInfo class used to represent the information about the williamr@2: * plugin object. williamr@2: * @code williamr@2: * #include williamr@2: * @lib BrowserEngine.lib williamr@2: * @since 3.0 williamr@2: * @file BrCtlDialogsProvider.h williamr@2: * @endcode * williamr@2: */ williamr@2: class CBrCtlObjectInfo : public CBase williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Default Constructor williamr@2: * @since 2.8 williamr@2: */ williamr@2: CBrCtlObjectInfo(); williamr@2: williamr@2: /** williamr@2: * Constructor williamr@2: * @since 3.0 williamr@2: * @param aAppSupported A flag if there is a viewer app for this object williamr@2: * @param aPluginSupported A flag if there is a netscape plugin for this object williamr@2: * @param aSize The size of the object williamr@2: * @param aAppName The name of the viewer app or netscape plugin that supports this object williamr@2: * @param aFileType The content type of the object williamr@2: * @return CBrCtlObjectInfo object williamr@2: */ williamr@2: CBrCtlObjectInfo(TBool aAppSupported, TBool aPluginSupported, williamr@2: const TDesC& aSize, const TDesC& aAppName, williamr@2: const TDesC& aFileType); williamr@2: public: williamr@2: /** williamr@2: * Sets the flag if there is a viewer app for this object williamr@2: * @since 3.0 williamr@2: * @param aAppSupported ETrue if there is a viewer app for this object williamr@2: * EFalse if there is not a viewer app for this object. williamr@2: * @return None williamr@2: */ williamr@2: inline void SetAppSupported(TBool aAppSupported) {iAppSupported = aAppSupported;} williamr@2: /** williamr@2: * Sets the flag if there is a netscape plugin for this object williamr@2: * @since 3.0 williamr@2: * @param aPluginSupported ETrue if there is a netscape plugin for this object williamr@2: * EFalse if there is not a netscape plugin for this object. williamr@2: * @return None williamr@2: */ williamr@2: inline void SetPluginSupported(TBool aPluginSupported) {iPluginSupported = aPluginSupported;} williamr@2: /** williamr@2: * Sets the size of the object williamr@2: * @since 3.0 williamr@2: * @param aSize Symbian descriptor containing the size of the object williamr@2: * @return None williamr@2: */ williamr@2: inline void SetSize(const TDesC& aSize) {iSize.Set(aSize);} williamr@2: /** williamr@2: * Sets the name of the viewer app or netscape plugin that supports this object williamr@2: * @since 3.0 williamr@2: * @param aAppName Symbian descriptor containing the name of williamr@2: * the viewer app or netscape plugin that supports this object. williamr@2: * @return None williamr@2: */ williamr@2: inline void SetAppName(const TDesC& aAppName) {iAppName.Set(aAppName);} williamr@2: /** williamr@2: * Sets the content type of the object williamr@2: * @since 3.0 williamr@2: * @param aFileType Symbian descriptor holding content type of the object williamr@2: * @return None williamr@2: */ williamr@2: inline void SetFileType(const TDesC& aFileType) {iFileType.Set(aFileType);} williamr@2: /** williamr@2: * Tells if there is a viewer app for this object williamr@2: * @since 3.0 williamr@2: * @param None williamr@2: * @return ETrue if there is a viewer app for this object williamr@2: * EFalse if there is not a viewer app for this object. williamr@2: */ williamr@2: inline TBool AppSupported() {return iAppSupported;} williamr@2: /** williamr@2: * Tells if there is a netscape plugin for this object williamr@2: * @since 3.0 williamr@2: * @param None williamr@2: * @return ETrue if there is a netscape plugin for this object williamr@2: * EFalse if there is not a netscape plugin for this object. williamr@2: */ williamr@2: inline TBool PluginSupported() {return iPluginSupported;} williamr@2: /** williamr@2: * Gets the size of the object williamr@2: * @since 3.0 williamr@2: * @param None williamr@2: * @return Symbian descriptor containing the size of the object williamr@2: */ williamr@2: inline const TDesC& Size() const {return iSize;} williamr@2: /** williamr@2: * Gets the name of the viewer app or netscape plugin that supports this object williamr@2: * @since 3.0 williamr@2: * @param None williamr@2: * @return Symbian descriptor containing the name of williamr@2: * the viewer app or netscape plugin that supports this object. williamr@2: */ williamr@2: inline const TDesC& AppName() const {return iAppName;} williamr@2: /** williamr@2: * Gets the content type of the object williamr@2: * @since 3.0 williamr@2: * @param None williamr@2: * @return Symbian descriptor holding content type of the object williamr@2: */ williamr@2: inline const TDesC& FileType() const {return iFileType;} williamr@2: private: williamr@2: // A flag if there is a viewer app for this object williamr@2: TBool iAppSupported; williamr@2: // A flag if there is a Netscape plugin for this object williamr@2: TBool iPluginSupported; williamr@2: // The size of the object williamr@2: TPtrC iSize; williamr@2: // The name of the viewer app or Netscape plugin williamr@2: TPtrC iAppName; williamr@2: // The content type of the object williamr@2: TPtrC iFileType; williamr@2: }; williamr@2: williamr@2: /** williamr@2: * TheTBrCtlImageCarrier class used to give the information about the williamr@2: * image. williamr@2: * @code williamr@2: * #include williamr@2: * @lib BrowserEngine.lib williamr@2: * @since 2.8 williamr@2: * @file BrCtlDialogsProvider.h williamr@2: * @endcode * williamr@2: */ williamr@2: class TBrCtlImageCarrier williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Constructor williamr@2: * @since 2.8 williamr@2: * @param aRawData The image data williamr@2: * @param aUrl The url of the image williamr@2: * @param aAltText The alt text of the image williamr@2: * @param aImageType The type of the image williamr@2: */ williamr@2: TBrCtlImageCarrier(const TDesC8& aRawData, const TDesC& aUrl, williamr@2: const TDesC& aAltText, TBrCtlImageType aImageType, const TDesC& aContentType ) : williamr@2: iRawData( aRawData ), williamr@2: iUrl( aUrl ), williamr@2: iAltText( aAltText ), williamr@2: iImageType(aImageType), williamr@2: iContentType(aContentType) williamr@2: { williamr@2: } williamr@2: /** williamr@2: * Provides the image data williamr@2: * @since 3.0 williamr@2: * @param None williamr@2: * @return Symbian descriptor containing image data williamr@2: */ williamr@2: inline const TDesC8& RawData() const {return iRawData;} williamr@2: /** williamr@2: * Provides the url of the image williamr@2: * @since 3.0 williamr@2: * @param None williamr@2: * @return Symbian descriptor containing url of the image williamr@2: */ williamr@2: inline const TDesC& Url() const {return iUrl;} williamr@2: /** williamr@2: * Provides the alt text of the image williamr@2: * @since 3.0 williamr@2: * @param None williamr@2: * @return Symbian descriptor containing alt text of the image williamr@2: */ williamr@2: inline const TDesC& AltText() const {return iAltText;} williamr@2: /** williamr@2: * Provides the type of the image williamr@2: * @since 3.0 williamr@2: * @param None williamr@2: * @return Symbian descriptor containing the type of the image williamr@2: */ williamr@2: inline TBrCtlImageType ImageType() const {return iImageType;} williamr@2: /** williamr@2: * Provides the content type of the image williamr@2: * @since 3.1 williamr@2: * @param None williamr@2: * @return Symbian descriptor containing content type of the image williamr@2: */ williamr@2: inline const TDesC& ContentType() const {return iContentType;} williamr@2: private: williamr@2: TPtrC8 iRawData; williamr@2: TPtrC iUrl; williamr@2: TPtrC iAltText; williamr@2: TBrCtlImageType iImageType; williamr@2: TPtrC iContentType; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif // BRCTLDIALOGSPROVIDER_H williamr@2: williamr@2: // End of File