00001 /* 00002 * ============================================================================== 00003 * Name : BrCtlDialogsProvider.h 00004 * Part of : WebKit \ BrowserControl 00005 * Interface : Browser Control API 00006 * Description : Handle dialogs needed for browser operation 00007 * Version : %Version% 00008 * 00009 * Copyright (c) 2006, Nokia Corporation 00010 * All rights reserved. 00011 * 00012 * Redistribution and use in source and binary forms, with or without 00013 * modification, are permitted provided that the following conditions 00014 * are met: 00015 * 00016 * * Redistributions of source code must retain the above copyright 00017 * notice, this list of conditions and the following disclaimer. 00018 * * Redistributions in binary form must reproduce the above copyright 00019 * notice, this list of conditions and the following disclaimer in 00020 * the documentation and/or other materials provided with the 00021 * distribution. 00022 * * Neither the name of the Nokia Corporation nor the names of its 00023 * contributors may be used to endorse or promote products derived 00024 * from this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00027 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00028 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00029 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00030 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00031 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00032 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00033 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00034 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00035 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00036 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00037 * DAMAGE. 00038 * 00039 * Please see file patentlicense.txt for further grants. 00040 * ============================================================================== 00041 */ 00042 00043 00044 #ifndef BRCTLDIALOGSPROVIDER_H 00045 #define BRCTLDIALOGSPROVIDER_H 00046 00047 // INCLUDES 00048 #include <e32std.h> 00049 #include <e32base.h> 00050 00054 enum TBrCtlSelectOptionType 00055 { 00056 ESelectTypeMultiple, 00057 ESelectTypeSingle, 00058 ESelectTypeNone, 00059 00064 ESelectTypeOkOnly 00065 }; 00066 00072 enum TBrCtlImageType 00073 { 00074 EImageTypeAny, 00075 EImageTypeWbmp, 00076 EImageTypeOta 00077 }; 00078 00079 00080 // FORWARD DECLARATIONS 00081 class TBrCtlSelectOptionData; 00082 class CBrCtlObjectInfo; 00083 class TBrCtlImageCarrier; 00084 00101 class MBrCtlDialogsProvider 00102 { 00103 public: // New functions 00104 00112 virtual void DialogNotifyErrorL(TInt aErrCode) = 0; 00113 00122 virtual void DialogNotifyHttpErrorL(TInt aErrCode, const TDesC& aUri) = 0; 00123 00135 virtual TBool DialogFileSelectLC(const TDesC& aStartPath, 00136 const TDesC& aRootPath, 00137 HBufC*& aSelectedFileName) = 0; 00138 00156 virtual TBool DialogSelectOptionL(const TDesC& aTitle, 00157 TBrCtlSelectOptionType aBrCtlSelectOptionType, 00158 CArrayFix<TBrCtlSelectOptionData>& aOptions) = 0; 00159 00175 virtual TBool DialogUserAuthenticationLC(const TDesC& aUrl, 00176 const TDesC& aRealm, 00177 const TDesC& aDefaultUserName, 00178 HBufC*& aReturnedUserName, 00179 HBufC*& aReturnedPasswd, 00180 TBool aBasicAuthentication = EFalse) = 0; 00181 00192 virtual void DialogNoteL(const TDesC& aMessage) = 0; 00193 00203 virtual void DialogAlertL(const TDesC& aTitle, const TDesC& aMessage) = 0; 00204 00216 virtual TBool DialogConfirmL(const TDesC& aTitle, 00217 const TDesC& aMessage, 00218 const TDesC& aYesMessage, 00219 const TDesC& aNoMessage) = 0; 00220 00232 virtual TBool DialogPromptLC(const TDesC& aTitle, 00233 const TDesC& aMessage, 00234 const TDesC& aDefaultInput, 00235 HBufC*& aReturnedInput) = 0; 00236 00252 virtual TBool DialogDownloadObjectL(CBrCtlObjectInfo* aBrCtlObjectInfo) = 0; 00253 00267 virtual void DialogDisplayPageImagesL(CArrayFixFlat<TBrCtlImageCarrier>& aPageImages) = 0; 00268 00274 virtual void CancelAll() = 0; 00275 00281 virtual void DialogFindL() = 0; 00282 }; 00283 00284 00295 class TBrCtlSelectOptionData 00296 { 00297 public: 00303 inline TBrCtlSelectOptionData() 00304 { 00305 iText.Set(NULL, 0); 00306 iIsSelected = EFalse; 00307 iIsOptGroup = EFalse; 00308 iHasOnPick = EFalse; 00309 } 00310 00320 inline TBrCtlSelectOptionData( const TDesC& aText, 00321 TBool aIsSelected, 00322 TBool aIsOptGroup, 00323 TBool aHasOnPick ) 00324 { 00325 iText.Set(aText); 00326 iIsSelected = aIsSelected; 00327 iIsOptGroup = aIsOptGroup; 00328 iHasOnPick = aHasOnPick; 00329 } 00336 inline const TDesC& Text() const {return iText;} 00343 inline TBool IsSelected() const {return iIsSelected;} 00351 inline TBool IsOptGroup() const {return iIsOptGroup;} 00359 inline TBool HasOnPick() const {return iHasOnPick;} 00368 inline void SetText( TDesC& aText ) { iText.Set( aText ); } 00378 inline void SetIsSelected( TBool aIsSelected ) { iIsSelected = aIsSelected; } 00390 inline void SetIsOptGroup( TBool aIsOptGroup ) { iIsOptGroup = aIsOptGroup; } 00401 inline void SetHasOnPick( TBool aHasOnPick ) { iHasOnPick = aHasOnPick; } 00402 00403 private: // Data 00404 // The text associated with the element 00405 TPtrC iText; 00406 // Flag if the element is selected 00407 TBool iIsSelected; 00408 // Flag if an element or oprion group title 00409 TBool iIsOptGroup; 00410 // Flag if the element has onPick 00411 TBool iHasOnPick; 00412 }; 00413 00424 class CBrCtlObjectInfo : public CBase 00425 { 00426 public: 00431 CBrCtlObjectInfo(); 00432 00443 CBrCtlObjectInfo(TBool aAppSupported, TBool aPluginSupported, 00444 const TDesC& aSize, const TDesC& aAppName, 00445 const TDesC& aFileType); 00446 public: 00454 inline void SetAppSupported(TBool aAppSupported) {iAppSupported = aAppSupported;} 00462 inline void SetPluginSupported(TBool aPluginSupported) {iPluginSupported = aPluginSupported;} 00469 inline void SetSize(const TDesC& aSize) {iSize.Set(aSize);} 00477 inline void SetAppName(const TDesC& aAppName) {iAppName.Set(aAppName);} 00484 inline void SetFileType(const TDesC& aFileType) {iFileType.Set(aFileType);} 00492 inline TBool AppSupported() {return iAppSupported;} 00500 inline TBool PluginSupported() {return iPluginSupported;} 00507 inline const TDesC& Size() const {return iSize;} 00515 inline const TDesC& AppName() const {return iAppName;} 00522 inline const TDesC& FileType() const {return iFileType;} 00523 private: 00524 // A flag if there is a viewer app for this object 00525 TBool iAppSupported; 00526 // A flag if there is a Netscape plugin for this object 00527 TBool iPluginSupported; 00528 // The size of the object 00529 TPtrC iSize; 00530 // The name of the viewer app or Netscape plugin 00531 TPtrC iAppName; 00532 // The content type of the object 00533 TPtrC iFileType; 00534 }; 00535 00546 class TBrCtlImageCarrier 00547 { 00548 public: 00549 #start_since SINCE_3_1_SDK 00550 00559 TBrCtlImageCarrier(const TDesC8& aRawData, const TDesC& aUrl, 00560 const TDesC& aAltText, TBrCtlImageType aImageType, const TDesC& aContentType ) : 00561 iRawData( aRawData ), 00562 iUrl( aUrl ), 00563 iAltText( aAltText ), 00564 iImageType(aImageType), 00565 iContentType(aContentType) 00566 { 00567 } 00568 #end_since SINCE_3_1_SDK 00569 00575 inline const TDesC8& RawData() const {return iRawData;} 00582 inline const TDesC& Url() const {return iUrl;} 00589 inline const TDesC& AltText() const {return iAltText;} 00596 inline TBrCtlImageType ImageType() const {return iImageType;} 00597 #start_since SINCE_3_1_SDK 00598 00605 inline const TDesC& ContentType() const {return iContentType;} 00606 #end_since SINCE_3_1_SDK 00607 private: 00608 TPtrC8 iRawData; 00609 TPtrC iUrl; 00610 TPtrC iAltText; 00611 TBrCtlImageType iImageType; 00612 TPtrC iContentType; 00613 }; 00614 00615 00616 // BRCTLDIALOGSPROVIDER_H 00617 #endif 00618 00619 // End of File