Loading...
Searching...
No Matches
Lomiri::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 Lomiri::DownloadManager::Manager:
Collaboration diagram for Lomiri::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()

Lomiri::DownloadManager::Manager::Manager | ( | QObject * | parent = 0 | ) |

inline explicit

Definition at line 84 of file manager.h.

Referenced by exit().

## Member Function Documentation

## allowMobileDataDownload()

virtual void Lomiri::DownloadManager::Manager::allowMobileDataDownload | ( | bool | allowed | ) |

pure virtual

## createDownload() [1/4]

virtual void Lomiri::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]

virtual void Lomiri::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]

virtual void Lomiri::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]

virtual void Lomiri::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()

Manager * Lomiri::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()

Manager * Lomiri::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()

virtual qulonglong Lomiri::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 Lomiri::DownloadManager::Manager::downloadCreated | ( | Download * | down | ) |

signal

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

## downloadsFound

void Lomiri::DownloadManager::Manager::downloadsFound | ( | DownloadsList * | downloads | ) |

signal

## downloadsWithMetadataFound

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

signal

## exit()

virtual void Lomiri::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.

References Manager().

Here is the call graph for this function:

## getAllDownloads() [1/2]

virtual void Lomiri::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 Lomiri::DownloadManager::Manager::getAllDownloads | ( | const QString & | appId,
|  | bool | uncollected,
|  | DownloadsListCb | cb,
|  | DownloadsListCb | errCb )

pure virtual

## getAllDownloadsWithMetadata() [1/2]

virtual void Lomiri::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]

virtual void Lomiri::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()

virtual Download * Lomiri::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 Lomiri::DownloadManager::Manager::groupCreated | ( | GroupDownload * | down | ) |

signal

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

## isError()

virtual bool Lomiri::DownloadManager::Manager::isError | ( |  | ) | const

pure virtual

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

## isMobileDataDownload()

virtual bool Lomiri::DownloadManager::Manager::isMobileDataDownload | ( |  | ) |

pure virtual

## lastError()

virtual Error * Lomiri::DownloadManager::Manager::lastError | ( |  | ) | const

pure virtual

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

## setDefaultThrottle()

virtual void Lomiri::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:

- manager.h
- manager.cpp