# eric6.WebBrowser.Download.DownloadManager

Module implementing the download manager class.

### Global Attributes

None

### Classes

DownloadManager | Class implementing the download manager.

### Functions

None

## DownloadManager

Class implementing the download manager.

### Signals

downloadsCountChanged()
  emitted to indicate a change of the count of download items

### Derived from

QDialog, Ui_DownloadManager

### Class Attributes

RemoveExit
RemoveNever
RemoveSuccessFullDownload
UpdateTimerTimeout

### Class Methods

None

### Methods

DownloadManager | Constructor
__addItem | Private method to add a download to the list of downloads.
__closeDownloadTab | Private method to close an empty tab, that was opened only for loading the download URL.
__contextMenuCancel | Private method to cancel the current download.
__contextMenuCopyLink | Private method to copy the download link to the clipboard.
__contextMenuGotoPage | Private method to open the download page.
__contextMenuOpen | Private method to open the downloaded file.
__contextMenuOpenFolder | Private method to open the folder containing the downloaded file.
__contextMenuRemoveSelected | Private method to remove the selected downloads from the list.
__contextMenuSelectAll | Private method to select all downloads.
__currentItem | Private method to get a reference to the current item.
__customContextMenuRequested | Private slot to handle the context menu request for the bookmarks tree.
__finished | Private slot to handle a finished download.
__load | Private method to load the download settings.
__startUpdateTimer | Private slot to start the update timer.
__stopUpdateTimer | Private slot to stop the update timer.
__taskbarButton | Private method to get a reference to the task bar button (Windows only).
__testWebBrowserView | Private method to test a web browser view against an URL.
__updateRow | Private slot to update a download item.
activeDownloadsCount | Public method to get the number of active downloads.
allowQuit | Public method to check, if it is ok to quit.
changeOccurred | Public method to signal a change.
cleanup | Public slot to cleanup the downloads.
closeEvent | Protected event handler for the close event.
download | Public method to download a file.
downloadDirectory | Public method to get the current download directory.
downloads | Public method to get a reference to the downloads.
downloadsCount | Public method to get the number of downloads.
on_cleanupButton_clicked | Private slot to cleanup the downloads.
removePolicy | Public method to get the remove policy.
save | Public method to save the download settings.
setDownloadDirectory | Public method to set the current download directory.
setRemovePolicy | Public method to set the remove policy.
show | Public slot to show the download manager dialog.
shutdown | Public method to stop the download manager.
timerEvent | Protected event handler for timer events.

### Static Methods

None

#### DownloadManager (Constructor)

DownloadManager(parent=None)

Constructor

parent
  reference to the parent widget (QWidget)

#### DownloadManager.__addItem

__addItem(itm, append=False)

Private method to add a download to the list of downloads.

itm (DownloadItem)
  reference to the download item
append (bool)
  flag indicating to append the item

#### DownloadManager.__closeDownloadTab

__closeDownloadTab(url)

Private method to close an empty tab, that was opened only for loading the download URL.

url (QUrl)
  download URL

#### DownloadManager.__contextMenuCancel

__contextMenuCancel()

Private method to cancel the current download.

#### DownloadManager.__contextMenuCopyLink

__contextMenuCopyLink()

Private method to copy the download link to the clipboard.

#### DownloadManager.__contextMenuGotoPage

__contextMenuGotoPage()

Private method to open the download page.

#### DownloadManager.__contextMenuOpen

__contextMenuOpen()

Private method to open the downloaded file.

#### DownloadManager.__contextMenuOpenFolder

__contextMenuOpenFolder()

Private method to open the folder containing the downloaded file.

#### DownloadManager.__contextMenuRemoveSelected

__contextMenuRemoveSelected()

Private method to remove the selected downloads from the list.

#### DownloadManager.__contextMenuSelectAll

__contextMenuSelectAll()

Private method to select all downloads.

#### DownloadManager.__currentItem

__currentItem()

Private method to get a reference to the current item.

Returns:
  reference to the current item (DownloadItem)

#### DownloadManager.__customContextMenuRequested

__customContextMenuRequested(pos)

Private slot to handle the context menu request for the bookmarks tree.

pos
  position the context menu was requested (QPoint)

#### DownloadManager.__finished

__finished(success)

Private slot to handle a finished download.

success (bool)
  flag indicating a successful download

#### DownloadManager.__load

__load()

Private method to load the download settings.

#### DownloadManager.__startUpdateTimer

__startUpdateTimer()

Private slot to start the update timer.

#### DownloadManager.__stopUpdateTimer

__stopUpdateTimer()

Private slot to stop the update timer.

#### DownloadManager.__taskbarButton

__taskbarButton()

Private method to get a reference to the task bar button (Windows only).

Returns:
  reference to the task bar button

Return Type:
  QWinTaskbarButton or None

#### DownloadManager.__testWebBrowserView

__testWebBrowserView(view, url)

Private method to test a web browser view against an URL.

view (WebBrowserView)
  reference to the web browser view to be tested
url (QUrl)
  URL to test against

Returns:
  flag indicating, that the view is the one for the URL

Return Type:
  bool

#### DownloadManager.__updateRow

__updateRow(itm)

Private slot to update a download item.

itm (DownloadItem)
  reference to the download item

#### DownloadManager.activeDownloadsCount

activeDownloadsCount()

Public method to get the number of active downloads.

Returns:
  number of active downloads (integer)

#### DownloadManager.allowQuit

allowQuit()

Public method to check, if it is ok to quit.

Returns:
  flag indicating allowance to quit (boolean)

#### DownloadManager.changeOccurred

changeOccurred()

Public method to signal a change.

#### DownloadManager.cleanup

cleanup()

Public slot to cleanup the downloads.

#### DownloadManager.closeEvent

closeEvent(evt)

Protected event handler for the close event.

evt (QCloseEvent)
  reference to the close event

#### DownloadManager.download

download(downloadItem)

Public method to download a file.

downloadItem (QWebEngineDownloadItem)
  reference to the download object containing the download data.

#### DownloadManager.downloadDirectory

downloadDirectory()

Public method to get the current download directory.

Returns:
  current download directory (string)

#### DownloadManager.downloads

downloads()

Public method to get a reference to the downloads.

Returns:
  reference to the downloads (list of DownloadItem)

#### DownloadManager.downloadsCount

downloadsCount()

Public method to get the number of downloads.

Returns:
  number of downloads

Return Type:
  int

#### DownloadManager.on_cleanupButton_clicked

on_cleanupButton_clicked()

Private slot to cleanup the downloads.

#### DownloadManager.removePolicy

removePolicy()

Public method to get the remove policy.

Returns:
  remove policy (integer)

#### DownloadManager.save

save()

Public method to save the download settings.

#### DownloadManager.setDownloadDirectory

setDownloadDirectory(directory)

Public method to set the current download directory.

directory
  current download directory (string)

#### DownloadManager.setRemovePolicy

setRemovePolicy(policy)

Public method to set the remove policy.

policy
  policy to be set (DownloadManager.RemoveExit, DownloadManager.RemoveNever, DownloadManager.RemoveSuccessFullDownload)

#### DownloadManager.show

show()

Public slot to show the download manager dialog.

#### DownloadManager.shutdown

shutdown()

Public method to stop the download manager.

#### DownloadManager.timerEvent

timerEvent(evt)

Protected event handler for timer events.

evt (QTimerEvent)
  reference to the timer event

Up