LocalFileDownloader Class | Qt Installer Framework Manual

Qt Installer Framework Manual | LocalFileDownloader

# LocalFileDownloader Class

(KDUpdater::LocalFileDownloader)

The LocalFileDownloader class is used to copy files from the local file system. More...

Header: | #include <LocalFileDownloader>
Inherits: | KDUpdater::FileDownloader

- List of all members, including inherited members

## Public Functions

| LocalFileDownloader(QObject *parent = 0)
| ~LocalFileDownloader()

## Reimplemented Public Functions

virtual bool | canDownload() const
virtual LocalFileDownloader * | clone(QObject *parent = 0) const
virtual QString | downloadedFileName() const
virtual bool | isDownloaded() const
virtual void | setDownloadedFileName(const QString &name)

- 24 public functions inherited from KDUpdater::FileDownloader

## Public Slots

virtual void | cancelDownload()

- 1 public slot inherited from KDUpdater::FileDownloader

## Protected Functions

void | timerEvent(QTimerEvent *event)

## Reimplemented Protected Functions

virtual void | onError()
virtual void | onSuccess()

- 17 protected functions inherited from KDUpdater::FileDownloader

### Additional Inherited Members

- 3 properties inherited from KDUpdater::FileDownloader
- 10 signals inherited from KDUpdater::FileDownloader

## Detailed Description

The LocalFileDownloader class is used to copy files from the local file system.

The user of KDUpdater might be simultaneously downloading several files; sometimes in parallel to other file downloaders. If copying a local file takes a long time, it will make the other downloads hang. Therefore, a timer is used and one block of data is copied per unit time, even though QFile::copy() does the task of copying local files from one place to another.

## Member Function Documentation

### LocalFileDownloader::LocalFileDownloader(QObject *parent = 0)

Creates a local file downloader with the parent parent.

### LocalFileDownloader::~LocalFileDownloader()

Destroys the local file downloader.

### `[virtual]` bool LocalFileDownloader::canDownload() const

Reimplemented from FileDownloader::canDownload().

Returns `true` if the file exists and is readable.

### `[virtual slot]` void LocalFileDownloader::cancelDownload()

Reimplemented from FileDownloader::cancelDownload().

Cancels copying the file.

### `[virtual]` LocalFileDownloader *LocalFileDownloader::clone(QObject *parent = 0) const

Reimplemented from FileDownloader::clone().

Clones the local file downloader and assigns it the parent parent. Returns the new local file downloader.

### `[virtual]` QString LocalFileDownloader::downloadedFileName() const

Reimplemented from FileDownloader::downloadedFileName().

Returns the file name of the copied file.

See also setDownloadedFileName().

### `[virtual]` bool LocalFileDownloader::isDownloaded() const

Reimplemented from FileDownloader::isDownloaded().

Returns `true` if the file is copied.

### `[virtual protected]` void LocalFileDownloader::onError()

Reimplemented from FileDownloader::onError().

Clears the destination file if an error occurs during copying and stops the download speed timer.

### `[virtual protected]` void LocalFileDownloader::onSuccess()

Reimplemented from FileDownloader::onSuccess().

Closes the destination file after it has been successfully copied and stops the download speed timer.

### `[virtual]` void LocalFileDownloader::setDownloadedFileName(const QString &name)

Reimplemented from FileDownloader::setDownloadedFileName().

Sets the file name of the copied file to name.

See also downloadedFileName().

### `[protected]` void LocalFileDownloader::timerEvent(QTimerEvent *event)

Called when the download timer event event occurs.