# eric6.WebBrowser.Bookmarks.BookmarksManager

Module implementing the bookmarks manager.

### Global Attributes

BOOKMARKBAR
BOOKMARKMENU
StartMenu
StartRoot
StartToolBar

### Classes

BookmarksManager | Class implementing the bookmarks manager.
ChangeBookmarkCommand | Class implementing the Insert undo command.
InsertBookmarksCommand | Class implementing the Insert undo command.
RemoveBookmarksCommand | Class implementing the Remove undo command.

### Functions

None

## BookmarksManager

Class implementing the bookmarks manager.

### Signals

bookmarksReloaded()
  emitted after the bookmarks were reloaded
bookmarksSaved()
  emitted after the bookmarks were saved
entryAdded(BookmarkNode)
  emitted after a bookmark node has been added
entryChanged(BookmarkNode)
  emitted after a bookmark node has been changed
entryRemoved(BookmarkNode, int, BookmarkNode)
  emitted after a bookmark node has been removed

### Derived from

QObject

### Class Attributes

None

### Class Methods

getFileName | Class method to get the file name of the bookmark file.

### Methods

BookmarksManager | Constructor
__initialize | Private method to initialize some data.
__searchBookmark | Private method get a bookmark node for a given URL.
__searchBookmarks | Private method get a list of bookmark nodes for a given URL.
addBookmark | Public method to add a bookmark.
bookmarkForUrl | Public method to get a bookmark node for a given URL.
bookmarks | Public method to get a reference to the root bookmark node.
bookmarksForUrl | Public method to get a list of bookmark nodes for a given URL.
bookmarksModel | Public method to get a reference to the bookmarks model.
changeExpanded | Public method to handle a change of the expanded state.
close | Public method to close the bookmark manager.
exportBookmarks | Public method to export the bookmarks.
faviconChanged | Public slot to update the icon image for an URL.
importBookmarks | Public method to import bookmarks.
incVisitCount | Public method to increment the visit count of a bookmark.
load | Public method to load the bookmarks.
menu | Public method to get a reference to the bookmarks menu node.
reload | Public method used to initiate a reloading of the bookmarks.
removeBookmark | Public method to remove a bookmark.
save | Public method to save the bookmarks.
setNodeChanged | Public method to signal changes of bookmarks other than title, URL or timestamp.
setTimestamp | Public method to set the URL of a bookmark.
setTitle | Public method to set the title of a bookmark.
setUrl | Public method to set the URL of a bookmark.
setVisitCount | Public method to set the visit count of a bookmark.
toolbar | Public method to get a reference to the bookmarks toolbar node.
undoRedoStack | Public method to get a reference to the undo stack.

### Static Methods

None

#### BookmarksManager.getFileName (class method)

getFileName()

Class method to get the file name of the bookmark file.

Returns:
  name of the bookmark file (string)

#### BookmarksManager (Constructor)

BookmarksManager(parent=None)

Constructor

parent
  reference to the parent object (QObject)

#### BookmarksManager.__initialize

__initialize()

Private method to initialize some data.

#### BookmarksManager.__searchBookmark

__searchBookmark(url, startNode)

Private method get a bookmark node for a given URL.

url
  URL of the bookmark to search for (string)
startNode
  reference to the node to start searching (BookmarkNode)

Returns:
  bookmark node for the given url (BookmarkNode)

#### BookmarksManager.__searchBookmarks

__searchBookmarks(url, startNode)

Private method get a list of bookmark nodes for a given URL.

url
  URL of the bookmarks to search for (string)
startNode
  reference to the node to start searching (BookmarkNode)

Returns:
  list of bookmark nodes for the given url (list of BookmarkNode)

#### BookmarksManager.addBookmark

addBookmark(parent, node, row=-1)

Public method to add a bookmark.

parent
  reference to the node to add to (BookmarkNode)
node
  reference to the node to add (BookmarkNode)
row
  row number (integer)

#### BookmarksManager.bookmarkForUrl

bookmarkForUrl(url, start=StartRoot)

Public method to get a bookmark node for a given URL.

url
  URL of the bookmark to search for (QUrl or string)
start=
  indicator for the start of the search (StartRoot, StartMenu, StartToolBar)

Returns:
  bookmark node for the given url (BookmarkNode)

#### BookmarksManager.bookmarks

bookmarks()

Public method to get a reference to the root bookmark node.

Returns:
  reference to the root bookmark node (BookmarkNode)

#### BookmarksManager.bookmarksForUrl

bookmarksForUrl(url, start=StartRoot)

Public method to get a list of bookmark nodes for a given URL.

url
  URL of the bookmarks to search for (QUrl or string)
start=
  indicator for the start of the search (StartRoot, StartMenu, StartToolBar)

Returns:
  list of bookmark nodes for the given url (list of BookmarkNode)

#### BookmarksManager.bookmarksModel

bookmarksModel()

Public method to get a reference to the bookmarks model.

Returns:
  reference to the bookmarks model (BookmarksModel)

#### BookmarksManager.changeExpanded

changeExpanded()

Public method to handle a change of the expanded state.

#### BookmarksManager.close

close()

Public method to close the bookmark manager.

#### BookmarksManager.exportBookmarks

