Mercurial > trustbridge
view ui/downloader.cpp @ 18:f4f957c58e0a
Move listuitol and add cert pinning with a test certificate
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 19 Feb 2014 15:41:14 +0000 |
parents | 95e1b6edf2fc |
children | 62cd56cea09b |
line wrap: on
line source
#include "downloader.h" #ifndef DOWNLOAD_SERVER #define DOWNLOAD_SERVER "https://www.intevation.de" #endif #ifdef Q_OS_WIN #endif #include <QFile> #include <QDir> #include <QDebug> #include <QStandardPaths> Downloader::Downloader(QObject* parent, const QString& url, const QByteArray& certificate, const QDateTime& newestSW, const QDateTime& newestList): QThread(parent), mUrl(url), mLastModSW(newestSW), mLastModList(newestList) { if (certificate.isEmpty()) { QFile certResource(":certs/kolab.org"); certResource.open(QFile::ReadOnly); mCert = certResource.readAll(); certResource.close(); } } QString Downloader::getDataDirectory() { QString candidate = QStandardPaths::writableLocation(QStandardPaths::DataLocation); if (candidate.isEmpty()) { qDebug() << "Could not find writeable locaction for me"; return QString(); } QDir cDir(candidate); if (!cDir.exists()) { if (!cDir.mkpath(candidate)) { qDebug() << "Could not create path to: " << candidate; return QString(); } } return cDir.absolutePath(); }