# eric4.Helpviewer.DownloadDialog

Module implementing the download dialog.

### Global Attributes

None

### Classes

DownloadDialog | Class implementing the download dialog.

### Functions

None

## DownloadDialog

Class implementing the download dialog.

### Signals

done()
  emitted just before the dialog is closed

### Derived from

QWidget, Ui_DownloadDialog

### Class Attributes

None

### Class Methods

None

### Methods

DownloadDialog | Constructor
__dataString | Private method to generate a formatted data string.
__downloadProgress | Private method show the download progress.
__downloadedSuccessfully | Private method to determine the download status.
__downloading | Private method to determine, if a download is in progress.
__finished | Private slot to handle the download finished.
__getFileName | Private method to get the filename to save to from the user.
__metaDataChanged | Private slot to handle a change of the meta data.
__networkError | Private slot to handle a network error.
__open | Private slot to open the downloaded file.
__readyRead | Private slot to read the available data.
__saveFileName | Private method to calculate a name for the file to download.
__stop | Private slot to stop the download.
__tryAgain | Private slot to retry the download.
__updateInfoLabel | Private method to update the info label.
closeEvent | Protected method called when the dialog is closed.
initialize | Public method to (re)initialize the dialog.
on_buttonBox_clicked | Private slot called by a button of the button box clicked.

### Static Methods

None

#### DownloadDialog (Constructor)

DownloadDialog(reply = None, requestFilename = False, webPage = None, download = False, parent = None)

Constructor

reply
  reference to the network reply object (QNetworkReply)
requestFilename
  flag indicating to ask the user for a filename (boolean)
webPage
  reference to the web page object the download originated from (QWebPage)
download
  flag indicating a download operation (boolean)
parent
  reference to the parent widget (QWidget)

#### DownloadDialog.__dataString

__dataString(size)

Private method to generate a formatted data string.

size
  size to be formatted (integer)

Returns:
  formatted data string (QString)

#### DownloadDialog.__downloadProgress

__downloadProgress(received, total)

Private method show the download progress.

received
  number of bytes received (integer)
total
  number of total bytes (integer)

#### DownloadDialog.__downloadedSuccessfully

__downloadedSuccessfully()

Private method to determine the download status.

Returns:
  download status (boolean)

#### DownloadDialog.__downloading

__downloading()

Private method to determine, if a download is in progress.

Returns:
  flag indicating a download is in progress (boolean)

#### DownloadDialog.__finished

__finished()

Private slot to handle the download finished.

#### DownloadDialog.__getFileName

__getFileName()

Private method to get the filename to save to from the user.

Returns:
  flag indicating success (boolean)

#### DownloadDialog.__metaDataChanged

__metaDataChanged()

Private slot to handle a change of the meta data.

#### DownloadDialog.__networkError

__networkError()

Private slot to handle a network error.

#### DownloadDialog.__open

__open()

Private slot to open the downloaded file.

#### DownloadDialog.__readyRead

__readyRead()

Private slot to read the available data.

#### DownloadDialog.__saveFileName

__saveFileName(directory)

Private method to calculate a name for the file to download.

directory
  name of the directory to store the file into (QString)

Returns:
  proposed filename (QString)

#### DownloadDialog.__stop

__stop()

Private slot to stop the download.

#### DownloadDialog.__tryAgain

__tryAgain()

Private slot to retry the download.

#### DownloadDialog.__updateInfoLabel

__updateInfoLabel()

Private method to update the info label.

#### DownloadDialog.closeEvent

closeEvent(evt)

Protected method called when the dialog is closed.

#### DownloadDialog.initialize

initialize()

Public method to (re)initialize the dialog.

Returns:
  flag indicating success (boolean)

#### DownloadDialog.on_buttonBox_clicked

on_buttonBox_clicked(button)

Private slot called by a button of the button box clicked.

button
  button that was clicked (QAbstractButton)

Up