KHTML
khtml_settings.h
Go to the documentation of this file.
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 KHTML_SETTINGS_H 00021 #define KHTML_SETTINGS_H 00022 00023 class KConfig; 00024 class KConfigGroup; 00025 00026 #include <khtml_export.h> 00027 00028 #include <QtGui/QColor> 00029 #include <QtGui/QFont> // ### KDE 5: remove 00030 #include <QtCore/QMap> // ### KDE 5: remove 00031 #include <QtCore/QStringList> 00032 #include <QtCore/QPair> 00033 00034 struct KPerDomainSettings; 00035 class KHTMLSettingsPrivate; 00036 00040 class KHTML_EXPORT KHTMLSettings 00041 { 00042 public: 00043 00047 enum KJavaScriptAdvice { 00048 KJavaScriptDunno=0, 00049 KJavaScriptAccept, 00050 KJavaScriptReject 00051 }; 00052 00053 enum KAnimationAdvice { 00054 KAnimationDisabled=0, 00055 KAnimationLoopOnce, 00056 KAnimationEnabled 00057 }; 00058 00059 enum KSmoothScrollingMode { 00060 KSmoothScrollingDisabled=0, 00061 KSmoothScrollingWhenEfficient, 00062 KSmoothScrollingEnabled 00063 }; 00064 00065 enum KDNSPrefetch { 00066 KDNSPrefetchDisabled=0, 00067 KDNSPrefetchOnlyWWWAndSLD, 00068 KDNSPrefetchEnabled 00069 }; 00070 00074 enum KJSWindowOpenPolicy { 00075 KJSWindowOpenAllow=0, 00076 KJSWindowOpenAsk, 00077 KJSWindowOpenDeny, 00078 KJSWindowOpenSmart 00079 }; 00080 00084 enum KJSWindowStatusPolicy { 00085 KJSWindowStatusAllow=0, 00086 KJSWindowStatusIgnore 00087 }; 00088 00092 enum KJSWindowMovePolicy { 00093 KJSWindowMoveAllow=0, 00094 KJSWindowMoveIgnore 00095 }; 00096 00100 enum KJSWindowResizePolicy { 00101 KJSWindowResizeAllow=0, 00102 KJSWindowResizeIgnore 00103 }; 00104 00108 enum KJSWindowFocusPolicy { 00109 KJSWindowFocusAllow=0, 00110 KJSWindowFocusIgnore 00111 }; 00112 00116 KHTMLSettings(); 00117 KHTMLSettings(const KHTMLSettings &other); 00118 00122 void init(); 00123 00129 void init( KConfig * config, bool reset = true ); 00130 00134 virtual ~KHTMLSettings(); 00135 00136 // Behavior settings 00137 bool changeCursor() const; 00138 bool underlineLink() const; 00139 bool hoverLink() const; 00140 bool allowTabulation() const; 00141 bool autoSpellCheck() const; 00142 KAnimationAdvice showAnimations() const; 00143 KSmoothScrollingMode smoothScrolling() const; 00144 KDNSPrefetch dnsPrefetch() const; 00145 00146 // Font settings 00147 QString stdFontName() const; 00148 QString fixedFontName() const; 00149 QString serifFontName() const; 00150 QString sansSerifFontName() const; 00151 QString cursiveFontName() const; 00152 QString fantasyFontName() const; 00153 00154 // these two can be set. Mainly for historical reasons (the method in KHTMLPart exists...) 00155 void setStdFontName(const QString &n); 00156 void setFixedFontName(const QString &n); 00157 00158 int minFontSize() const; 00159 int mediumFontSize() const; 00160 00161 bool jsErrorsEnabled() const; 00162 void setJSErrorsEnabled(bool enabled); 00163 00164 const QString &encoding() const; 00165 00166 bool followSystemColors() const; 00167 00168 // Color settings 00169 const QColor& textColor() const; 00170 const QColor& baseColor() const; 00171 const QColor& linkColor() const; 00172 const QColor& vLinkColor() const; 00173 00174 // Autoload images 00175 bool autoLoadImages() const; 00176 bool unfinishedImageFrame() const; 00177 00178 bool isOpenMiddleClickEnabled(); 00180 bool isBackRightClickEnabled(); 00181 00182 // Java and JavaScript 00183 bool isJavaEnabled( const QString& hostname = QString() ) const; 00184 bool isJavaScriptEnabled( const QString& hostname = QString() ) const; 00185 bool isJavaScriptDebugEnabled( const QString& hostname = QString() ) const; 00186 bool isJavaScriptErrorReportingEnabled( const QString& hostname = QString() ) const; 00187 bool isPluginsEnabled( const QString& hostname = QString() ) const; 00188 00189 // AdBlocK Filtering 00190 00195 bool isAdFiltered( const QString &url ) const; 00196 00205 QString adFilteredBy( const QString &url, bool *isWhiteListed = 0 ) const; 00206 00207 bool isAdFilterEnabled() const; 00208 bool isHideAdsEnabled() const; 00209 void addAdFilter( const QString &url ); 00210 00211 // Access Keys 00212 bool accessKeysEnabled() const; 00213 00214 KJSWindowOpenPolicy windowOpenPolicy( const QString& hostname = QString() ) const; 00215 KJSWindowMovePolicy windowMovePolicy( const QString& hostname = QString() ) const; 00216 KJSWindowResizePolicy windowResizePolicy( const QString& hostname = QString() ) const; 00217 KJSWindowStatusPolicy windowStatusPolicy( const QString& hostname = QString() ) const; 00218 KJSWindowFocusPolicy windowFocusPolicy( const QString& hostname = QString() ) const; 00219 00220 // helpers for parsing domain-specific configuration, used in KControl module as well 00221 static KJavaScriptAdvice strToAdvice(const QString& _str); 00222 static void splitDomainAdvice(const QString& configStr, QString &domain, 00223 KJavaScriptAdvice &javaAdvice, KJavaScriptAdvice& javaScriptAdvice); 00224 static const char* adviceToStr(KJavaScriptAdvice _advice); 00225 00234 void readDomainSettings(const KConfigGroup &config, bool reset, 00235 bool global, KPerDomainSettings &pd_settings); 00236 00237 QString settingsToCSS() const; 00238 static const QString &availableFamilies(); 00239 00240 QString userStyleSheet() const; 00241 00242 // Form completion 00243 bool isFormCompletionEnabled() const; 00244 int maxFormCompletionItems() const; 00245 00246 // Meta refresh/redirect (http-equiv) 00247 bool isAutoDelayedActionsEnabled () const; 00248 00249 QList< QPair< QString, QChar > > fallbackAccessKeysAssignments() const; 00250 00251 // Whether to show passive popup when windows are blocked 00252 void setJSPopupBlockerPassivePopup(bool enabled); 00253 bool jsPopupBlockerPassivePopup() const; 00254 00255 private: 00256 friend class KHTMLGlobal; 00257 QString lookupFont(int i) const; 00258 00259 KHTMLSettingsPrivate* const d; 00260 static QString *avFamilies; 00261 }; 00262 00263 #endif
KDE 4.6 API Reference