diff options
Diffstat (limited to 'klinkstatus/src/engine/linkchecker.cpp')
-rw-r--r-- | klinkstatus/src/engine/linkchecker.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/klinkstatus/src/engine/linkchecker.cpp b/klinkstatus/src/engine/linkchecker.cpp index 5667735d..bf54a59b 100644 --- a/klinkstatus/src/engine/linkchecker.cpp +++ b/klinkstatus/src/engine/linkchecker.cpp @@ -24,7 +24,7 @@ #include <tqstring.h> #include <tqtimer.h> -#include <textcodec.h> +#include <tqtextcodec.h> #include <tqcstring.h> #include <kio/netaccess.h> @@ -43,7 +43,7 @@ int LinkChecker::count_ = 0; -LinkChecker::LinkChecker(LinkStatus* linkstatus, int time_out, +LinkChecker::LinkChecker(LinktqStatus* linkstatus, int time_out, TQObject *parent, const char *name) : TQObject(parent, name), search_manager_(0), linkstatus_(linkstatus), t_job_(0), time_out_(time_out), checker_(0), document_charset_(), @@ -69,7 +69,7 @@ void LinkChecker::check() { Q_ASSERT(!finnished_); - KURL url(linkStatus()->absoluteUrl()); + KURL url(linktqStatus()->absoluteUrl()); Q_ASSERT(url.isValid()); if(url.hasRef()) { @@ -128,7 +128,7 @@ void LinkChecker::slotTimeOut() linkstatus_->setErrorOccurred(true); linkstatus_->setChecked(true); linkstatus_->setError(i18n("Timeout")); - linkstatus_->setStatus(LinkStatus::TIMEOUT); + linkstatus_->settqStatus(LinktqStatus::TIMEOUT); killJob(); finnish(); @@ -146,9 +146,9 @@ void LinkChecker::slotMimetype (KIO::Job* /*job*/, const TQString &type) Q_ASSERT(t_job_); - LinkStatus* ls = 0; + LinktqStatus* ls = 0; /* if(redirection_) - ls = linkStatus()->redirection(); + ls = linktqStatus()->redirection(); else*/ ls = linkstatus_; Q_ASSERT(ls); @@ -168,7 +168,7 @@ void LinkChecker::slotMimetype (KIO::Job* /*job*/, const TQString &type) if(!url.protocol().startsWith("http")) { ls->setStatusText("OK"); - ls->setStatus(LinkStatus::SUCCESSFULL); + ls->settqStatus(LinktqStatus::SUCCESSFULL); killJob(); finnish(); @@ -186,7 +186,7 @@ void LinkChecker::slotMimetype (KIO::Job* /*job*/, const TQString &type) { //kdDebug(23100) << "mimetype: " << type << endl; ls->setStatusText("OK"); - ls->setStatus(LinkStatus::SUCCESSFULL); + ls->settqStatus(LinktqStatus::SUCCESSFULL); killJob(); finnish(); @@ -206,9 +206,9 @@ void LinkChecker::slotData(KIO::Job* /*job*/, const TQByteArray& data) Q_ASSERT(t_job_); - LinkStatus* ls = 0; + LinktqStatus* ls = 0; /* if(redirection_) - ls = linkStatus()->redirection(); + ls = linktqStatus()->redirection(); else*/ ls = linkstatus_; Q_ASSERT(ls); @@ -235,7 +235,7 @@ void LinkChecker::slotData(KIO::Job* /*job*/, const TQByteArray& data) if(header_checked_) { killJob(); - linkstatus_->setStatus(getHttpStatus()); + linkstatus_->settqStatus(getHttptqStatus()); linkstatus_->setChecked(true); finnish(); return; @@ -253,7 +253,7 @@ void LinkChecker::slotData(KIO::Job* /*job*/, const TQByteArray& data) if(ls->mimeType() != "text/html" && header_checked_) { //kdDebug(23100) << "mimetype of " << ls->absoluteUrl().prettyURL() << ": " << ls->mimeType() << endl; - ls->setStatus(getHttpStatus()); + ls->settqStatus(getHttptqStatus()); killJob(); finnish(); // if finnish is called before kill what you get is a segfault, don't know why return; @@ -262,7 +262,7 @@ void LinkChecker::slotData(KIO::Job* /*job*/, const TQByteArray& data) { //kdDebug(23100) << "ERROR PAGE" << endl; ls->setIsErrorPage(true); - ls->setStatus(getHttpStatus()); + ls->settqStatus(getHttptqStatus()); killJob(); finnish(); return; @@ -339,9 +339,9 @@ void LinkChecker::slotResult(KIO::Job* /*job*/) return; } - LinkStatus* ls = 0; + LinktqStatus* ls = 0; if(redirection_) - ls = linkStatus()->redirection(); + ls = linktqStatus()->redirection(); else ls = linkstatus_; Q_ASSERT(ls); @@ -366,15 +366,15 @@ void LinkChecker::slotResult(KIO::Job* /*job*/) if(job->error() == KIO::ERR_IS_DIRECTORY) { ls->setStatusText("OK"); - ls->setStatus(LinkStatus::SUCCESSFULL); + ls->settqStatus(LinktqStatus::SUCCESSFULL); } else { ls->setErrorOccurred(true); if(job->error() == KIO::ERR_SERVER_TIMEOUT) - ls->setStatus(LinkStatus::TIMEOUT); + ls->settqStatus(LinktqStatus::TIMEOUT); else - ls->setStatus(LinkStatus::BROKEN); + ls->settqStatus(LinktqStatus::BROKEN); if(job->errorString().isEmpty()) kdWarning(23100) << "\n\nError string is empty, error = " << job->error() << "\n\n\n"; @@ -389,7 +389,7 @@ void LinkChecker::slotResult(KIO::Job* /*job*/) { if(!ls->absoluteUrl().protocol().startsWith("http")) { ls->setStatusText("OK"); - ls->setStatus(LinkStatus::SUCCESSFULL); + ls->settqStatus(LinktqStatus::SUCCESSFULL); } else { @@ -402,7 +402,7 @@ void LinkChecker::slotResult(KIO::Job* /*job*/) } Q_ASSERT(header_checked_); - ls->setStatus(getHttpStatus()); + ls->settqStatus(getHttptqStatus()); } if(!doc_html_.isNull() && !doc_html_.isEmpty()) @@ -449,10 +449,10 @@ bool LinkChecker::processRedirection(KURL const& toUrl) linkstatus_->setHttpHeader(getHttpHeader(t_job_, false)); linkstatus_->setIsRedirection(true); linkstatus_->setStatusText("redirection"); - linkstatus_->setStatus(LinkStatus::HTTP_REDIRECTION); + linkstatus_->settqStatus(LinktqStatus::HTTP_REDIRECTION); linkstatus_->setChecked(true); - LinkStatus* ls_red = new LinkStatus(*linkstatus_); + LinktqStatus* ls_red = new LinktqStatus(*linkstatus_); ls_red->setAbsoluteUrl(toUrl); ls_red->setRootUrl(linkstatus_->rootUrl()); @@ -534,23 +534,23 @@ HttpResponseHeader LinkChecker::getHttpHeader(KIO::Job* /*job*/, bool remember_c void LinkChecker::checkRef() { - KURL url(linkStatus()->absoluteUrl()); + KURL url(linktqStatus()->absoluteUrl()); Q_ASSERT(url.hasRef()); TQString ref = url.ref(); if(ref == "" || ref == "top") { linkstatus_->setStatusText("OK"); - linkstatus_->setStatus(LinkStatus::SUCCESSFULL); + linkstatus_->settqStatus(LinktqStatus::SUCCESSFULL); finnish(); return; } TQString url_base; - LinkStatus const* ls_parent = 0; + LinktqStatus const* ls_parent = 0; int i_ref = -1; - if(linkStatus()->originalUrl().startsWith("#")) - ls_parent = linkStatus()->parent(); + if(linktqStatus()->originalUrl().startsWith("#")) + ls_parent = linktqStatus()->parent(); else { @@ -560,7 +560,7 @@ void LinkChecker::checkRef() Q_ASSERT(search_manager_); - ls_parent = search_manager_->linkStatus(url_base); + ls_parent = search_manager_->linktqStatus(url_base); } if(ls_parent) @@ -603,22 +603,22 @@ void LinkChecker::checkRef(KURL const& url) search_manager_->addHtmlPart(url_string, html_part); } - if(hasAnchor(html_part, linkStatus()->absoluteUrl().ref())) + if(hasAnchor(html_part, linktqStatus()->absoluteUrl().ref())) { linkstatus_->setStatusText("OK"); - linkstatus_->setStatus(LinkStatus::SUCCESSFULL); + linkstatus_->settqStatus(LinktqStatus::SUCCESSFULL); } else { linkstatus_->setErrorOccurred(true); linkstatus_->setError(i18n( "Link destination not found." )); - linkstatus_->setStatus(LinkStatus::BROKEN); + linkstatus_->settqStatus(LinktqStatus::BROKEN); } finnish(); } -void LinkChecker::checkRef(LinkStatus const* linkstatus_parent) +void LinkChecker::checkRef(LinktqStatus const* linkstatus_parent) { Q_ASSERT(search_manager_); @@ -638,16 +638,16 @@ void LinkChecker::checkRef(LinkStatus const* linkstatus_parent) search_manager_->addHtmlPart(url_string, html_part); } - if(hasAnchor(html_part, linkStatus()->absoluteUrl().ref())) + if(hasAnchor(html_part, linktqStatus()->absoluteUrl().ref())) { linkstatus_->setStatusText("OK"); - linkstatus_->setStatus(LinkStatus::SUCCESSFULL); + linkstatus_->settqStatus(LinktqStatus::SUCCESSFULL); } else { linkstatus_->setErrorOccurred(true); linkstatus_->setError(i18n( "Link destination not found." )); - linkstatus_->setStatus(LinkStatus::BROKEN); + linkstatus_->settqStatus(LinktqStatus::BROKEN); } finnish(); @@ -684,20 +684,20 @@ void LinkChecker::killJob() aux->kill(true); // quietly } -LinkStatus::Status LinkChecker::getHttpStatus() const +LinktqStatus::tqStatus LinkChecker::getHttptqStatus() const { TQString status_code = TQString::number(linkstatus_->httpHeader().statusCode()); if(status_code[0] == '2') - return LinkStatus::SUCCESSFULL; + return LinktqStatus::SUCCESSFULL; else if(status_code[0] == '3') - return LinkStatus::HTTP_REDIRECTION; + return LinktqStatus::HTTP_REDIRECTION; else if(status_code[0] == '4') - return LinkStatus::HTTP_CLIENT_ERROR; + return LinktqStatus::HTTP_CLIENT_ERROR; else if(status_code[0] == '5') - return LinkStatus::HTTP_SERVER_ERROR; + return LinktqStatus::HTTP_SERVER_ERROR; else - return LinkStatus::UNDETERMINED; + return LinktqStatus::UNDETERMINED; } #include "linkchecker.moc" |