# eric6.Helpviewer.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.

### Derived from

QDialog, Ui_DownloadManager

### Class Attributes

RemoveExit
RemoveNever
RemoveSuccessFullDownload

### Class Methods

None

### Methods

DownloadManager | Constructor
__addItem | Private method to add a download to the list of downloads.
__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.
__contextMenuRetry | Private method to retry of the download.
__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.
__updateActiveItemCount | Private method to update the window title.
__updateItemCount | Private method to update the count label.
__updateRow | Private slot to update a download item.
activeDownloads | 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.
count | Public method to get the number of downloads.
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.
handleUnsupportedContent | Public method to handle unsupported content by downloading the referenced resource.
on_cleanupButton_clicked | Private slot 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.
shutdown | Public method to stop the download manager.

### 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.__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.__contextMenuRetry

__contextMenuRetry()

Private method to retry of the download.

#### 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()

Private slot to handle a finished download.

#### DownloadManager.__load

__load()

Private method to load the download settings.

#### DownloadManager.__updateActiveItemCount

__updateActiveItemCount()

Private method to update the window title.

#### DownloadManager.__updateItemCount

__updateItemCount()

Private method to update the count label.

#### DownloadManager.__updateRow

__updateRow(itm)

Private slot to update a download item.

itm (DownloadItem)
  reference to the download item

#### DownloadManager.activeDownloads

activeDownloads()

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.count

count()

Public method to get the number of downloads.

Returns:
  number of downloads (integer)

#### DownloadManager.download

download(requestOrUrl, requestFileName=False, mainWindow=None)

Public method to download a file.

requestOrUrl
  reference to a request object (QNetworkRequest) or a URL to be downloaded (QUrl)
requestFileName=
  flag indicating to ask for the download file name (boolean)
mainWindow=
  reference to the main window (HelpWindow)

#### 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.handleUnsupportedContent

handleUnsupportedContent(reply, requestFileName=False, webPage=None, download=False, mainWindow=None)

Public method to handle unsupported content by downloading the referenced resource.

reply
  reference to the reply object (QNetworkReply)
requestFileName=
  indicating to ask for a filename (boolean)
webPage=
  reference to the web page (HelpWebPage)
download=
  flag indicating a download request (boolean)
mainWindow=
  reference to the main window (HelpWindow)

#### DownloadManager.on_cleanupButton_clicked

on_cleanupButton_clicked()

Private slot 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.shutdown

shutdown()

Public method to stop the download manager.

Up