2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
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.
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.
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.
20 #ifndef QWEBSETTINGS_H
21 #define QWEBSETTINGS_H
23 #include "qwebkitglobal.h"
25 #include <QtCore/qstring.h>
26 #include <QtGui/qpixmap.h>
27 #include <QtGui/qicon.h>
28 #include <QtCore/qshareddata.h>
35 class QWebPluginDatabase;
36 class QWebSettingsPrivate;
41 class QWEBKIT_EXPORT QWebSettings {
56 PrivateBrowsingEnabled,
57 JavascriptCanOpenWindows,
58 JavascriptCanAccessClipboard,
59 DeveloperExtrasEnabled,
60 LinksIncludedInFocusChain,
62 PrintElementBackgrounds,
63 OfflineStorageDatabaseEnabled,
64 OfflineWebApplicationCacheEnabled,
66 #if defined(QT_DEPRECATED) || defined(qdoc)
67 LocalStorageDatabaseEnabled = LocalStorageEnabled,
69 LocalContentCanAccessRemoteUrls,
72 AcceleratedCompositingEnabled,
73 SpatialNavigationEnabled,
74 LocalContentCanAccessFileUrls,
75 TiledBackingStoreEnabled,
76 FrameFlatteningEnabled,
77 SiteSpecificQuirksEnabled,
78 JavascriptCanCloseWindows,
80 HyperlinkAuditingEnabled
85 DefaultFrameIconGraphic,
86 TextAreaSizeGripCornerGraphic,
88 InputSpeechButtonGraphic,
89 SearchCancelButtonGraphic,
90 SearchCancelButtonPressedGraphic
94 MinimumLogicalFontSize,
98 #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
99 enum ThirdPartyCookiePolicy {
100 AlwaysAllowThirdPartyCookies,
101 AlwaysBlockThirdPartyCookies,
102 AllowThirdPartyWithExistingCookies
106 static QWebSettings *globalSettings();
108 void setFontFamily(FontFamily which, const QString &family);
109 QString fontFamily(FontFamily which) const;
110 void resetFontFamily(FontFamily which);
112 void setFontSize(FontSize type, int size);
113 int fontSize(FontSize type) const;
114 void resetFontSize(FontSize type);
116 void setAttribute(WebAttribute attr, bool on);
117 bool testAttribute(WebAttribute attr) const;
118 void resetAttribute(WebAttribute attr);
120 void setUserStyleSheetUrl(const QUrl &location);
121 QUrl userStyleSheetUrl() const;
123 void setDefaultTextEncoding(const QString &encoding);
124 QString defaultTextEncoding() const;
126 static void setIconDatabasePath(const QString &location);
127 static QString iconDatabasePath();
128 static void clearIconDatabase();
129 static QIcon iconForUrl(const QUrl &url);
131 //static QWebPluginDatabase *pluginDatabase();
133 static void setWebGraphic(WebGraphic type, const QPixmap &graphic);
134 static QPixmap webGraphic(WebGraphic type);
136 static void setMaximumPagesInCache(int pages);
137 static int maximumPagesInCache();
138 static void setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheMaxDead, int totalCapacity);
140 static void setOfflineStoragePath(const QString& path);
141 static QString offlineStoragePath();
142 static void setOfflineStorageDefaultQuota(qint64 maximumSize);
143 static qint64 offlineStorageDefaultQuota();
145 static void setOfflineWebApplicationCachePath(const QString& path);
146 static QString offlineWebApplicationCachePath();
147 static void setOfflineWebApplicationCacheQuota(qint64 maximumSize);
148 static qint64 offlineWebApplicationCacheQuota();
150 void setLocalStoragePath(const QString& path);
151 QString localStoragePath() const;
153 static void clearMemoryCaches();
155 static void enablePersistentStorage(const QString& path = QString());
157 #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
158 void setThirdPartyCookiePolicy(ThirdPartyCookiePolicy);
159 QWebSettings::ThirdPartyCookiePolicy thirdPartyCookiePolicy() const;
162 inline QWebSettingsPrivate* handle() const { return d; }
165 friend class QWebPagePrivate;
166 friend class QWebSettingsPrivate;
168 Q_DISABLE_COPY(QWebSettings)
171 QWebSettings(WebCore::Settings *settings);
174 QWebSettingsPrivate *d;