[Qt-interest] validate url using QHttp
Mystical Groovy
mysticalgr at gmail.com
Wed Nov 11 00:12:16 CET 2009
Hello all,
Im using QFtp and errorString() to see if its an ftp repository is live, for
ex if errorString returns no error, the host is alive, else theres a problem
//check ftp vadility
>
> repoCheckFtp = new QFtp(this);
>
> connect(repoCheckFtp, SIGNAL(commandFinished(int, bool)),
>
> this, SLOT(repoCheckFtpCommandFinished(int, bool)));
>
> repoCheckFtp->connectToHost(newRepoLink); //where newRepoLink user added
> url
>
> repoCheckFtp->login();
>
//ftp command finished
>
> void getpackages::repoCheckFtpCommandFinished(int, bool error)
>
> {
>
>
> if (repoCheckFtp->currentCommand() == QFtp::ConnectToHost) {
>
> if (error) {
>
> //repository is not valid, return
>
> QMessageBox errorBox;
>
> errorBox.setText(repoCheckFtp->errorString());
>
> errorBox.exec();
>
> return;
>
> }
>
> }
>
I want to do the same with QHttp but for some reason i cant manage it, and
the docs didnt helped me alot
//check http repository vadility
>
> repoCheckHttp = new QHttp(this);
>
> connect(repoCheckHttp, SIGNAL(requestFinished(int,bool)),
>
> this, SLOT(repoCheckHttpCommandFinished(int, bool)));
>
> repoCheckHttp->setHost(newRepoLink, newRepoLink.port());
>
> //http command finished
>
> void getpackages::repoCheckHttpCommandFinished(int, bool error)
>
> {
>
>
> if (error) {
>
> //repository is not valid, return
>
> QMessageBox errorBox;
>
> errorBox.setText(repoCheckHttp->errorString());
>
> errorBox.exec();
>
> return;
>
> }
>
> }
>
Even though the program compiles ok, when add a false ftp url in
"newRepoLink" QUrl (e.x ftp://snjkfl.com) i didnt get the messagebox with
the errorString() like in my QFTP slot above.
Ive noticed that theres no "connectToHost" QFtp like method on QHttp.
Any help appreciatedm, thank you :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091111/ba85425b/attachment.html
More information about the Qt-interest-old
mailing list