• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libkonq
 

libkonq

  • libkonq
konq_historymgr.h
1 /* This file is part of the KDE project
2  Copyright (C) 2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU 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 program 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  General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; see the file COPYING. 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 KONQ_HISTORY_H
21 #define KONQ_HISTORY_H
22 
23 #include <tqdatastream.h>
24 #include <tqfile.h>
25 #include <tqptrlist.h>
26 #include <tqobject.h>
27 #include <tqmap.h>
28 #include <tqtimer.h>
29 
30 #include <dcopobject.h>
31 
32 #include <kcompletion.h>
33 #include <kurl.h>
34 #include <tdeparts/historyprovider.h>
35 
36 #include "konq_historycomm.h"
37 
38 #include <libkonq_export.h>
39 
40 class TDECompletion;
41 
42 
43 typedef TQPtrList<KonqHistoryEntry> KonqBaseHistoryList;
44 typedef TQPtrListIterator<KonqHistoryEntry> KonqHistoryIterator;
45 
46 class LIBKONQ_EXPORT KonqHistoryList : public KonqBaseHistoryList
47 {
48 public:
54  KonqHistoryEntry * findEntry( const KURL& url );
55 
56 protected:
60  virtual int compareItems( TQPtrCollection::Item, TQPtrCollection::Item );
61 };
62 
63 
65 
66 
74 class LIBKONQ_EXPORT KonqHistoryManager : public KParts::HistoryProvider,
75  public KonqHistoryComm
76 {
77  Q_OBJECT
78 
79 public:
80  static KonqHistoryManager *kself() {
81  return static_cast<KonqHistoryManager*>( KParts::HistoryProvider::self() );
82  }
83 
84  KonqHistoryManager( TQObject *parent, const char *name );
85  ~KonqHistoryManager();
86 
94  void emitSetMaxCount( TQ_UINT32 count );
95 
105  void emitSetMaxAge( TQ_UINT32 days );
106 
113  void emitRemoveFromHistory( const KURL& url );
114 
121  void emitRemoveFromHistory( const KURL::List& urls );
122 
126  TQ_UINT32 maxCount() const { return m_maxCount; }
127 
131  TQ_UINT32 maxAge() const { return m_maxAgeDays; }
132 
150  void addPending( const KURL& url, const TQString& typedURL = TQString::null,
151  const TQString& title = TQString::null );
152 
156  void confirmPending( const KURL& url,
157  const TQString& typedURL = TQString::null,
158  const TQString& title = TQString::null );
159 
164  void removePending( const KURL& url );
165 
169  TDECompletion * completionObject() const { return m_pCompletion; }
170 
175  const KonqHistoryList& entries() const { return m_history; }
176 
177  // HistoryProvider interfae, let konq handle this
184  virtual void insert( const TQString& );
185  virtual void remove( const TQString& ) {}
186  virtual void clear() {}
187 
188 
189 public slots:
193  bool loadHistory();
194 
198  bool saveHistory();
199 
205  void emitClear();
206 
207 
208 signals:
212  void loadingFinished();
213 
217  void entryAdded( const KonqHistoryEntry *entry );
218 
224  void entryRemoved( const KonqHistoryEntry *entry );
225 
226 protected:
231  void adjustSize();
232 
237  inline bool isExpired( KonqHistoryEntry *entry ) {
238  return (entry && m_maxAgeDays > 0 && entry->lastVisited <
239  TQDateTime(TQDate::currentDate().addDays( -m_maxAgeDays )));
240  }
241 
245  void emitAddToHistory( const KonqHistoryEntry& entry );
246 
256  virtual void notifyHistoryEntry( KonqHistoryEntry e, TQCString saveId );
257 
262  virtual void notifyMaxCount( TQ_UINT32 count, TQCString saveId );
263 
268  virtual void notifyMaxAge( TQ_UINT32 days, TQCString saveId );
269 
273  virtual void notifyClear( TQCString saveId );
274 
279  virtual void notifyRemove( KURL url, TQCString saveId );
280 
285  virtual void notifyRemove( KURL::List urls, TQCString saveId );
286 
290  virtual TQStringList allURLs() const;
291 
303  void addToHistory( bool pending, const KURL& url,
304  const TQString& typedURL = TQString::null,
305  const TQString& title = TQString::null );
306 
307 
313  virtual bool filterOut( const KURL& url );
314 
315  void addToUpdateList( const TQString& url ) {
316  m_updateURLs.append( url );
317  m_updateTimer->start( 500, true );
318  }
319 
325  TQStringList m_updateURLs;
326 
327 private slots:
332  void slotEmitUpdated();
333 
334 private:
338  bool isSenderOfBroadcast();
339 
340  void clearPending();
347  KonqHistoryEntry * findEntry( const KURL& url );
348 
353  bool loadFallback();
354  KonqHistoryEntry * createFallbackEntry( const TQString& ) const;
355 
356  void addToCompletion( const TQString& url, const TQString& typedURL, int numberOfTimesVisited = 1 );
357  void removeFromCompletion( const TQString& url, const TQString& typedURL );
358 
359  TQString m_filename;
360  KonqHistoryList m_history;
361 
368  TQMap<TQString,KonqHistoryEntry*> m_pending;
369 
370  TQ_UINT32 m_maxCount; // maximum of history entries
371  TQ_UINT32 m_maxAgeDays; // maximum age of a history entry
372 
373  TDECompletion *m_pCompletion; // the completion object we sync with
374 
379  TQTimer *m_updateTimer;
380 
381  static const TQ_UINT32 s_historyVersion;
382 };
383 
384 
385 #endif // KONQ_HISTORY_H

libkonq

Skip menu "libkonq"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libkonq

Skip menu "libkonq"
  • kate
  • libkonq
  • twin
  •   lib
Generated for libkonq by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.