exportBookmarks()

Public method to export the bookmarks.

#### BookmarksManager.faviconChanged

faviconChanged(url)

Public slot to update the icon image for an URL.

url
  URL of the icon to update (QUrl or string)

#### BookmarksManager.importBookmarks

importBookmarks()

Public method to import bookmarks.

#### BookmarksManager.incVisitCount

incVisitCount(node)

Public method to increment the visit count of a bookmark.

node
  reference to the node to be changed (BookmarkNode)

#### BookmarksManager.load

load()

Public method to load the bookmarks.

Raises RuntimeError:
  raised to indicate an error loading the bookmarks

#### BookmarksManager.menu

menu()

Public method to get a reference to the bookmarks menu node.

Returns:
  reference to the bookmarks menu node (BookmarkNode)

#### BookmarksManager.reload

reload()

Public method used to initiate a reloading of the bookmarks.

#### BookmarksManager.removeBookmark

removeBookmark(node)

Public method to remove a bookmark.

node
  reference to the node to be removed (BookmarkNode)

#### BookmarksManager.save

save()

Public method to save the bookmarks.

#### BookmarksManager.setNodeChanged

setNodeChanged(node)

Public method to signal changes of bookmarks other than title, URL or timestamp.

node
  reference to the bookmark (BookmarkNode)

#### BookmarksManager.setTimestamp

setTimestamp(node, timestampType, timestamp)

Public method to set the URL of a bookmark.

node
  reference to the node to be changed (BookmarkNode)
timestampType
  type of the timestamp to set (BookmarkNode.TsAdded, BookmarkNode.TsModified, BookmarkNode.TsVisited)
timestamp
  timestamp to set (QDateTime)

#### BookmarksManager.setTitle

setTitle(node, newTitle)

Public method to set the title of a bookmark.

node
  reference to the node to be changed (BookmarkNode)
newTitle
  title to be set (string)

#### BookmarksManager.setUrl

setUrl(node, newUrl)

Public method to set the URL of a bookmark.

node
  reference to the node to be changed (BookmarkNode)
newUrl
  URL to be set (string)

#### BookmarksManager.setVisitCount

setVisitCount(node, count)

Public method to set the visit count of a bookmark.

node
  reference to the node to be changed (BookmarkNode)
count
  visit count to be set (int or str)

#### BookmarksManager.toolbar

toolbar()

Public method to get a reference to the bookmarks toolbar node.

Returns:
  reference to the bookmarks toolbar node (BookmarkNode)

#### BookmarksManager.undoRedoStack

undoRedoStack()

Public method to get a reference to the undo stack.

Returns:
  reference to the undo stack (QUndoStack)

Up

## ChangeBookmarkCommand

Class implementing the Insert undo command.

### Derived from

QUndoCommand

### Class Attributes

None

### Class Methods

None

### Methods

ChangeBookmarkCommand | Constructor
redo | Public slot to perform the redo action.
undo | Public slot to perform the undo action.

### Static Methods

None

#### ChangeBookmarkCommand (Constructor)

ChangeBookmarkCommand(bookmarksManager, node, newValue, title)

Constructor

bookmarksManager
  reference to the bookmarks manager (BookmarksManager)
node
  reference to the node to be changed (BookmarkNode)
newValue
  new value to be set (string)
title
  flag indicating a change of the title (True) or the URL (False) (boolean)

#### ChangeBookmarkCommand.redo

redo()

Public slot to perform the redo action.

#### ChangeBookmarkCommand.undo

undo()

Public slot to perform the undo action.

Up

## InsertBookmarksCommand

Class implementing the Insert undo command.

### Derived from

RemoveBookmarksCommand

### Class Attributes

None

### Class Methods

None

### Methods

InsertBookmarksCommand | Constructor
redo | Public slot to perform the redo action.
undo | Public slot to perform the undo action.

### Static Methods

None

#### InsertBookmarksCommand (Constructor)

InsertBookmarksCommand(bookmarksManager, parent, node, row)

Constructor

bookmarksManager
  reference to the bookmarks manager (BookmarksManager)
parent
  reference to the parent node (BookmarkNode)
node
  reference to the node to be inserted (BookmarkNode)
row
  row number of bookmark (integer)

#### InsertBookmarksCommand.redo

redo()

Public slot to perform the redo action.

#### InsertBookmarksCommand.undo

undo()

Public slot to perform the undo action.

Up

## RemoveBookmarksCommand

Class implementing the Remove undo command.

### Derived from

QUndoCommand

### Class Attributes

None

### Class Methods

None

### Methods

RemoveBookmarksCommand | Constructor
redo | Public slot to perform the redo action.
undo | Public slot to perform the undo action.

### Static Methods

None

#### RemoveBookmarksCommand (Constructor)

RemoveBookmarksCommand(bookmarksManager, parent, row)

Constructor

bookmarksManager
  reference to the bookmarks manager (BookmarksManager)
parent
  reference to the parent node (BookmarkNode)
row
  row number of bookmark (integer)

#### RemoveBookmarksCommand.redo

redo()

Public slot to perform the redo action.

#### RemoveBookmarksCommand.undo

undo()

Public slot to perform the undo action.

Up