SendForm Class Reference

#include <SendForm.h>

List of all members.

Public Member Functions

 SendForm (const QUrl &destination)
void addField (const QString &name, const QString &value)
void addFields (const QStringList &names, const QStringList &values)
void clearFields ()
void addFile (const QString &name, const QString &file)
void addFiles (const QStringList &names, const QStringList &files)
void clearFiles ()
void clear ()
void setHeader (const QByteArray &headerName, const QByteArray &headerValue)
void setReferer (const QString &url)
void setDefaultUserAgent ()
void forceMultipart ()
void removeMultipart ()
QNetworkReply * post (QNetworkAccessManager *manager)

Detailed Description

SendForm can send files and fields (html's <input>) to a website.


Constructor & Destructor Documentation

SendForm::SendForm ( const QUrl &  destination  ) 

Constructor

Parameters:
destination : url that will received the form

Constructor


Member Function Documentation

void SendForm::addField ( const QString &  name,
const QString &  value 
)

add a field to the form

Parameters:
name : the name of the field
value : the value of the field

add a field to the form

void SendForm::addFields ( const QStringList &  names,
const QStringList &  values 
)

add several fields at once

Parameters:
names : the names of the field
values : the values of the field
Remarks:
if names and values doesn't have the same number of elements, only min(names.count(), values.count()) elements will be added
See also:
addField

add several fields at once

void SendForm::addFile ( const QString &  name,
const QString &  file 
)

add a field "file" to the form

Parameters:
name : the name of the field
file : the file path

add a field "file" to the form

void SendForm::addFiles ( const QStringList &  names,
const QStringList &  files 
)

add several files at once

Parameters:
names : the names of the field
files : the files path
Remarks:
if names and files doesn't have the same number of elements, only min(names.count(), files.count()) elements will be added
See also:
addFile

add several files at once

void SendForm::clear (  ) 

remove all the fields and all the files of the form

See also:
clearFiles
clearFields

remove all the fields and all the files of the form

void SendForm::clearFields (  ) 

remove all fields (except the "file" ones) of the form

See also:
clearFiles

remove all fields (except the "file" ones) of the form

void SendForm::clearFiles (  ) 

remove all the files of the form

void SendForm::forceMultipart (  ) 

force the form to be send as "multipart/form-data" instead of "x-www-form-urlencoded"

See also:
removeMultipart

force the form to be send as "multipart/form-data" instead of "x-www-form-urlencoded"

QNetworkReply * SendForm::post ( QNetworkAccessManager *  manager  ) 

send the form

Parameters:
manager : a valid QNetworkAccessManager that will be used to
Returns:
return the QNetworkReply corresponding to the request (or 0 if it's an invalid request)

send the form

void SendForm::removeMultipart (  ) 

force the form to be send as "x-www-form-urlencoded" instead of "multipart/form-data" if you called "forceMultipart" before

See also:
forceMultipart
Remarks:
ignored if you added a file

force the form to be send as "x-www-form-urlencoded" instead of "multipart/form-data" if you called "forceMultipart" before

void SendForm::setDefaultUserAgent (  ) 

set the user-agent to "Mozilla/5.0"

void SendForm::setHeader ( const QByteArray &  headerName,
const QByteArray &  headerValue 
)

set a header

Parameters:
headerName : the name of the header (i.e. "Content-type", "Accept", ...)
headerValue : the value of the field

set a header

void SendForm::setReferer ( const QString &  url  ) 

set the referer's url

Parameters:
url : the url you come from

set the referer's url


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 01:31:21 2010 for SendForm by  doxygen 1.6.3