tdehtml_settings.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 1999 David Faure <faure@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef __konq_htmlsettings_h__ 00021 #define __konq_htmlsettings_h__ 00022 00023 class TDEConfig; 00024 #include <tqcolor.h> 00025 #include <tqstring.h> 00026 #include <tqstringlist.h> 00027 #include <tqfont.h> 00028 #include <tqmap.h> 00029 00030 #include <tdelibs_export.h> 00031 00032 struct KPerDomainSettings; 00033 class TDEHTMLSettingsPrivate; 00034 00038 class TDEHTML_EXPORT TDEHTMLSettings 00039 { 00040 public: 00041 00045 enum KJavaScriptAdvice { 00046 KJavaScriptDunno=0, 00047 KJavaScriptAccept, 00048 KJavaScriptReject 00049 }; 00050 00051 enum KAnimationAdvice { 00052 KAnimationDisabled=0, 00053 KAnimationLoopOnce, 00054 KAnimationEnabled 00055 }; 00056 00060 enum KJSWindowOpenPolicy { 00061 KJSWindowOpenAllow=0, 00062 KJSWindowOpenAsk, 00063 KJSWindowOpenDeny, 00064 KJSWindowOpenSmart 00065 }; 00066 00070 enum KJSWindowStatusPolicy { 00071 KJSWindowStatusAllow=0, 00072 KJSWindowStatusIgnore 00073 }; 00074 00078 enum KJSWindowMovePolicy { 00079 KJSWindowMoveAllow=0, 00080 KJSWindowMoveIgnore 00081 }; 00082 00086 enum KJSWindowResizePolicy { 00087 KJSWindowResizeAllow=0, 00088 KJSWindowResizeIgnore 00089 }; 00090 00094 enum KJSWindowFocusPolicy { 00095 KJSWindowFocusAllow=0, 00096 KJSWindowFocusIgnore 00097 }; 00098 00102 TDEHTMLSettings(); 00103 TDEHTMLSettings(const TDEHTMLSettings &other); 00104 00108 void init(); 00109 00115 void init( TDEConfig * config, bool reset = true ); 00116 00120 virtual ~TDEHTMLSettings(); 00121 00122 // Behavior settings 00123 bool changeCursor() const; 00124 bool underlineLink() const; 00125 bool hoverLink() const; 00126 bool allowTabulation() const; 00127 bool autoSpellCheck() const; 00128 KAnimationAdvice showAnimations() const; 00129 00130 // Font settings 00131 TQString stdFontName() const; 00132 TQString fixedFontName() const; 00133 TQString serifFontName() const; 00134 TQString sansSerifFontName() const; 00135 TQString cursiveFontName() const; 00136 TQString fantasyFontName() const; 00137 00138 // these two can be set. Mainly for historical reasons (the method in TDEHTMLPart exists...) 00139 void setStdFontName(const TQString &n); 00140 void setFixedFontName(const TQString &n); 00141 00142 int minFontSize() const; 00143 int mediumFontSize() const; 00144 00145 bool jsErrorsEnabled() const; 00146 void setJSErrorsEnabled(bool enabled); 00147 00148 const TQString &encoding() const; 00149 00150 bool followSystemColors() const; 00151 00152 // Color settings 00153 const TQColor& textColor() const; 00154 const TQColor& baseColor() const; 00155 const TQColor& linkColor() const; 00156 const TQColor& vLinkColor() const; 00157 00158 // Autoload images 00159 bool autoLoadImages() const; 00160 bool unfinishedImageFrame() const; 00161 00162 bool isOpenMiddleClickEnabled(); 00163 bool isBackRightClickEnabled(); 00164 00165 // Java and JavaScript 00166 // ### BIC make these const 00167 bool isJavaEnabled( const TQString& hostname = TQString::null ); 00168 bool isJavaScriptEnabled( const TQString& hostname = TQString::null ); 00169 bool isJavaScriptDebugEnabled( const TQString& hostname = TQString::null ); 00170 bool isJavaScriptErrorReportingEnabled( const TQString& hostname = TQString::null ) const; 00171 bool isPluginsEnabled( const TQString& hostname = TQString::null ); 00172 00173 // AdBlocK Filtering 00174 bool isAdFiltered( const TQString &url ) const; 00175 bool isAdFilterEnabled() const; 00176 bool isHideAdsEnabled() const; 00177 void addAdFilter( const TQString &url ); 00178 00179 // Access Keys 00180 bool accessKeysEnabled() const; 00181 00182 KJSWindowOpenPolicy windowOpenPolicy( const TQString& hostname = TQString::null ) const; 00183 KJSWindowMovePolicy windowMovePolicy( const TQString& hostname = TQString::null ) const; 00184 KJSWindowResizePolicy windowResizePolicy( const TQString& hostname = TQString::null ) const; 00185 KJSWindowStatusPolicy windowStatusPolicy( const TQString& hostname = TQString::null ) const; 00186 KJSWindowFocusPolicy windowFocusPolicy( const TQString& hostname = TQString::null ) const; 00187 00188 // helpers for parsing domain-specific configuration, used in KControl module as well 00189 static KJavaScriptAdvice strToAdvice(const TQString& _str); 00190 static void splitDomainAdvice(const TQString& configStr, TQString &domain, 00191 KJavaScriptAdvice &javaAdvice, KJavaScriptAdvice& javaScriptAdvice); 00192 static const char* adviceToStr(KJavaScriptAdvice _advice); 00193 00202 void readDomainSettings(TDEConfig *config, bool reset, 00203 bool global, KPerDomainSettings &pd_settings); 00204 00205 TQString settingsToCSS() const; 00206 static const TQString &availableFamilies(); 00207 00208 TQString userStyleSheet() const; 00209 00210 // Form completion 00211 bool isFormCompletionEnabled() const; 00212 int maxFormCompletionItems() const; 00213 00214 // Meta refresh/redirect (http-equiv) 00215 bool isAutoDelayedActionsEnabled () const; 00216 00217 TQValueList< TQPair< TQString, TQChar > > fallbackAccessKeysAssignments() const; 00218 00219 // Whether to show passive popup when windows are blocked 00220 // @since 3.5 00221 void setJSPopupBlockerPassivePopup(bool enabled); 00222 bool jsPopupBlockerPassivePopup() const; 00223 00224 private: 00225 friend class TDEHTMLFactory; 00226 TQString lookupFont(int i) const; 00227 00228 TDEHTMLSettingsPrivate *d; 00229 static TQString *avFamilies; 00230 }; 00231 00232 #endif