1/* 2 * This file is part of the KDE Help Center 3 * 4 * Copyright (C) 2002 Frerich Raabe <raabe@kde.org> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20#ifndef HISTORY_H 21#define HISTORY_H 22 23#include <kurl.h> 24 25#include <qobject.h> 26#include <qptrlist.h> 27 28class KActionCollection; 29class KMainWindow; 30class KToolBarPopupAction; 31class QPopupMenu; 32 33namespace KHC { 34 35class View; 36 37class History : public QObject 38{ 39 Q_OBJECT 40 public: 41 friend class foo; // to make gcc shut up 42 struct Entry 43 { 44 View *view; 45 KURL url; 46 QString title; 47 QByteArray buffer; 48 bool search; 49 }; 50 51 static History &self(); 52 53 void setupActions( KActionCollection *coll ); 54 void updateActions(); 55 56 void installMenuBarHook( KMainWindow *mainWindow ); 57 58 void createEntry(); 59 void updateCurrentEntry( KHC::View *view ); 60 61 private slots: 62 void backActivated( int id ); 63 void fillBackMenu(); 64 void forwardActivated( int id ); 65 void fillForwardMenu(); 66 void goMenuActivated( int id ); 67 void fillGoMenu(); 68 void back(); 69 void forward(); 70 void goHistoryActivated( int steps ); 71 void goHistory( int steps ); 72 void goHistoryDelayed(); 73 74 private: 75 History(); 76 History( const History &rhs ); 77 History &operator=( const History &rhs ); 78 ~History(); 79 80 bool canGoBack() const; 81 bool canGoForward() const; 82 void fillHistoryPopup( QPopupMenu *, bool, bool, bool, uint = 0 ); 83 84 static History *m_instance; 85 86 QPtrList<Entry> m_entries; 87 88 KToolBarPopupAction *m_backAction; 89 KToolBarPopupAction *m_forwardAction; 90 91 int m_goBuffer; 92 int m_goMenuIndex; 93 int m_goMenuHistoryStartPos; 94 int m_goMenuHistoryCurrentPos; 95}; 96 97} 98 99#endif // HISTORY_H 100// vim:ts=2:sw=2:et 101