Ubuntu Download Manager: Ubuntu::DownloadManager::Manager Class Reference

Ubuntu Download Manager 1.2.0 A session-wide downloading service |

Signals | Public Member Functions | Static Public Member Functions | List of all members
Ubuntu::DownloadManager::Manager Class Referenceabstract

The Manager class is the entry point of the download manager API and allows the client to create download requests in the download manager. More...

`#include <manager.h>`

Inheritance diagram for Ubuntu::DownloadManager::Manager:
Collaboration diagram for Ubuntu::DownloadManager::Manager:

## Signals
void | downloadCreated (Download *down)
void | downloadsFound (DownloadsList *downloads)
void | downloadsWithMetadataFound (const QString &name, const QString &value, DownloadsList *downloads)
void | groupCreated (GroupDownload *down)

## Public Member Functions
| Manager (QObject *parent=0)
virtual Download * | getDownloadForId (const QString &id)=0
virtual void | createDownload (DownloadStruct downStruct)=0
virtual void | createDownload (DownloadStruct downStruct, DownloadCb cb, DownloadCb errCb)=0
virtual void | createDownload (StructList downs, const QString &algorithm, bool allowed3G, const QVariantMap &metadata, StringMap headers)=0
virtual void | createDownload (StructList downs, const QString &algorithm, bool allowed3G, const QVariantMap &metadata, StringMap headers, GroupCb cb, GroupCb errCb)=0
virtual void | getAllDownloads (const QString &appId, bool uncollected)=0
virtual void | getAllDownloads (const QString &appId, bool uncollected, DownloadsListCb cb, DownloadsListCb errCb)=0
virtual void | getAllDownloadsWithMetadata (const QString &name, const QString &value)=0
virtual void | getAllDownloadsWithMetadata (const QString &name, const QString &value, MetadataDownloadsListCb cb, MetadataDownloadsListCb errCb)=0
virtual bool | isError () const =0
virtual Error * | lastError () const =0
virtual void | allowMobileDataDownload (bool allowed)=0
virtual bool | isMobileDataDownload ()=0
virtual qulonglong | defaultThrottle ()=0
virtual void | setDefaultThrottle (qulonglong speed)=0
virtual void | exit ()=0

## Static Public Member Functions
static Manager * | createSessionManager (const QString &path="", QObject *parent=0)
static Manager * | createSystemManager (const QString &path="", QObject *parent=0)

## Detailed Description

The Manager class is the entry point of the download manager API and allows the client to create download requests in the download manager.

Since
  0.3

The Manager is the entry point of the API and allows to create new downloads that will be performed by the download manager. The class allows to have two different types of managers:

- Session manager: Connects to the session dbus service.
- System manager: Connects to the system dbus service.

The general rule of thumb is that a normal client application must connect to the session which contains all the downloads created for the user in the current session.

Definition at line 80 of file manager.h.

## Constructor & Destructor Documentation

## ◆ Manager()

Ubuntu::DownloadManager::Manager::Manager | ( | QObject * | parent = `0` | ) |
| inlineexplicit

Definition at line 84 of file manager.h.

## Member Function Documentation

## ◆ allowMobileDataDownload()

virtual void Ubuntu::DownloadManager::Manager::allowMobileDataDownload | ( | bool | allowed | ) |
| pure virtual

## ◆ createDownload() [1/4]

void Ubuntu::DownloadManager::Manager::createDownload | ( | DownloadStruct | downStruct | ) |
| pure virtual

Creates a new download using the data found in the structure. The downloadCreated(Download* down) can be used to get a pointer to the new created download.

Note
  The download object ownership from downloadCreated(Download* down) is of the caller and the download manager will not delete it.

## ◆ createDownload() [2/4]

void Ubuntu::DownloadManager::Manager::createDownload | ( | DownloadStruct | downStruct,
|  | DownloadCb | cb,
|  | DownloadCb | errCb
| ) |  |
| pure virtual

Creates a new download using the data found in the structure. cb will be executed when a successful download creation occurs while errCb will be executed when there was an error during the creation of the download object.

Note
  Even when the callbacks are executed the downloadCreated(Download* down) is emitted.
  The download object ownership from downloadCreated(Download* down) is of the caller and the download manager will not delete it.

## ◆ createDownload() [3/4]

void Ubuntu::DownloadManager::Manager::createDownload | ( | StructList | downs,
|  | const QString & | algorithm,
|  | bool | allowed3G,
|  | const QVariantMap & | metadata,
|  | StringMap | headers
| ) |  |
| pure virtual

Creates a group download with the data found in the structure. The groupCreated(GroupDownload* down) signal can be used to get a pointer to the new created group download.

Note
  The download object ownership from downloadCreated(Download* down) is of the caller and the download manager will not delete it.

## ◆ createDownload() [4/4]

void Ubuntu::DownloadManager::Manager::createDownload | ( | StructList | downs,
|  | const QString & | algorithm,
|  | bool | allowed3G,
|  | const QVariantMap & | metadata,
|  | StringMap | headers,
|  | GroupCb | cb,
|  | GroupCb | errCb
| ) |  |
| pure virtual

Creates a group download with the data found in the structure. cb will be executed when a successful group download creation occurs while errCb will be executed when there was an error during the creation of the group download object.

Note
  Even when the callbacks are executed the downloadCreated(Download* down) is emitted.
  The download object ownership from downloadCreated(Download* down) is of the caller and the download manager will not delete it.

## ◆ createSessionManager()

static Manager * Ubuntu::DownloadManager::Manager::createSessionManager | ( | const QString & | path = `""`,
|  | QObject * | parent = `0`
| ) |  |
| static

Creates a new manager that will be connected to the session manager. path allows to provide the path where the download manager service can be found. In the general use case path does not need to be provided and the default value should be used.

