//
// C++ Interface: urlfetch
//
// Description: 
//
//
// Author: Ian Reinhart Geiser <igeiser@devonit.com>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef URLFETCH_H
#define URLFETCH_H

#include <QObject>
#include <QEventLoop>
#include <QBuffer>
#include <QByteArray>
#include <QUrl>
#include <QHttp>
/**
Fetch a file from a remote URL

	@author Ian Reinhart Geiser <igeiser@devonit.com>
*/
class URLFetch : public QObject
{
Q_OBJECT
public:
    URLFetch( const QUrl &url,  QObject *parent = 0);
    ~URLFetch();

    static QByteArray fetch( const QString &url, const QString &baseUrl = QString() );
private slots:
    void handleRequestFinished( int id, bool error );
private:
    QEventLoop *m_localLoop;
    int m_currentRequest;
    QBuffer *m_responseBuffer;
};

#endif

