qwebsettings.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
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 QWEBSETTINGS_H
00021 #define QWEBSETTINGS_H
00022 
00023 #include "qwebkitglobal.h"
00024 
00025 #include <QtCore/qstring.h>
00026 #include <QtGui/qpixmap.h>
00027 #include <QtGui/qicon.h>
00028 #include <QtCore/qshareddata.h>
00029 
00030 namespace WebCore {
00031     class Settings;
00032 }
00033 
00034 class QWebPage;
00035 class QWebPluginDatabase;
00036 class QWebSettingsPrivate;
00037 QT_BEGIN_NAMESPACE
00038 class QUrl;
00039 QT_END_NAMESPACE
00040 
00041 class QWEBKIT_EXPORT QWebSettings {
00042 public:
00043     enum FontFamily {
00044         StandardFont,
00045         FixedFont,
00046         SerifFont,
00047         SansSerifFont,
00048         CursiveFont,
00049         FantasyFont
00050     };
00051     enum WebAttribute {
00052         AutoLoadImages,
00053         JavascriptEnabled,
00054         JavaEnabled,
00055         PluginsEnabled,
00056         PrivateBrowsingEnabled,
00057         JavascriptCanOpenWindows,
00058         JavascriptCanAccessClipboard,
00059         DeveloperExtrasEnabled,
00060         LinksIncludedInFocusChain,
00061         ZoomTextOnly,
00062         PrintElementBackgrounds,
00063         OfflineStorageDatabaseEnabled,
00064         OfflineWebApplicationCacheEnabled,
00065         LocalStorageEnabled,
00066 #if defined(QT_DEPRECATED) || defined(qdoc)
00067         LocalStorageDatabaseEnabled = LocalStorageEnabled,
00068 #endif
00069         LocalContentCanAccessRemoteUrls,
00070         DnsPrefetchEnabled,
00071         XSSAuditingEnabled,
00072         AcceleratedCompositingEnabled,
00073         SpatialNavigationEnabled,
00074         LocalContentCanAccessFileUrls,
00075         TiledBackingStoreEnabled,
00076         FrameFlatteningEnabled,
00077         SiteSpecificQuirksEnabled
00078     };
00079     enum WebGraphic {
00080         MissingImageGraphic,
00081         MissingPluginGraphic,
00082         DefaultFrameIconGraphic,
00083         TextAreaSizeGripCornerGraphic,
00084         DeleteButtonGraphic
00085     };
00086     enum FontSize {
00087         MinimumFontSize,
00088         MinimumLogicalFontSize,
00089         DefaultFontSize,
00090         DefaultFixedFontSize
00091     };
00092 
00093     static QWebSettings *globalSettings();
00094 
00095     void setFontFamily(FontFamily which, const QString &family);
00096     QString fontFamily(FontFamily which) const;
00097     void resetFontFamily(FontFamily which);
00098 
00099     void setFontSize(FontSize type, int size);
00100     int fontSize(FontSize type) const;
00101     void resetFontSize(FontSize type);
00102 
00103     void setAttribute(WebAttribute attr, bool on);
00104     bool testAttribute(WebAttribute attr) const;
00105     void resetAttribute(WebAttribute attr);
00106 
00107     void setUserStyleSheetUrl(const QUrl &location);
00108     QUrl userStyleSheetUrl() const;
00109 
00110     void setDefaultTextEncoding(const QString &encoding);
00111     QString defaultTextEncoding() const;
00112 
00113     static void setIconDatabasePath(const QString &location);
00114     static QString iconDatabasePath();
00115     static void clearIconDatabase();
00116     static QIcon iconForUrl(const QUrl &url);
00117 
00118     //static QWebPluginDatabase *pluginDatabase();
00119 
00120     static void setWebGraphic(WebGraphic type, const QPixmap &graphic);
00121     static QPixmap webGraphic(WebGraphic type);
00122 
00123     static void setMaximumPagesInCache(int pages);
00124     static int maximumPagesInCache();
00125     static void setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheMaxDead, int totalCapacity);
00126 
00127     static void setOfflineStoragePath(const QString& path);
00128     static QString offlineStoragePath();
00129     static void setOfflineStorageDefaultQuota(qint64 maximumSize);
00130     static qint64 offlineStorageDefaultQuota();
00131 
00132     static void setOfflineWebApplicationCachePath(const QString& path);
00133     static QString offlineWebApplicationCachePath();
00134     static void setOfflineWebApplicationCacheQuota(qint64 maximumSize);
00135     static qint64 offlineWebApplicationCacheQuota();
00136     
00137     void setLocalStoragePath(const QString& path);
00138     QString localStoragePath() const; 
00139 
00140     static void clearMemoryCaches();
00141 
00142     static void enablePersistentStorage(const QString& path = QString());
00143 
00144     inline QWebSettingsPrivate* handle() const { return d; }
00145 
00146 private:
00147     friend class QWebPagePrivate;
00148     friend class QWebSettingsPrivate;
00149 
00150     Q_DISABLE_COPY(QWebSettings)
00151 
00152     QWebSettings();
00153     QWebSettings(WebCore::Settings *settings);
00154     ~QWebSettings();
00155 
00156     QWebSettingsPrivate *d;
00157 };
00158 
00159 #endif