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