|
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 <QtGui/qicon.h> |
|
26 #include <QtCore/qdatetime.h> |
|
27 #include <QtCore/qshareddata.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 private: |
|
59 QWebHistoryItem(QWebHistoryItemPrivate *priv); |
|
60 friend class QWebHistory; |
|
61 friend class QWebPage; |
|
62 friend class WebCore::FrameLoaderClientQt; |
|
63 friend class QWebHistoryItemPrivate; |
|
64 friend class DumpRenderTreeSupportQt; |
|
65 //friend QDataStream & operator<<(QDataStream& out,const QWebHistoryItem& hist); |
|
66 //friend QDataStream & operator>>(QDataStream& in,QWebHistoryItem& hist); |
|
67 QExplicitlySharedDataPointer<QWebHistoryItemPrivate> d; |
|
68 }; |
|
69 |
|
70 |
|
71 class QWebHistoryPrivate; |
|
72 class QWEBKIT_EXPORT QWebHistory { |
|
73 public: |
|
74 void clear(); |
|
75 |
|
76 QList<QWebHistoryItem> items() const; |
|
77 QList<QWebHistoryItem> backItems(int maxItems) const; |
|
78 QList<QWebHistoryItem> forwardItems(int maxItems) const; |
|
79 |
|
80 bool canGoBack() const; |
|
81 bool canGoForward() const; |
|
82 |
|
83 void back(); |
|
84 void forward(); |
|
85 void goToItem(const QWebHistoryItem &item); |
|
86 |
|
87 QWebHistoryItem backItem() const; |
|
88 QWebHistoryItem currentItem() const; |
|
89 QWebHistoryItem forwardItem() const; |
|
90 QWebHistoryItem itemAt(int i) const; |
|
91 |
|
92 int currentItemIndex() const; |
|
93 |
|
94 int count() const; |
|
95 |
|
96 int maximumItemCount() const; |
|
97 void setMaximumItemCount(int count); |
|
98 |
|
99 private: |
|
100 QWebHistory(); |
|
101 ~QWebHistory(); |
|
102 |
|
103 friend class QWebPage; |
|
104 friend class QWebPagePrivate; |
|
105 friend QWEBKIT_EXPORT QDataStream& operator>>(QDataStream&, QWebHistory&); |
|
106 friend QWEBKIT_EXPORT QDataStream& operator<<(QDataStream&, const QWebHistory&); |
|
107 |
|
108 Q_DISABLE_COPY(QWebHistory) |
|
109 |
|
110 QWebHistoryPrivate *d; |
|
111 }; |
|
112 |
|
113 QWEBKIT_EXPORT QDataStream& operator<<(QDataStream& stream, const QWebHistory& history); |
|
114 QWEBKIT_EXPORT QDataStream& operator>>(QDataStream& stream, QWebHistory& history); |
|
115 |
|
116 #endif |