view ui/downloader.cpp @ 19:9af6198deb8e

Add timed trigger for the message
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 20 Feb 2014 10:56:49 +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/