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