diff options
Diffstat (limited to 'src/downloadmanager.cpp')
| -rw-r--r-- | src/downloadmanager.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index d39aa14..bfaf22a 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1,9 +1,24 @@ #include "downloadmanager.h" -void DownloadManager::downloadFile() +void DownloadManager::downloadFile(QString& filename) { + this->filename = filename; this->reply = this->qnam->get(this->request); - //->get(request); + qiod = reply; + QObject::connect(this->reply, SIGNAL(finished()), this, SLOT(saveData())); +} + +void DownloadManager::saveData() +{ + QFile outfile(this->filename); + if (!outfile.open(QIODevice::WriteOnly)) + { + qDebug() << "Couldnt open file! exiting..."; + exit(1); + } + outfile.write(this->reply->readAll()); + outfile.close(); + } void DownloadManager::setUrl(QUrl& qurl) |
