I tested this on bad url bad pass and correct param url is running ... on max 2sec. one dir list... one a clean xml or a message error..
IMO: If troltech group know that the FTP password are visible clear, on place from QFtp QWebdav is born... and a remote dir model... must not write now..
if you see other code leaks? ...
{
Q_OBJECT
public:
void run();
signals:
void TimeEnd();
private:
HTTP_propfind *jobb;
bool waiting;
int decimalsec;
public slots:
void grepdata();
void httperror();
};
void DavListDir::httperror()
{
emit DataXml(jobb->errorString());
jobb->abort();
exit();
}
void DavListDir::grepdata()
{
ned = jobb->GetDAVData();
if (ned.size() > 0) {
emit DataXml(ned);
waiting = false;
exit();
return;
}
QTimer::singleShot(2000,
this,
SLOT(httperror
()));
}
void DavListDir
::SetUrl( QUrl u
) {
decimalsec = 0;
waiting = true;
jobb = new HTTP_propfind(urltogrep); /* QHttp first setup header .... */
connect(jobb, SIGNAL(done(bool)), this, SLOT(grepdata()));
}
void DavListDir::run()
{
if (!urltogrep.isValid()) {
waiting = false;
ned ="url_invalid";
emit DataXml(ned);
exit();
return;
}
jobb->start(); /* QHttp start request */
exec();
}
class DavListDir : public QThread
{
Q_OBJECT
public:
void run();
void SetUrl( QUrl u );
signals:
void DataXml(QString);
void TimeEnd();
private:
QUrl urltogrep;
QString ned;
HTTP_propfind *jobb;
bool waiting;
int decimalsec;
public slots:
void grepdata();
void httperror();
};
void DavListDir::httperror()
{
emit DataXml(jobb->errorString());
jobb->abort();
exit();
}
void DavListDir::grepdata()
{
ned = jobb->GetDAVData();
if (ned.size() > 0) {
emit DataXml(ned);
waiting = false;
exit();
return;
}
QTimer::singleShot(2000, this, SLOT(httperror()));
}
void DavListDir::SetUrl( QUrl u )
{
decimalsec = 0;
waiting = true;
urltogrep = QUrl(u);
jobb = new HTTP_propfind(urltogrep); /* QHttp first setup header .... */
connect(jobb, SIGNAL(done(bool)), this, SLOT(grepdata()));
}
void DavListDir::run()
{
if (!urltogrep.isValid()) {
waiting = false;
ned ="url_invalid";
emit DataXml(ned);
exit();
return;
}
jobb->start(); /* QHttp start request */
exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks