libkonq Library API Documentation

KonqHistoryManager Class Reference

This class maintains and manages a history of all URLs visited by one Konqueror instance. More...

#include <konq_historymgr.h>

Inheritance diagram for KonqHistoryManager:

Inheritance graph
[legend]
Collaboration diagram for KonqHistoryManager:

Collaboration graph
[legend]
List of all members.

Public Slots

bool loadHistory ()
bool saveHistory ()
void emitClear ()

Signals

void loadingFinished ()
void entryAdded (const KonqHistoryEntry *entry)
void entryRemoved (const KonqHistoryEntry *entry)

Public Member Functions

 KonqHistoryManager (QObject *parent, const char *name)
 ~KonqHistoryManager ()
void emitSetMaxCount (Q_UINT32 count)
void emitSetMaxAge (Q_UINT32 days)
void emitRemoveFromHistory (const KURL &url)
void emitRemoveFromHistory (const KURL::List &urls)
Q_UINT32 maxCount () const
Q_UINT32 maxAge () const
void addPending (const KURL &url, const QString &typedURL=QString::null, const QString &title=QString::null)
void confirmPending (const KURL &url, const QString &typedURL=QString::null, const QString &title=QString::null)
void removePending (const KURL &url)
KCompletion * completionObject () const
const KonqHistoryListentries () const
virtual void insert (const QString &)
virtual void remove (const QString &)
virtual void clear ()

Static Public Member Functions

static KonqHistoryManagerkself ()

Protected Member Functions

void adjustSize ()
bool isExpired (KonqHistoryEntry *entry)
void emitAddToHistory (const KonqHistoryEntry &entry)
virtual void notifyHistoryEntry (KonqHistoryEntry e, QCString saveId)
virtual void notifyMaxCount (Q_UINT32 count, QCString saveId)
virtual void notifyMaxAge (Q_UINT32 days, QCString saveId)
virtual void notifyClear (QCString saveId)
virtual void notifyRemove (KURL url, QCString saveId)
virtual void notifyRemove (KURL::List urls, QCString saveId)
virtual QStringList allURLs () const
void addToHistory (bool pending, const KURL &url, const QString &typedURL=QString::null, const QString &title=QString::null)
virtual bool filterOut (const KURL &url)
void addToUpdateList (const QString &url)

Protected Attributes

QStringList m_updateURLs

Detailed Description

This class maintains and manages a history of all URLs visited by one Konqueror instance.

Additionally it synchronizes the history with other Konqueror instances via DCOP to keep one global and persistant history.

It keeps the history in sync with one KCompletion object

Definition at line 74 of file konq_historymgr.h.


Member Function Documentation

void KonqHistoryManager::emitSetMaxCount Q_UINT32  count  ) 
 

Sets a new maximum size of history and truncates the current history if necessary.

Notifies all other Konqueror instances via DCOP to do the same.

The history is saved after receiving the DCOP call.

Definition at line 419 of file konq_historymgr.cc.

void KonqHistoryManager::emitSetMaxAge Q_UINT32  days  ) 
 

Sets a new maximum age of history entries and removes all entries that are older than days.

Notifies all other Konqueror instances via DCOP to do the same.

An age of 0 means no expiry based on the age.

The history is saved after receiving the DCOP call.

Definition at line 428 of file konq_historymgr.cc.

void KonqHistoryManager::emitRemoveFromHistory const KURL &  url  ) 
 

Removes the history entry for url, if existant.

Tells all other Konqueror instances via DCOP to do the same.

The history is saved after receiving the DCOP call.

Definition at line 392 of file konq_historymgr.cc.

Referenced by removePending().

void KonqHistoryManager::emitRemoveFromHistory const KURL::List &  urls  ) 
 

Removes the history entries for the given list of urls.

Tells all other Konqueror instances via DCOP to do the same.

The history is saved after receiving the DCOP call.

Definition at line 401 of file konq_historymgr.cc.

Q_UINT32 KonqHistoryManager::maxCount  )  const [inline]
 

Returns:
the current maximum number of history entries.

Definition at line 126 of file konq_historymgr.h.

Q_UINT32 KonqHistoryManager::maxAge  )  const [inline]
 

Returns:
the current maximum age (in days) of history entries.

Definition at line 131 of file konq_historymgr.h.

void KonqHistoryManager::addPending const KURL &  url,
const QString &  typedURL = QString::null,
const QString &  title = QString::null
 

Adds a pending entry to the history.

