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 QWEBHISTORY_H |
21 | #define QWEBHISTORY_H |
22 | |
23 | #include <QtCore/qurl.h> |
24 | #include <QtCore/qstring.h> |
25 | #include <QtCore/qdatetime.h> |
26 | #include <QtCore/qshareddata.h> |
27 | #include <QtGui/qicon.h> |
28 | |
29 | #include "qwebkitglobal.h" |
30 | |
31 | class QWebPage; |
32 | |
33 | namespace WebCore { |
34 | class FrameLoaderClientQt; |
35 | } |
36 | |
37 | class QWebHistoryItemPrivate; |
38 | |
39 | class QWEBKIT_EXPORT QWebHistoryItem { |
40 | public: |
41 | QWebHistoryItem(const QWebHistoryItem &other); |
42 | QWebHistoryItem &operator=(const QWebHistoryItem &other); |
43 | ~QWebHistoryItem(); |
44 | |
45 | QUrl originalUrl() const; |
46 | QUrl url() const; |
47 | |
48 | QString title() const; |
49 | QDateTime lastVisited() const; |
50 | |
51 | QIcon icon() const; |
52 | |
53 | QVariant userData() const; |
54 | void setUserData(const QVariant& userData); |
55 | |
56 | bool isValid() const; |
57 | |
58 | QVariantMap toMap() const; |
59 | void loadFromMap(const QVariantMap &map); |
60 | |
61 | private: |
62 | QWebHistoryItem(QWebHistoryItemPrivate *priv); |
63 | friend class QWebHistory; |
64 | friend class QWebPage; |
65 | friend class WebCore::FrameLoaderClientQt; |
66 | friend class QWebHistoryItemPrivate; |
67 | friend class DumpRenderTreeSupportQt; |
68 | //friend QDataStream & operator<<(QDataStream& out,const QWebHistoryItem& hist); |
69 | //friend QDataStream & operator>>(QDataStream& in,QWebHistoryItem& hist); |
70 | QExplicitlySharedDataPointer<QWebHistoryItemPrivate> d; |
71 | }; |
72 | |
73 | |
74 | class QWebHistoryPrivate; |
75 | class QWEBKIT_EXPORT QWebHistory { |
76 | public: |
77 | void clear(); |
78 | |
79 | QList<QWebHistoryItem> items() const; |
80 | QList<QWebHistoryItem> backItems(int maxItems) const; |
81 | QList<QWebHistoryItem> forwardItems(int maxItems) const; |
82 | |
83 | bool canGoBack() const; |
84 | bool canGoForward() const; |
85 | |
86 | void back(); |
87 | void forward(); |
88 | void goToItem(const QWebHistoryItem &item); |
89 | |
90 | QWebHistoryItem backItem() const; |
91 | QWebHistoryItem currentItem() const; |
92 | QWebHistoryItem forwardItem() const; |
93 | QWebHistoryItem itemAt(int i) const; |
94 | |
95 | int currentItemIndex() const; |
96 | |
97 | int count() const; |
98 | |
99 | int maximumItemCount() const; |
100 | void setMaximumItemCount(int count); |
101 | |
102 | QVariantMap toMap() const; |
103 | void loadFromMap(const QVariantMap &map); |
104 | |
105 | private: |
106 | QWebHistory(); |
107 | ~QWebHistory(); |
108 | |
109 | friend class QWebPage; |
110 | friend class QWebPageAdapter; |
111 | friend QWEBKIT_EXPORT QDataStream& operator>>(QDataStream&, QWebHistory&); |
112 | friend QWEBKIT_EXPORT QDataStream& operator<<(QDataStream&, const QWebHistory&); |
113 | |
114 | Q_DISABLE_COPY(QWebHistory) |
115 | |
116 | QWebHistoryPrivate *d; |
117 | }; |
118 | |
119 | QWEBKIT_EXPORT QDataStream& operator<<(QDataStream& stream, const QWebHistory& history); |
120 | QWEBKIT_EXPORT QDataStream& operator>>(QDataStream& stream, QWebHistory& history); |
121 | |
122 | #endif |
123 | |