~mandel/ubuntu-download-manager/expose-logger

« back to all changes in this revision

Viewing changes to src/downloads/client/ubuntu/download_manager/download_impl.cpp

  • Committer: Manuel de la Peña
  • Date: 2014-06-18 11:10:18 UTC
  • Revision ID: manuel.delapena@canonical.com-20140618111018-t5po3fkp254dakg3
Added support to set the headers of a single file download.

Show diffs side-by-side

added added

removed removed

Lines of Context:
166
166
}
167
167
 
168
168
void
 
169
DownloadImpl::setHeaders(QMap<QString, QString> headers) {
 
170
    QDBusPendingReply<> reply =
 
171
        _dbusInterface->setHeaders(headers);
 
172
    // block, the call should be fast enough
 
173
    reply.waitForFinished();
 
174
    if (reply.isError()) {
 
175
        setLastError(reply.error());
 
176
    }
 
177
}
 
178
 
 
179
QMap<QString, QString>
 
180
DownloadImpl::headers() {
 
181
    QDBusPendingReply<QMap<QString, QString> > reply =
 
182
        _dbusInterface->headers();
 
183
    // block, the call should be fast enough
 
184
    reply.waitForFinished();
 
185
    if (reply.isError()) {
 
186
        setLastError(reply.error());
 
187
        QMap<QString, QString> empty;
 
188
        return empty;
 
189
    } else {
 
190
        auto result = reply.value();
 
191
        return result;
 
192
    }
 
193
}
 
194
 
 
195
 
 
196
void
169
197
DownloadImpl::setThrottle(qulonglong speed) {
170
198
    QDBusPendingReply<> reply =
171
199
        _dbusInterface->setThrottle(speed);