Pending means, that the entry is not verified yet, i.e. it is not sure url does exist at all. You probably don't know the title of the url in that case either. Call confirmPending() as soon you know the entry is good and should be updated.

If an entry with url already exists, it will be updated (lastVisited date will become the current time and the number of visits will be incremented).

Parameters:
url The url of the history entry
typedURL the string that the user typed, which resulted in url Doesn't have to be a valid url, e.g. "slashdot.org".
title The title of the URL. If you don't know it (yet), you may specify it in confirmPending().

Definition at line 256 of file konq_historymgr.cc.

References addToHistory().

void KonqHistoryManager::confirmPending const KURL &  url,
const QString &  typedURL = QString::null,
const QString &  title = QString::null
 

Confirms and updates the entry for url.

Definition at line 262 of file konq_historymgr.cc.

References addToHistory().

void KonqHistoryManager::removePending const KURL &  url  ) 
 

Removes a pending url from the history, e.g.

when the url does not exist, or the user aborted loading.

Definition at line 361 of file konq_historymgr.cc.

References emitAddToHistory(), and emitRemoveFromHistory().

KCompletion* KonqHistoryManager::completionObject  )  const [inline]
 

Returns:
the KCompletion object.

Definition at line 169 of file konq_historymgr.h.

const KonqHistoryList& KonqHistoryManager::entries  )  const [inline]
 

Returns:
the list of all history entries, sorted by date (oldest entries first)

Definition at line 175 of file konq_historymgr.h.

void KonqHistoryManager::insert const QString &   )  [virtual]
 

Reimplemented in such a way that all URLs that would be filtered out normally (see filterOut()) will still be added to the history.

By default, file:/ urls will be filtered out, but if they come thru the HistoryProvider interface, they are added to the history.

Definition at line 336 of file konq_historymgr.cc.

References emitAddToHistory(), filterOut(), KonqHistoryEntry::firstVisited, KonqHistoryEntry::lastVisited, and KonqHistoryEntry::url.

bool KonqHistoryManager::loadHistory  )  [slot]
 

Loads the history and fills the completion object.

Definition at line 81 of file konq_historymgr.cc.

References adjustSize(), loadingFinished(), and KonqHistoryEntry::marshalURLAsStrings.

Referenced by KonqHistoryManager().

bool KonqHistoryManager::saveHistory  )  [slot]
 

Saves the entire history.

Definition at line 200 of file konq_historymgr.cc.

References KonqHistoryEntry::marshalURLAsStrings.

Referenced by notifyClear(), notifyHistoryEntry(), notifyMaxAge(), notifyMaxCount(), and notifyRemove().

void KonqHistoryManager::emitClear  )  [slot]
 

Clears the history and tells all other Konqueror instances via DCOP to do the same.

The history is saved afterwards, if necessary.

Definition at line 410 of file konq_historymgr.cc.

void KonqHistoryManager::loadingFinished  )  [signal]
 

Emitted after the entire history was loaded from disk.

Referenced by loadHistory().

void KonqHistoryManager::entryAdded const KonqHistoryEntry entry  )  [signal]
 

Emitted after a new entry was added.

Referenced by notifyHistoryEntry().

void KonqHistoryManager::entryRemoved const KonqHistoryEntry entry  )  [signal]
 

Emitted after an entry was removed from the history Note, that this entry will be deleted immediately after you got that signal.

Referenced by adjustSize(), and notifyRemove().

void KonqHistoryManager::adjustSize  )  [protected]
 

Resizes the history list to contain less or equal than m_maxCount entries.

The first (oldest) entries are removed.

Definition at line 236 of file konq_historymgr.cc.

References addToUpdateList(), entryRemoved(), isExpired(), KonqHistoryEntry::typedURL, and KonqHistoryEntry::url.

Referenced by loadHistory(), notifyHistoryEntry(), notifyMaxAge(), and notifyMaxCount().

bool KonqHistoryManager::isExpired KonqHistoryEntry entry  )  [inline, protected]
 

Returns:
true if entry is older than the given maximum age, otherwise false.

Definition at line 237 of file konq_historymgr.h.

References KonqHistoryEntry::lastVisited.

Referenced by adjustSize().

void KonqHistoryManager::emitAddToHistory const KonqHistoryEntry entry  )  [protected]
 

Notifes all running instances about a new HistoryEntry via DCOP.

Definition at line 350 of file konq_historymgr.cc.

Referenced by addToHistory(), insert(), and removePending().

