qwebhistory.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef QWEBHISTORY_H
00021 #define QWEBHISTORY_H
00022 
00023 #include <QtCore/qurl.h>
00024 #include <QtCore/qstring.h>
00025 #include <QtGui/qicon.h>
00026 #include <QtCore/qdatetime.h>
00027 #include <QtCore/qshareddata.h>
00028 
00029 #include "qwebkitglobal.h"
00030 
00031 class QWebPage;
00032 
00033 namespace WebCore {
00034     class FrameLoaderClientQt;
00035 }
00036 
00037 class QWebHistoryItemPrivate;
00038 
00039 class QWEBKIT_EXPORT QWebHistoryItem {
00040 public:
00041     QWebHistoryItem(const QWebHistoryItem &other);
00042     QWebHistoryItem &operator=(const QWebHistoryItem &other);
00043     ~QWebHistoryItem();
00044 
00045     QUrl originalUrl() const;
00046     QUrl url() const;
00047 
00048     QString title() const;
00049     QDateTime lastVisited() const;
00050 
00051     QIcon icon() const;
00052 
00053     QVariant userData() const;
00054     void setUserData(const QVariant& userData);
00055 
00056     bool isValid() const;
00057 
00058 private:
00059     QWebHistoryItem(QWebHistoryItemPrivate *priv);
00060     friend class QWebHistory;
00061     friend class QWebPage;
00062     friend class WebCore::FrameLoaderClientQt;
00063     friend class QWebHistoryItemPrivate;
00064     //friend QDataStream & operator<<(QDataStream& out,const QWebHistoryItem& hist);
00065     //friend QDataStream & operator>>(QDataStream& in,QWebHistoryItem& hist);
00066     QExplicitlySharedDataPointer<QWebHistoryItemPrivate> d;
00067 };
00068 
00069 
00070 class QWebHistoryPrivate;
00071 class QWEBKIT_EXPORT QWebHistory {
00072 public:
00073     void clear();
00074 
00075     QList<QWebHistoryItem> items() const;
00076     QList<QWebHistoryItem> backItems(int maxItems) const;
00077     QList<QWebHistoryItem> forwardItems(int maxItems) const;
00078 
00079     bool canGoBack() const;
00080     bool canGoForward() const;
00081 
00082     void back();
00083     void forward();
00084     void goToItem(const QWebHistoryItem &item);
00085 
00086     QWebHistoryItem backItem() const;
00087     QWebHistoryItem currentItem() const;
00088     QWebHistoryItem forwardItem() const;
00089     QWebHistoryItem itemAt(int i) const;
00090 
00091     int currentItemIndex() const;
00092 
00093     int count() const;
00094 
00095     int maximumItemCount() const;
00096     void setMaximumItemCount(int count);
00097 
00098 private:
00099     QWebHistory();
00100     ~QWebHistory();
00101 
00102     friend class QWebPage;
00103     friend class QWebPagePrivate;
00104     friend QWEBKIT_EXPORT QDataStream& operator>>(QDataStream&, QWebHistory&);
00105     friend QWEBKIT_EXPORT QDataStream& operator<<(QDataStream&, const QWebHistory&);
00106 
00107     Q_DISABLE_COPY(QWebHistory)
00108 
00109     QWebHistoryPrivate *d;
00110 };
00111 
00112 QWEBKIT_EXPORT QDataStream& operator<<(QDataStream& stream, const QWebHistory& history);
00113 QWEBKIT_EXPORT QDataStream& operator>>(QDataStream& stream, QWebHistory& history);
00114 
00115 #endif