~mandel/ubuntu-download-manager/network-errors-management

« back to all changes in this revision

Viewing changes to libubuntudownloadmanager/download_manager_adaptor.cpp

  • Committer: Tarmac
  • Author(s): Manuel de la Pena
  • Date: 2013-09-03 14:13:17 UTC
  • mfrom: (96.4.4 change-api)
  • Revision ID: tarmac-20130903141317-1d3k889kb1l2qaw1
Adds a new API that exposes the creation of a download as a struct that way the clib will be more stable without changing the parameters and will be able to provide a nice struct with default values.

Approved by Roberto Alsina, Alejandro J. Cura, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    QMetaObject::invokeMethod(parent(), "allowGSMDownload", Q_ARG(bool, allowed));
40
40
}
41
41
 
42
 
QDBusObjectPath DownloadManagerAdaptor::createDownload(const QString &url, const QVariantMap &metadata, StringMap headers)
 
42
QDBusObjectPath DownloadManagerAdaptor::createDownload(DownloadStruct download)
43
43
{
44
44
    // handle method call com.canonical.applications.DownloaderManager.createDownload
45
 
    QDBusObjectPath download;
46
 
    QMetaObject::invokeMethod(parent(), "createDownload", Q_RETURN_ARG(QDBusObjectPath, download), Q_ARG(QString, url), Q_ARG(QVariantMap, metadata), Q_ARG(StringMap, headers));
47
 
    return download;
 
45
    QDBusObjectPath downloadPath;
 
46
    QMetaObject::invokeMethod(parent(), "createDownload", Q_RETURN_ARG(QDBusObjectPath, downloadPath), Q_ARG(DownloadStruct, download));
 
47
    return downloadPath;
48
48
}
49
49
 
50
50
QDBusObjectPath DownloadManagerAdaptor::createDownloadGroup(StructList downloads, const QString &algorithm, bool allowed3G, const QVariantMap &metadata, StringMap headers)
55
55
    return download;
56
56
}
57
57
 
58
 
QDBusObjectPath DownloadManagerAdaptor::createDownloadWithHash(const QString &url, const QString &algorithm, const QString &hash, const QVariantMap &metadata, StringMap headers)
59
 
{
60
 
    // handle method call com.canonical.applications.DownloaderManager.createDownloadWithHash
61
 
    QDBusObjectPath download;
62
 
    QMetaObject::invokeMethod(parent(), "createDownloadWithHash", Q_RETURN_ARG(QDBusObjectPath, download), Q_ARG(QString, url), Q_ARG(QString, algorithm), Q_ARG(QString, hash), Q_ARG(QVariantMap, metadata), Q_ARG(StringMap, headers));
63
 
    return download;
64
 
}
65
 
 
66
58
qulonglong DownloadManagerAdaptor::defaultThrottle()
67
59
{
68
60
    // handle method call com.canonical.applications.DownloaderManager.defaultThrottle