qwebhistory.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. Boston, MA 02110-1301, USA.
  15. */
  16. #ifndef QWEBHISTORY_H
  17. #define QWEBHISTORY_H
  18. #include <QtCore/qurl.h>
  19. #include <QtCore/qstring.h>
  20. #include <QtCore/qdatetime.h>
  21. #include <QtCore/qshareddata.h>
  22. #include <QtGui/qicon.h>
  23. #include "qwebkitglobal.h"
  24. class QWebPage;
  25. namespace WebCore {
  26. class FrameLoaderClientQt;
  27. }
  28. class QWebHistoryItemPrivate;
  29. class QWEBKIT_EXPORT QWebHistoryItem {
  30. public:
  31. QWebHistoryItem(const QWebHistoryItem &other);
  32. QWebHistoryItem &operator=(const QWebHistoryItem &other);
  33. ~QWebHistoryItem();
  34. QUrl originalUrl() const;
  35. QUrl url() const;
  36. QString title() const;
  37. QDateTime lastVisited() const;
  38. QIcon icon() const;
  39. QVariant userData() const;
  40. void setUserData(const QVariant& userData);
  41. bool isValid() const;
  42. private:
  43. QWebHistoryItem(QWebHistoryItemPrivate *priv);
  44. friend class QWebHistory;
  45. friend class QWebPage;
  46. friend class WebCore::FrameLoaderClientQt;
  47. friend class QWebHistoryItemPrivate;
  48. friend class DumpRenderTreeSupportQt;
  49. //friend QDataStream & operator<<(QDataStream& out,const QWebHistoryItem& hist);
  50. //friend QDataStream & operator>>(QDataStream& in,QWebHistoryItem& hist);
  51. QExplicitlySharedDataPointer<QWebHistoryItemPrivate> d;
  52. };
  53. class QWebHistoryPrivate;
  54. class QWEBKIT_EXPORT QWebHistory {
  55. public:
  56. void clear();
  57. QList<QWebHistoryItem> items() const;
  58. QList<QWebHistoryItem> backItems(int maxItems) const;
  59. QList<QWebHistoryItem> forwardItems(int maxItems) const;
  60. bool canGoBack() const;
  61. bool canGoForward() const;
  62. void back();
  63. void forward();
  64. void goToItem(const QWebHistoryItem &item);
  65. QWebHistoryItem backItem() const;
  66. QWebHistoryItem currentItem() const;
  67. QWebHistoryItem forwardItem() const;
  68. QWebHistoryItem itemAt(int i) const;
  69. int currentItemIndex() const;
  70. int count() const;
  71. int maximumItemCount() const;
  72. void setMaximumItemCount(int count);
  73. private:
  74. QWebHistory();
  75. ~QWebHistory();
  76. friend class QWebPage;
  77. friend class QWebPageAdapter;
  78. friend QWEBKIT_EXPORT QDataStream& operator>>(QDataStream&, QWebHistory&);
  79. friend QWEBKIT_EXPORT QDataStream& operator<<(QDataStream&, const QWebHistory&);
  80. Q_DISABLE_COPY(QWebHistory)
  81. QWebHistoryPrivate *d;
  82. };
  83. QWEBKIT_EXPORT QDataStream& operator<<(QDataStream& stream, const QWebHistory& history);
  84. QWEBKIT_EXPORT QDataStream& operator>>(QDataStream& stream, QWebHistory& history);
  85. #endif