khtml Library API Documentation

khtml_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., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef __konq_htmlsettings_h__
00021 #define __konq_htmlsettings_h__
00022 
00023 class KConfig;
00024 #include <qcolor.h>
00025 #include <qstring.h>
00026 #include <qstringlist.h>
00027 #include <qfont.h>
00028 #include <qmap.h>
00029 
00030 #include <kdelibs_export.h>
00031 
00032 struct KPerDomainSettings;
00033 class KHTMLSettingsPrivate;
00034 
00038 class KHTML_EXPORT KHTMLSettings
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     KHTMLSettings();
00103     KHTMLSettings(const KHTMLSettings &other);
00104 
00108     void init();
00109 
00114     void init( KConfig * config, bool reset = true );
00115 
00119     virtual ~KHTMLSettings();
00120 
00121     // Behavior settings
00122     bool changeCursor() const;
00123     bool underlineLink() const;
00124     bool hoverLink() const;
00125     bool allowTabulation() const;
00126     bool autoSpellCheck() const;
00127     KAnimationAdvice showAnimations() const;
00128 
00129     // Font settings
00130     QString stdFontName() const;
00131     QString fixedFontName() const;
00132     QString serifFontName() const;
00133     QString sansSerifFontName() const;
00134     QString cursiveFontName() const;
00135     QString fantasyFontName() const;
00136 
00137     // these two can be set. Mainly for historical reasons (the method in KHTMLPart exists...)
00138     void setStdFontName(const QString &n);
00139     void setFixedFontName(const QString &n);
00140 
00141     int minFontSize() const;
00142     int mediumFontSize() const;
00143 
00144     bool jsErrorsEnabled() const;
00145     void setJSErrorsEnabled(bool enabled);
00146 
00147     const QString &encoding() const;
00148 
00149     bool followSystemColors() const;
00150 
00151     // Color settings
00152     const QColor& textColor() const;
00153     const QColor& baseColor() const;
00154     const QColor& linkColor() const;
00155     const QColor& vLinkColor() const;
00156 
00157     // Autoload images
00158     bool autoLoadImages() const;
00159     bool unfinishedImageFrame() const;
00160 
00161     bool isOpenMiddleClickEnabled();
00162     bool isBackRightClickEnabled();
00163 
00164     // Java and JavaScript
00165     // ### BIC make these const
00166     bool isJavaEnabled( const QString& hostname = QString::null );
00167     bool isJavaScriptEnabled( const QString& hostname = QString::null );
00168     bool isJavaScriptDebugEnabled( const QString& hostname = QString::null );
00169     bool isJavaScriptErrorReportingEnabled( const QString& hostname = QString::null ) const;
00170     bool isPluginsEnabled( const QString& hostname = QString::null );
00171     KJSWindowOpenPolicy windowOpenPolicy( const QString& hostname = QString::null ) const;
00172     KJSWindowMovePolicy windowMovePolicy( const QString& hostname = QString::null ) const;
00173     KJSWindowResizePolicy windowResizePolicy( const QString& hostname = QString::null ) const;
00174     KJSWindowStatusPolicy windowStatusPolicy( const QString& hostname = QString::null ) const;
00175     KJSWindowFocusPolicy windowFocusPolicy( const QString& hostname = QString::null ) const;
00176 
00177     // helpers for parsing domain-specific configuration, used in KControl module as well
00178     static KJavaScriptAdvice strToAdvice(const QString& _str);
00179     static void splitDomainAdvice(const QString& configStr, QString &domain,
00180                   KJavaScriptAdvice &javaAdvice, KJavaScriptAdvice& javaScriptAdvice);
00181     static const char* adviceToStr(KJavaScriptAdvice _advice);
00182 
00189     void readDomainSettings(KConfig *config, bool reset,
00190             bool global, KPerDomainSettings &pd_settings);
00191 
00192     QString settingsToCSS() const;
00193     static const QString &availableFamilies();
00194 
00195     QString userStyleSheet() const;
00196 
00197     // Form completion
00198     bool isFormCompletionEnabled() const;
00199     int maxFormCompletionItems() const;
00200 
00201     // Meta refresh/redirect (http-equiv)
00202     bool isAutoDelayedActionsEnabled () const;
00203 
00204 private:
00205     friend class KHTMLFactory;
00206     QString lookupFont(int i) const;
00207 
00208     KHTMLSettingsPrivate *d;
00209     static QString *avFamilies;
00210 };
00211 
00212 #endif
KDE Logo
This file is part of the documentation for khtml Library Version 3.4.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 9 08:08:14 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003