home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / khtml_settings.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  6.8 KB  |  233 lines

  1. /* This file is part of the KDE project
  2.    Copyright (C) 1999 David Faure <faure@kde.org>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License as published by the Free Software Foundation; either
  7.    version 2 of the License, or (at your option) any later version.
  8.  
  9.    This library is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.    Library General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU Library General Public License
  15.    along with this library; see the file COPYING.LIB.  If not, write to
  16.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.    Boston, MA 02110-1301, USA.
  18. */
  19.  
  20. #ifndef __konq_htmlsettings_h__
  21. #define __konq_htmlsettings_h__
  22.  
  23. class KConfig;
  24. #include <qcolor.h>
  25. #include <qstring.h>
  26. #include <qstringlist.h>
  27. #include <qfont.h>
  28. #include <qmap.h>
  29.  
  30. #include <kdelibs_export.h>
  31.  
  32. struct KPerDomainSettings;
  33. class KHTMLSettingsPrivate;
  34.  
  35. /**
  36.  * Settings for the HTML view.
  37.  */
  38. class KHTML_EXPORT KHTMLSettings
  39. {
  40. public:
  41.  
  42.     /**
  43.      * This enum specifies whether Java/JavaScript execution is allowed.
  44.      */
  45.     enum KJavaScriptAdvice {
  46.     KJavaScriptDunno=0,
  47.     KJavaScriptAccept,
  48.     KJavaScriptReject
  49.     };
  50.  
  51.     enum KAnimationAdvice {
  52.         KAnimationDisabled=0,
  53.         KAnimationLoopOnce,
  54.         KAnimationEnabled
  55.     };
  56.  
  57.     /**
  58.      * This enum specifies the policy for window.open
  59.      */
  60.     enum KJSWindowOpenPolicy {
  61.         KJSWindowOpenAllow=0,
  62.         KJSWindowOpenAsk,
  63.         KJSWindowOpenDeny,
  64.         KJSWindowOpenSmart
  65.     };
  66.  
  67.     /**
  68.      * This enum specifies the policy for window.status and .defaultStatus
  69.      */
  70.     enum KJSWindowStatusPolicy {
  71.         KJSWindowStatusAllow=0,
  72.         KJSWindowStatusIgnore
  73.     };
  74.  
  75.     /**
  76.      * This enum specifies the policy for window.moveBy and .moveTo
  77.      */
  78.     enum KJSWindowMovePolicy {
  79.         KJSWindowMoveAllow=0,
  80.         KJSWindowMoveIgnore
  81.     };
  82.  
  83.     /**
  84.      * This enum specifies the policy for window.resizeBy and .resizeTo
  85.      */
  86.     enum KJSWindowResizePolicy {
  87.         KJSWindowResizeAllow=0,
  88.         KJSWindowResizeIgnore
  89.     };
  90.  
  91.     /**
  92.      * This enum specifies the policy for window.focus
  93.      */
  94.     enum KJSWindowFocusPolicy {
  95.         KJSWindowFocusAllow=0,
  96.         KJSWindowFocusIgnore
  97.     };
  98.  
  99.     /**
  100.      * @internal Constructor
  101.      */
  102.     KHTMLSettings();
  103.     KHTMLSettings(const KHTMLSettings &other);
  104.  
  105.     /**
  106.      * Called by constructor and reparseConfiguration
  107.      */
  108.     void init();
  109.  
  110.     /** Read settings from @p config.
  111.      * @param config is a pointer to KConfig object.
  112.      * @param reset if true, settings are always set; if false,
  113.      *  settings are only set if the config file has a corresponding key.
  114.      */
  115.     void init( KConfig * config, bool reset = true );
  116.  
  117.     /**
  118.      * Destructor. Don't delete any instance by yourself.
  119.      */
  120.     virtual ~KHTMLSettings();
  121.  
  122.     // Behavior settings
  123.     bool changeCursor() const;
  124.     bool underlineLink() const;
  125.     bool hoverLink() const;
  126.     bool allowTabulation() const;
  127.     bool autoSpellCheck() const;
  128.     KAnimationAdvice showAnimations() const;
  129.  
  130.     // Font settings
  131.     QString stdFontName() const;
  132.     QString fixedFontName() const;
  133.     QString serifFontName() const;
  134.     QString sansSerifFontName() const;
  135.     QString cursiveFontName() const;
  136.     QString fantasyFontName() const;
  137.  
  138.     // these two can be set. Mainly for historical reasons (the method in KHTMLPart exists...)
  139.     void setStdFontName(const QString &n);
  140.     void setFixedFontName(const QString &n);
  141.  
  142.     int minFontSize() const;
  143.     int mediumFontSize() const;
  144.  
  145.     bool jsErrorsEnabled() const;
  146.     void setJSErrorsEnabled(bool enabled);
  147.  
  148.     const QString &encoding() const;
  149.  
  150.     bool followSystemColors() const;
  151.  
  152.     // Color settings
  153.     const QColor& textColor() const;
  154.     const QColor& baseColor() const;
  155.     const QColor& linkColor() const;
  156.     const QColor& vLinkColor() const;
  157.  
  158.     // Autoload images
  159.     bool autoLoadImages() const;
  160.     bool unfinishedImageFrame() const;
  161.  
  162.     bool isOpenMiddleClickEnabled();
  163.     bool isBackRightClickEnabled();
  164.  
  165.     // Java and JavaScript
  166.     // ### BIC make these const
  167.     bool isJavaEnabled( const QString& hostname = QString::null );
  168.     bool isJavaScriptEnabled( const QString& hostname = QString::null );
  169.     bool isJavaScriptDebugEnabled( const QString& hostname = QString::null );
  170.     bool isJavaScriptErrorReportingEnabled( const QString& hostname = QString::null ) const;
  171.     bool isPluginsEnabled( const QString& hostname = QString::null );
  172.  
  173.     // AdBlocK Filtering
  174.     bool isAdFiltered( const QString &url ) const;
  175.     bool isAdFilterEnabled() const;
  176.     bool isHideAdsEnabled() const;
  177.     void addAdFilter( const QString &url );
  178.  
  179.     // Access Keys
  180.     bool accessKeysEnabled() const;
  181.  
  182.     KJSWindowOpenPolicy windowOpenPolicy( const QString& hostname = QString::null ) const;
  183.     KJSWindowMovePolicy windowMovePolicy( const QString& hostname = QString::null ) const;
  184.     KJSWindowResizePolicy windowResizePolicy( const QString& hostname = QString::null ) const;
  185.     KJSWindowStatusPolicy windowStatusPolicy( const QString& hostname = QString::null ) const;
  186.     KJSWindowFocusPolicy windowFocusPolicy( const QString& hostname = QString::null ) const;
  187.  
  188.     // helpers for parsing domain-specific configuration, used in KControl module as well
  189.     static KJavaScriptAdvice strToAdvice(const QString& _str);
  190.     static void splitDomainAdvice(const QString& configStr, QString &domain,
  191.                   KJavaScriptAdvice &javaAdvice, KJavaScriptAdvice& javaScriptAdvice);
  192.     static const char* adviceToStr(KJavaScriptAdvice _advice);
  193.  
  194.     /** reads from @p config's current group, forcing initialization
  195.       * if @p reset is true.
  196.       * @param config is a pointer to KConfig object.
  197.       * @param reset true if initialization is to be forced.
  198.       * @param global true if the global domain is to be read.
  199.       * @param pd_settings will be initialised with the computed (inherited)
  200.       *        settings.
  201.       */
  202.     void readDomainSettings(KConfig *config, bool reset,
  203.             bool global, KPerDomainSettings &pd_settings);
  204.  
  205.     QString settingsToCSS() const;
  206.     static const QString &availableFamilies();
  207.  
  208.     QString userStyleSheet() const;
  209.  
  210.     // Form completion
  211.     bool isFormCompletionEnabled() const;
  212.     int maxFormCompletionItems() const;
  213.  
  214.     // Meta refresh/redirect (http-equiv)
  215.     bool isAutoDelayedActionsEnabled () const;
  216.  
  217.     QValueList< QPair< QString, QChar > > fallbackAccessKeysAssignments() const;
  218.  
  219.     // Whether to show passive popup when windows are blocked
  220.     // @since 3.5
  221.     void setJSPopupBlockerPassivePopup(bool enabled);
  222.     bool jsPopupBlockerPassivePopup() const;
  223.  
  224. private:
  225.     friend class KHTMLFactory;
  226.     QString lookupFont(int i) const;
  227.  
  228.     KHTMLSettingsPrivate *d;
  229.     static QString *avFamilies;
  230. };
  231.  
  232. #endif
  233.