Note
  path is exposed to allow integration tests with the download manager by starting a download manager in a path and later providing the path to the client library.

Definition at line 31 of file manager.cpp.

## ◆ createSystemManager()

static Manager * Ubuntu::DownloadManager::Manager::createSystemManager | ( | const QString & | path = `""`,
|  | QObject * | parent = `0`
| ) |  |
| static

Creates a new manager that will be connected to the system manager. path allows to provide the path where the download manager service can be found. In the general use case path does not need to be provided and the default value should be used.

Note
  path is exposed to allow integration tests with the download manager by starting a download manager in a path and later providing the path to the client library.

Definition at line 40 of file manager.cpp.

## ◆ defaultThrottle()

qulonglong Ubuntu::DownloadManager::Manager::defaultThrottle | ( |  | ) |
| pure virtual

Returns the default bandwidth limit that was set for the downloads that are present in the download manager.

## ◆ downloadCreated

void Ubuntu::DownloadManager::Manager::downloadCreated | ( | Download * | down | ) |
| signal

This signal is emitted whenever a download is created by the download manager.

Definition at line 172 of file moc_manager.cpp.

## ◆ downloadsFound

void Ubuntu::DownloadManager::Manager::downloadsFound | ( | DownloadsList * | downloads | ) |
| signal

Definition at line 179 of file moc_manager.cpp.

## ◆ downloadsWithMetadataFound

void Ubuntu::DownloadManager::Manager::downloadsWithMetadataFound | ( | const QString & | name,
|  | const QString & | value,
|  | DownloadsList * | downloads
| ) |  |
| signal

Definition at line 186 of file moc_manager.cpp.

## ◆ exit()

void Ubuntu::DownloadManager::Manager::exit | ( |  | ) |
| pure virtual

Allows to stop the download manager. This method should not be used in production because it was added to simplify integration testing with the download manager.

Note
  Confined applications are not allowed to set this setting and therefore an error would happen.

## ◆ getAllDownloads() [1/2]

void Ubuntu::DownloadManager::Manager::getAllDownloads | ( | const QString & | appId,
|  | bool | uncollected
| ) |  |
| pure virtual

Returns all the downloads in the download manager that can be accessed by the calling client. If the client is not confined all downloads are returned, on the other hand if the client is confined the result will be only those downloads created by the client. The result of the method is returned via the downloadsFound signal.

If appId is specified only downloads from that appId will be returned.

If uncollected is true then only downloads that haven't yet been collected by a client will be returned.

## ◆ getAllDownloads() [2/2]

virtual void Ubuntu::DownloadManager::Manager::getAllDownloads | ( | const QString & | appId,
|  | bool | uncollected,
|  | DownloadsListCb | cb,
|  | DownloadsListCb | errCb
| ) |  |
| pure virtual

## ◆ getAllDownloadsWithMetadata() [1/2]

void Ubuntu::DownloadManager::Manager::getAllDownloadsWithMetadata | ( | const QString & | name,
|  | const QString & | value
| ) |  |
| pure virtual

Returns all the downloads in the download manager that can be accessed by the calling client. If the client is not confined all downloads are returned, on the other hand if the client is confined the result will be only those downloads created by the client. The result of the method is returned via the downloadsWithMetadataFound signal.

## ◆ getAllDownloadsWithMetadata() [2/2]

void Ubuntu::DownloadManager::Manager::getAllDownloadsWithMetadata | ( | const QString & | name,
|  | const QString & | value,
|  | MetadataDownloadsListCb | cb,
|  | MetadataDownloadsListCb | errCb
| ) |  |
| pure virtual

Returns all the downloads in the download manager that can be accessed by the calling client. If the client is not confined all downloads are returned, on the other hand if the client is confined the result will be only those downloads created by the client. If the method is a success the cb is executed else errCb is executed.

## ◆ getDownloadForId()

void Ubuntu::DownloadManager::Manager::getDownloadForId | ( | const QString & | id | ) |
| pure virtual

Returns a download object for the download with the given id. The id most be valid else the returned download will be in an unknown state meaning that most of the download operations will fail.

## ◆ groupCreated

void Ubuntu::DownloadManager::Manager::groupCreated | ( | GroupDownload * | down | ) |
| signal

This signal is emitted whenever a group download is created by the download manager.

Definition at line 193 of file moc_manager.cpp.

## ◆ isError()

bool Ubuntu::DownloadManager::Manager::isError | ( |  | ) | const
| pure virtual

Returns if the manager received an error during the execution of a command.

## ◆ isMobileDataDownload()

virtual bool Ubuntu::DownloadManager::Manager::isMobileDataDownload | ( |  | ) |
| pure virtual

## ◆ lastError()

Error * Ubuntu::DownloadManager::Manager::lastError | ( |  | ) | const
| pure virtual

Returns the last error that occurred when interacting with the download manager.

## ◆ setDefaultThrottle()

void Ubuntu::DownloadManager::Manager::setDefaultThrottle | ( | qulonglong | speed | ) |
| pure virtual

Allows to set the default bandwidth limit to all the downloads in the download manager.

Note
  Confined applications are not allowed to set this setting and therefore an error would happen.

The documentation for this class was generated from the following files:

- /build/ubuntu-download-manager-git/src/ubuntu-download-manager/src/downloads/client/ubuntu/download_manager/manager.h
- /build/ubuntu-download-manager-git/src/ubuntu-download-manager/src/downloads/client/ubuntu/download_manager/manager.cpp
- /build/ubuntu-download-manager-git/src/ubuntu-download-manager/src/downloads/client/ubuntu-download-manager-client_autogen/KVAQPNROTY/moc_manager.cpp