view ui/downloader.cpp @ 24:de67047ca229

Add documentation generation
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 21 Feb 2014 15:12:24 +0000
parents f4f957c58e0a
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();
}

http://wald.intevation.org/projects/trustbridge/