1 | /* |
2 | Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
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 QWEBSETTINGS_H |
21 | #define QWEBSETTINGS_H |
22 | |
23 | #include "qwebkitglobal.h" |
24 | |
25 | #include <QtCore/qstring.h> |
26 | #include <QtGui/qpixmap.h> |
27 | #include <QtGui/qicon.h> |
28 | #include <QtCore/qshareddata.h> |
29 | |
30 | namespace WebCore { |
31 | class Settings; |
32 | } |
33 | |
34 | class QWebPage; |
35 | class QWebPluginDatabase; |
36 | class QWebSettingsPrivate; |
37 | QT_BEGIN_NAMESPACE |
38 | class QUrl; |
39 | QT_END_NAMESPACE |
40 | |
41 | class QWEBKIT_EXPORT QWebSettings { |
42 | public: |
43 | enum FontFamily { |
44 | StandardFont, |
45 | FixedFont, |
46 | SerifFont, |
47 | SansSerifFont, |
48 | CursiveFont, |
49 | FantasyFont |
50 | }; |
51 | enum WebAttribute { |
52 | AutoLoadImages, |
53 | JavascriptEnabled, |
54 | JavaEnabled, |
55 | PluginsEnabled, |
56 | PrivateBrowsingEnabled, |
57 | JavascriptCanOpenWindows, |
58 | JavascriptCanAccessClipboard, |
59 | , |
60 | LinksIncludedInFocusChain, |
61 | ZoomTextOnly, |
62 | PrintElementBackgrounds, |
63 | OfflineStorageDatabaseEnabled, |
64 | OfflineWebApplicationCacheEnabled, |
65 | LocalStorageEnabled, |
66 | #if defined(QT_DEPRECATED) || defined(qdoc) |
67 | LocalStorageDatabaseEnabled = LocalStorageEnabled, |
68 | #endif |
69 | LocalContentCanAccessRemoteUrls, |
70 | DnsPrefetchEnabled, |
71 | XSSAuditingEnabled, |
72 | AcceleratedCompositingEnabled, |
73 | SpatialNavigationEnabled, |
74 | LocalContentCanAccessFileUrls, |
75 | TiledBackingStoreEnabled, |
76 | FrameFlatteningEnabled, |
77 | SiteSpecificQuirksEnabled, |
78 | JavascriptCanCloseWindows, |
79 | WebGLEnabled, |
80 | CSSRegionsEnabled, |
81 | HyperlinkAuditingEnabled, |
82 | CSSGridLayoutEnabled, |
83 | ScrollAnimatorEnabled, |
84 | CaretBrowsingEnabled, |
85 | NotificationsEnabled |
86 | }; |
87 | enum WebGraphic { |
88 | MissingImageGraphic, |
89 | MissingPluginGraphic, |
90 | DefaultFrameIconGraphic, |
91 | TextAreaSizeGripCornerGraphic, |
92 | DeleteButtonGraphic, |
93 | InputSpeechButtonGraphic, |
94 | SearchCancelButtonGraphic, |
95 | SearchCancelButtonPressedGraphic |
96 | }; |
97 | enum FontSize { |
98 | MinimumFontSize, |
99 | MinimumLogicalFontSize, |
100 | DefaultFontSize, |
101 | DefaultFixedFontSize |
102 | }; |
103 | enum ThirdPartyCookiePolicy { |
104 | AlwaysAllowThirdPartyCookies, |
105 | AlwaysBlockThirdPartyCookies, |
106 | AllowThirdPartyWithExistingCookies |
107 | }; |
108 | |
109 | static QWebSettings *globalSettings(); |
110 | |
111 | void setFontFamily(FontFamily which, const QString &family); |
112 | QString fontFamily(FontFamily which) const; |
113 | void resetFontFamily(FontFamily which); |
114 | |
115 | void setFontSize(FontSize type, int size); |
116 | int fontSize(FontSize type) const; |
117 | void resetFontSize(FontSize type); |
118 | |
119 | void setAttribute(WebAttribute attr, bool on); |
120 | bool testAttribute(WebAttribute attr) const; |
121 | void resetAttribute(WebAttribute attr); |
122 | |
123 | void setUserStyleSheetUrl(const QUrl &location); |
124 | QUrl userStyleSheetUrl() const; |
125 | |
126 | void setDefaultTextEncoding(const QString &encoding); |
127 | QString defaultTextEncoding() const; |
128 | |
129 | static void setIconDatabasePath(const QString &location); |
130 | static QString iconDatabasePath(); |
131 | static void clearIconDatabase(); |
132 | static QIcon iconForUrl(const QUrl &url); |
133 | |
134 | //static QWebPluginDatabase *pluginDatabase(); |
135 | |
136 | static void setWebGraphic(WebGraphic type, const QPixmap &graphic); |
137 | static QPixmap webGraphic(WebGraphic type); |
138 | |
139 | static void setMaximumPagesInCache(int pages); |
140 | static int maximumPagesInCache(); |
141 | static void setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheMaxDead, int totalCapacity); |
142 | |
143 | static void setOfflineStoragePath(const QString& path); |
144 | static QString offlineStoragePath(); |
145 | static void setOfflineStorageDefaultQuota(qint64 maximumSize); |
146 | static qint64 offlineStorageDefaultQuota(); |
147 | |
148 | static void setOfflineWebApplicationCachePath(const QString& path); |
149 | static QString offlineWebApplicationCachePath(); |
150 | static void setOfflineWebApplicationCacheQuota(qint64 maximumSize); |
151 | static qint64 offlineWebApplicationCacheQuota(); |
152 | |
153 | void setLocalStoragePath(const QString& path); |
154 | QString localStoragePath() const; |
155 | |
156 | static void clearMemoryCaches(); |
157 | |
158 | static void enablePersistentStorage(const QString& path = QString()); |
159 | |
160 | void setThirdPartyCookiePolicy(ThirdPartyCookiePolicy); |
161 | QWebSettings::ThirdPartyCookiePolicy thirdPartyCookiePolicy() const; |
162 | |
163 | inline QWebSettingsPrivate* handle() const { return d; } |
164 | |
165 | private: |
166 | friend class QWebPagePrivate; |
167 | friend class QWebSettingsPrivate; |
168 | |
169 | Q_DISABLE_COPY(QWebSettings) |
170 | |
171 | QWebSettings(); |
172 | QWebSettings(WebCore::Settings *settings); |
173 | ~QWebSettings(); |
174 | |
175 | QWebSettingsPrivate *d; |
176 | }; |
177 | |
178 | #endif |
179 | |