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 #include <kdelibs_export.h>
00030 
00031 struct KPerDomainSettings;
00032 class KHTMLSettingsPrivate;
00033 
00037 class KHTML_EXPORT KHTMLSettings
00038 {
00039 public:
00040 
00044     enum KJavaScriptAdvice {
00045     KJavaScriptDunno=0,
00046     KJavaScriptAccept,
00047     KJavaScriptReject
00048     };
00049 
00050     enum KAnimationAdvice {
00051         KAnimationDisabled=0,
00052         KAnimationLoopOnce,
00053         KAnimationEnabled
00054     };
00055 
00059     enum KJSWindowOpenPolicy {
00060         KJSWindowOpenAllow=0,
00061         KJSWindowOpenAsk,
00062         KJSWindowOpenDeny,
00063         KJSWindowOpenSmart
00064     };
00065 
00069     enum KJSWindowStatusPolicy {
00070         KJSWindowStatusAllow=0,
00071         KJSWindowStatusIgnore
00072     };
00073 
00077     enum KJSWindowMovePolicy {
00078         KJSWindowMoveAllow=0,
00079         KJSWindowMoveIgnore
00080     };
00081 
00085     enum KJSWindowResizePolicy {
00086         KJSWindowResizeAllow=0,
00087         KJSWindowResizeIgnore
00088     };
00089 
00093     enum KJSWindowFocusPolicy {
00094         KJSWindowFocusAllow=0,
00095         KJSWindowFocusIgnore
00096     };
00097 
00101     KHTMLSettings();
00102     KHTMLSettings(const KHTMLSettings &other);
00103 
00107     void init();
00108 
00113     void init( KConfig * config, bool reset = true );
00114 
00118     virtual ~KHTMLSettings();
00119 
00120     // Behavior settings
00121     bool changeCursor() const;
00122     bool underlineLink() const;
00123     bool hoverLink() const;
00124     KAnimationAdvice showAnimations() const;
00125 
00126     // Font settings
00127     QString stdFontName() const;
00128     QString fixedFontName() const;
00129     QString serifFontName() const;
00130     QString sansSerifFontName() const;
00131     QString cursiveFontName() const;
00132     QString fantasyFontName() const;
00133 
00134     // these two can be set. Mainly for historical reasons (the method in KHTMLPart exists...)
00135     void setStdFontName(const QString &n);
00136     void setFixedFontName(const QString &n);
00137 
00138     int minFontSize() const;
00139     int mediumFontSize() const;
00140 
00141     bool jsErrorsEnabled() const;
00142     void setJSErrorsEnabled(bool enabled);
00143 
00144     const QString &encoding() const;
00145 
00146     // Color settings
00147     const QColor& textColor() const;
00148     const QColor& linkColor() const;
00149     const QColor& vLinkColor() const;
00150 
00151     // Autoload images
00152     bool autoLoadImages() const;
00153 
00154     bool isOpenMiddleClickEnabled();
00155     bool isBackRightClickEnabled();
00156 
00157     // Java and JavaScript
00158     // ### BIC make these const
00159     bool isJavaEnabled( const QString& hostname = QString::null );
00160     bool isJavaScriptEnabled( const QString& hostname = QString::null );
00161     bool isJavaScriptDebugEnabled( const QString& hostname = QString::null );
00162     bool isJavaScriptErrorReportingEnabled( const QString& hostname = QString::null ) const;
00163     bool isPluginsEnabled( const QString& hostname = QString::null );
00164     KJSWindowOpenPolicy windowOpenPolicy( const QString& hostname = QString::null ) const;
00165     KJSWindowMovePolicy windowMovePolicy( const QString& hostname = QString::null ) const;
00166     KJSWindowResizePolicy windowResizePolicy( const QString& hostname = QString::null ) const;
00167     KJSWindowStatusPolicy windowStatusPolicy( const QString& hostname = QString::null ) const;
00168     KJSWindowFocusPolicy windowFocusPolicy( const QString& hostname = QString::null ) const;
00169 
00170     // helpers for parsing domain-specific configuration, used in KControl module as well
00171     static KJavaScriptAdvice strToAdvice(const QString& _str);
00172     static void splitDomainAdvice(const QString& configStr, QString &domain,
00173                   KJavaScriptAdvice &javaAdvice, KJavaScriptAdvice& javaScriptAdvice);
00174     static const char* adviceToStr(KJavaScriptAdvice _advice);
00175 
00182     void readDomainSettings(KConfig *config, bool reset,
00183             bool global, KPerDomainSettings &pd_settings);
00184 
00185     QString settingsToCSS() const;
00186     static const QString &availableFamilies();
00187 
00188     QString userStyleSheet() const;
00189 
00190     // Form completion
00191     bool isFormCompletionEnabled() const;
00192     int maxFormCompletionItems() const;
00193 
00194     // Meta refresh/redirect (http-equiv)
00195     bool isAutoDelayedActionsEnabled () const;
00196 
00197 private:
00198     friend class KHTMLFactory;
00199     QString lookupFont(int i) const;
00200 
00201     KHTMLSettingsPrivate *d;
00202     static QString *avFamilies;
00203 };
00204 
00205 #endif
KDE Logo
This file is part of the documentation for khtml Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 30 10:22:20 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003