Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Attributes

Site Class Reference

Provide methods and data for monitoring a generic site. More...

#include <Site.h>

Inheritance diagram for Site:

List of all members.

Public Types

enum  HttpMethod { GET, POST }


void monitoringStarted ()
void monitoringStopped ()

Public Member Functions

 Site (QObject *parent=0)
void setUrl (QString siteUrl)
QString getUrl ()
void setUserDetails (QString username, QString password)
void setLoginLocation (QString url)
QString getLoginLocation ()
void setLoginParameters (QString parameters)
QString getLoginParameters ()
void setLoginCookieNameToSearch (QString cookieName)
QString getLoginCookieNameToSearch ()
QTimer * getMonitorTimer ()
bool startMonitoring (int intervalSec)
virtual void stopMonitoring (QString stopError="", Error *detailedError=0)
bool isMonitoringStarted ()
QString fixLocation (QString location)
virtual bool downloadPage (QString pageLocation, bool oldIfExist=false, HttpMethod method=GET, QString postParameters="")
 Download the specified page, be it an url or a local path.
virtual bool detectAll ()
bool detectLogin ()
QStringList detectUsingSearches (const QList< SiteDetectSearch > *searches, QString returnTarget="searchName")
virtual bool respectsSearchRequire (QString require)
virtual bool login ()
QString createUserSession (unsigned short length=32)
SiteStructurestructure ()
virtual void setStructure (SiteStructure *structure)
virtual void deleteStructure ()

Static Public Member Functions

static QString fixUrl (QString url)
static QString fixPath (QString path)
static QString decodeHtmlCode (QString htmlCode)

Protected Attributes

QString url
bool monitoringIsStarted
bool mustLogin
QString loginLocation
QString loginParameters
QString loginCookieNameToSearch
QString userUsername
QString userPassword
QString userCookies
bool userIsLogged
QTimer * monitorTimer
int monitorTimerInterval
QString respPage
QString respPageUrl
QNetworkAccessManager * network
QEventLoop * eventLoop
QTimer * downloadPageTimer

Detailed Description

Provide methods and data for monitoring a generic site.

Member Function Documentation

bool Site::detectAll (  ) [virtual]

Dummy virtual function that can be overriden by subclasses.

Reimplemented in Forum.

bool Site::downloadPage ( QString  pageLocation,
bool  oldIfExist = false,
HttpMethod  method = GET,
QString  postParameters = "" 
) [virtual]

Download the specified page, be it an url or a local path.

pageLocationthe url or local path to download.
oldIfExistsif true don't redownload a previously downloaded page.
methodthe http method to use to make the request (eg: POST).
postParametersused only if method=POST, used to specify the post parameters of the post request.
QString Site::getLoginCookieNameToSearch (  )

Return login cookie's name.

QString Site::getLoginLocation (  )

Return login page url

QString Site::getLoginParameters (  )

Return login post parameters.

QTimer * Site::getMonitorTimer (  )

Return a reference to the timer used to monitor the site.

bool Site::respectsSearchRequire ( QString  require ) [virtual]

Dummy virtual function that can be overriden by subclasses.

Reimplemented in Forum.

void Site::setLoginCookieNameToSearch ( QString  cookieName )

Set cookie to search to check if login was correct

void Site::setLoginLocation ( QString  url )

Set login page url

void Site::setLoginParameters ( QString  parameters )

Set login post parameters.

The documentation for this class was generated from the following files:
 All Classes Functions