# eric7.WebBrowser.History.HistoryManager

Module implementing the history manager.

### Global Attributes

HISTORY_VERSIONS
HISTORY_VERSION_42
HISTORY_VERSION_60

### Classes

HistoryEntry | Class implementing a history entry.
HistoryManager | Class implementing the history manager.

### Functions

None

## HistoryEntry

Class implementing a history entry.

### Derived from

None

### Class Attributes

None

### Class Methods

None

### Methods

HistoryEntry | Constructor
__eq__ | Special method determining equality.
__lt__ | Special method determining less relation.
isValid | Public method to determine validity.
userTitle | Public method to get the title of the history entry.

### Static Methods

None

#### HistoryEntry (Constructor)

HistoryEntry(url=None, dateTime=None, title=None, visitCount=None)

Constructor

url
  URL of the history entry (string)
dateTime
  date and time this entry was created (QDateTime)
title
  title string for the history entry (string)
visitCount
  number of visits of this URL (int)

#### HistoryEntry.__eq__

__eq__(other)

Special method determining equality.

other
  reference to the history entry to compare against (HistoryEntry)

Return:
  flag indicating equality (boolean)

#### HistoryEntry.__lt__

__lt__(other)

Special method determining less relation.

Note: History is sorted in reverse order by date and time

other
  reference to the history entry to compare against (HistoryEntry)

Return:
  flag indicating less (boolean)

#### HistoryEntry.isValid

isValid()

Public method to determine validity.

Return:
  flag indicating validity

Return Type:
  bool

#### HistoryEntry.userTitle

userTitle()

Public method to get the title of the history entry.

Return:
  title of the entry (string)

Up

## HistoryManager

Class implementing the history manager.

### Signals

entryAdded(HistoryEntry)
  emitted after a history entry has been added
entryRemoved(HistoryEntry)
  emitted after a history entry has been removed
entryUpdated(int)
  emitted after a history entry has been updated
historyCleared()
  emitted after the history has been cleared
historyReset()
  emitted after the history has been reset
historySaved()
  emitted after the history was saved

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

HistoryManager | Constructor
__checkForExpired | Private slot to check entries for expiration.
__cleanUrl | Private method to generate a clean URL usable for the history entry.
__cleanUrlStr | Private method to generate a clean URL usable for the history entry.
__findFirstHistoryEntry | Private method to find the first entry for the given URL.
__load | Private method to load the saved history entries from disk.
__refreshFrequencies | Private slot to recalculate the refresh frequencies.
__startFrequencyTimer | Private method to start the timer to recalculate the frequencies.
__updateVisitCount | Private method to update the visit count for all entries of the given URL.
addHistoryEntry | Public method to add a history entry.
clear | Public slot to clear the complete history.
close | Public method to close the history manager.
daysToExpire | Public method to get the days for entry expiration.
getFileName | Public method to get the file name of the history file.
history | Public method to return the history.
historyFilterModel | Public method to get a reference to the history filter model.
historyModel | Public method to get a reference to the history model.
historyTreeModel | Public method to get a reference to the history tree model.
preferencesChanged | Public method to indicate a change of preferences.
reload | Public method to reload the history.
removeHistoryEntry | Public method to remove a history entry.
save | Public slot to save the history entries to disk.
setDaysToExpire | Public method to set the days for entry expiration.
setHistory | Public method to set a new history.
siteVisitsCount | Public method to get the visit count for a web site using the given scheme.
updateHistoryEntry | Public method to update a history entry.

### Static Methods

None

#### HistoryManager (Constructor)

HistoryManager(parent=None)

Constructor

parent
  reference to the parent object (QObject)

#### HistoryManager.__checkForExpired

__checkForExpired()

Private slot to check entries for expiration.

#### HistoryManager.__cleanUrl

__cleanUrl(url)

Private method to generate a clean URL usable for the history entry.

url (QUrl)
  original URL

Return:
  cleaned URL

Return Type:
  QUrl

#### HistoryManager.__cleanUrlStr

__cleanUrlStr(url)

Private method to generate a clean URL usable for the history entry.

url (QUrl)
  original URL

Return:
  cleaned URL

Return Type:
  str

#### HistoryManager.__findFirstHistoryEntry

__findFirstHistoryEntry(url)

Private method to find the first entry for the given URL.

url (str)
  URL to search for

Return:
  first entry for the given URL

Return Type:
  HistoryEntry

#### HistoryManager.__load

__load()

Private method to load the saved history entries from disk.

#### HistoryManager.__refreshFrequencies

__refreshFrequencies()

Private slot to recalculate the refresh frequencies.

#### HistoryManager.__startFrequencyTimer

__startFrequencyTimer()

Private method to start the timer to recalculate the frequencies.

#### HistoryManager.__updateVisitCount

__updateVisitCount(url, count)

Private method to update the visit count for all entries of the given URL.

url (str)
  URL to be updated
count (int)
  new visit count

#### HistoryManager.addHistoryEntry

addHistoryEntry(view)

Public method to add a history entry.

view (WebBrowserView)
  reference to the view to add an entry for

#### HistoryManager.clear

clear(period=0)

Public slot to clear the complete history.

period
  history period in milliseconds to be cleared (integer)

#### HistoryManager.close

close()

Public method to close the history manager.

#### HistoryManager.daysToExpire

daysToExpire()

Public method to get the days for entry expiration.

Return:
  days for entry expiration (integer)

#### HistoryManager.getFileName

getFileName()

Public method to get the file name of the history file.

Return:
  name of the history file (string)

#### HistoryManager.history

history()

Public method to return the history.

Return:
  reference to the list of history entries (list of HistoryEntry)

#### HistoryManager.historyFilterModel

historyFilterModel()

Public method to get a reference to the history filter model.

Return:
  reference to the history filter model (HistoryFilterModel)

#### HistoryManager.historyModel

historyModel()

Public method to get a reference to the history model.

Return:
  reference to the history model (HistoryModel)

#### HistoryManager.historyTreeModel

historyTreeModel()

Public method to get a reference to the history tree model.

Return:
  reference to the history tree model (HistoryTreeModel)

#### HistoryManager.preferencesChanged

preferencesChanged()

Public method to indicate a change of preferences.

#### HistoryManager.reload

reload()

Public method to reload the history.

#### HistoryManager.removeHistoryEntry

removeHistoryEntry(url, title="")

Public method to remove a history entry.

url
  URL of the entry to remove (QUrl)
title
  title of the entry to remove (string)

#### HistoryManager.save

save()

Public slot to save the history entries to disk.

#### HistoryManager.setDaysToExpire

setDaysToExpire(limit)

Public method to set the days for entry expiration.

limit
  days for entry expiration (integer)

#### HistoryManager.setHistory

setHistory(history, loadedAndSorted=False)

Public method to set a new history.

history
  reference to the list of history entries to be set (list of HistoryEntry)
loadedAndSorted
  flag indicating that the list is sorted (boolean)

#### HistoryManager.siteVisitsCount

siteVisitsCount(scheme, host)

Public method to get the visit count for a web site using the given scheme.

scheme (str)
  scheme to look for
host (str)
  host to look for

Return:
  number of visits to this site

Return Type:
  int

#### HistoryManager.updateHistoryEntry

updateHistoryEntry(url, title)

Public method to update a history entry.

url
  URL of the entry to update (string)
title
  title of the entry to update (string)

Up