void KonqHistoryManager::notifyHistoryEntry KonqHistoryEntry  e,
QCString  saveId
[protected, virtual]
 

Every konqueror instance broadcasts new history entries to the other konqueror instances.

Those add the entry to their list, but don't save the list, because the sender saves the list.

saveId is the DCOPObject::objId() of the sender so that only the sender saves the new history.

Implements KonqHistoryComm.

Definition at line 440 of file konq_historymgr.cc.

References addToUpdateList(), adjustSize(), entryAdded(), KonqHistoryEntry::firstVisited, KonqHistoryEntry::lastVisited, KonqHistoryEntry::numberOfTimesVisited, saveHistory(), KonqBookmarkManager::self(), KonqHistoryEntry::title, KonqHistoryEntry::typedURL, and KonqHistoryEntry::url.

void KonqHistoryManager::notifyMaxCount Q_UINT32  count,
QCString  saveId
[protected, virtual]
 

Called when the configuration of the maximum count changed.

Called via DCOP by some config-module

Implements KonqHistoryComm.

Definition at line 487 of file konq_historymgr.cc.

References adjustSize(), and saveHistory().

void KonqHistoryManager::notifyMaxAge Q_UINT32  days,
QCString  saveId
[protected, virtual]
 

Called when the configuration of the maximum age of history-entries changed.

Called via DCOP by some config-module

Implements KonqHistoryComm.

Definition at line 503 of file konq_historymgr.cc.

References adjustSize(), and saveHistory().

void KonqHistoryManager::notifyClear QCString  saveId  )  [protected, virtual]
 

Clears the history completely.

Called via DCOP by some config-module

Implements KonqHistoryComm.

Definition at line 519 of file konq_historymgr.cc.

References saveHistory().

void KonqHistoryManager::notifyRemove KURL  url,
QCString  saveId
[protected, virtual]
 

Notifes about a url that has to be removed from the history.

The instance where saveId == objId() has to save the history.

Implements KonqHistoryComm.

Definition at line 531 of file konq_historymgr.cc.

References addToUpdateList(), entryRemoved(), KonqHistoryList::findEntry(), saveHistory(), KonqHistoryEntry::typedURL, and KonqHistoryEntry::url.

void KonqHistoryManager::notifyRemove KURL::List  urls,
QCString  saveId
[protected, virtual]
 

Notifes about a list of urls that has to be removed from the history.

The instance where saveId == objId() has to save the history.

Implements KonqHistoryComm.

Definition at line 555 of file konq_historymgr.cc.

References addToUpdateList(), entryRemoved(), KonqHistoryList::findEntry(), saveHistory(), KonqHistoryEntry::typedURL, and KonqHistoryEntry::url.

QStringList KonqHistoryManager::allURLs  )  const [protected, virtual]
 

Returns:
a list of all urls in the history.

Implements KonqHistoryComm.

Definition at line 672 of file konq_historymgr.cc.

void KonqHistoryManager::addToHistory bool  pending,
const KURL &  url,
const QString &  typedURL = QString::null,
const QString &  title = QString::null
[protected]
 

Does the work for addPending() and confirmPending().

Adds an entry to the history. If an entry with url already exists, it will be updated (lastVisited date will become the current time and the number of visits will be incremented). pending means, the entry has not been "verified", it's been added right after typing the url. If pending is false, url will be removed from the pending urls (if available) and NOT be added again in that case.

Definition at line 270 of file konq_historymgr.cc.

References emitAddToHistory(), filterOut(), KonqHistoryEntry::firstVisited, KonqHistoryEntry::lastVisited, KonqHistoryEntry::numberOfTimesVisited, KonqHistoryEntry::title, KonqHistoryEntry::typedURL, and KonqHistoryEntry::url.

Referenced by addPending(), and confirmPending().

bool KonqHistoryManager::filterOut const KURL &  url  )  [protected, virtual]
 

Returns:
true if the given url should be filtered out and not be added to the history. By default, all local urls (url.isLocalFile()) will return true, as well as urls with an empty host.

Definition at line 661 of file konq_historymgr.cc.

Referenced by addToHistory(), and insert().


Member Data Documentation

QStringList KonqHistoryManager::m_updateURLs [protected]
 

The list of urls that is going to be emitted in slotEmitUpdated.

Add urls to it whenever you modify the list of history entries and start m_updateTimer.

Definition at line 324 of file konq_historymgr.h.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for libkonq Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jun 14 16:46:15 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003