summaryrefslogtreecommitdiffstats
path: root/klinkstatus/src/engine/linkchecker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'klinkstatus/src/engine/linkchecker.cpp')
-rw-r--r--klinkstatus/src/engine/linkchecker.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/klinkstatus/src/engine/linkchecker.cpp b/klinkstatus/src/engine/linkchecker.cpp
index bf54a59b..5667735d 100644
--- a/klinkstatus/src/engine/linkchecker.cpp
+++ b/klinkstatus/src/engine/linkchecker.cpp
@@ -24,7 +24,7 @@
#include <tqstring.h>
#include <tqtimer.h>
-#include <tqtextcodec.h>
+#include <textcodec.h>
#include <tqcstring.h>
#include <kio/netaccess.h>
@@ -43,7 +43,7 @@
int LinkChecker::count_ = 0;
-LinkChecker::LinkChecker(LinktqStatus* linkstatus, int time_out,
+LinkChecker::LinkChecker(LinkStatus* 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(linktqStatus()->absoluteUrl());
+ KURL url(linkStatus()->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_->settqStatus(LinktqStatus::TIMEOUT);
+ linkstatus_->setStatus(LinkStatus::TIMEOUT);
killJob();
finnish();
@@ -146,9 +146,9 @@ void LinkChecker::slotMimetype (KIO::Job* /*job*/, const TQString &type)
Q_ASSERT(t_job_);
- LinktqStatus* ls = 0;
+ LinkStatus* ls = 0;
/* if(redirection_)
- ls = linktqStatus()->redirection();
+ ls = linkStatus()->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->settqStatus(LinktqStatus::SUCCESSFULL);
+ ls->setStatus(LinkStatus::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->settqStatus(LinktqStatus::SUCCESSFULL);
+ ls->setStatus(LinkStatus::SUCCESSFULL);
killJob();
finnish();
@@ -206,9 +206,9 @@ void LinkChecker::slotData(KIO::Job* /*job*/, const TQByteArray& data)
Q_ASSERT(t_job_);
- LinktqStatus* ls = 0;
+ LinkStatus* ls = 0;
/* if(redirection_)
- ls = linktqStatus()->redirection();
+ ls = linkStatus()->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_->settqStatus(getHttptqStatus());
+ linkstatus_->setStatus(getHttpStatus());
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->settqStatus(getHttptqStatus());
+ ls->setStatus(getHttpStatus());
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->settqStatus(getHttptqStatus());
+ ls->setStatus(getHttpStatus());
killJob();
finnish();
return;
@@ -339,9 +339,9 @@ void LinkChecker::slotResult(KIO::Job* /*job*/)
return;
}
- LinktqStatus* ls = 0;
+ LinkStatus* ls = 0;
if(redirection_)
- ls = linktqStatus()->redirection();
+ ls = linkStatus()->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->settqStatus(LinktqStatus::SUCCESSFULL);
+ ls->setStatus(LinkStatus::SUCCESSFULL);
}
else
{
ls->setErrorOccurred(true);
if(job->error() == KIO::ERR_SERVER_TIMEOUT)
- ls->settqStatus(LinktqStatus::TIMEOUT);
+ ls->setStatus(LinkStatus::TIMEOUT);
else
- ls->settqStatus(LinktqStatus::BROKEN);
+ ls->setStatus(LinkStatus::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->settqStatus(LinktqStatus::SUCCESSFULL);
+ ls->setStatus(LinkStatus::SUCCESSFULL);
}
else
{
@@ -402,7 +402,7 @@ void LinkChecker::slotResult(KIO::Job* /*job*/)
}
Q_ASSERT(header_checked_);
- ls->settqStatus(getHttptqStatus());
+ ls->setStatus(getHttpStatus());
}
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_->settqStatus(LinktqStatus::HTTP_REDIRECTION);
+ linkstatus_->setStatus(LinkStatus::HTTP_REDIRECTION);
linkstatus_->setChecked(true);
- LinktqStatus* ls_red = new LinktqStatus(*linkstatus_);
+ LinkStatus* ls_red = new LinkStatus(*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(linktqStatus()->absoluteUrl());
+ KURL url(linkStatus()->absoluteUrl());
Q_ASSERT(url.hasRef());
TQString ref = url.ref();
if(ref == "" || ref == "top") {
linkstatus_->setStatusText("OK");
- linkstatus_->settqStatus(LinktqStatus::SUCCESSFULL);
+ linkstatus_->setStatus(LinkStatus::SUCCESSFULL);
finnish();
return;
}
TQString url_base;
- LinktqStatus const* ls_parent = 0;
+ LinkStatus const* ls_parent = 0;
int i_ref = -1;
- if(linktqStatus()->originalUrl().startsWith("#"))
- ls_parent = linktqStatus()->parent();
+ if(linkStatus()->originalUrl().startsWith("#"))
+ ls_parent = linkStatus()->parent();
else
{
@@ -560,7 +560,7 @@ void LinkChecker::checkRef()
Q_ASSERT(search_manager_);
- ls_parent = search_manager_->linktqStatus(url_base);
+ ls_parent = search_manager_->linkStatus(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, linktqStatus()->absoluteUrl().ref()))
+ if(hasAnchor(html_part, linkStatus()->absoluteUrl().ref()))
{
linkstatus_->setStatusText("OK");
- linkstatus_->settqStatus(LinktqStatus::SUCCESSFULL);
+ linkstatus_->setStatus(LinkStatus::SUCCESSFULL);
}
else
{
linkstatus_->setErrorOccurred(true);
linkstatus_->setError(i18n( "Link destination not found." ));
- linkstatus_->settqStatus(LinktqStatus::BROKEN);
+ linkstatus_->setStatus(LinkStatus::BROKEN);
}
finnish();
}
-void LinkChecker::checkRef(LinktqStatus const* linkstatus_parent)
+void LinkChecker::checkRef(LinkStatus const* linkstatus_parent)
{
Q_ASSERT(search_manager_);
@@ -638,16 +638,16 @@ void LinkChecker::checkRef(LinktqStatus const* linkstatus_parent)
search_manager_->addHtmlPart(url_string, html_part);
}
- if(hasAnchor(html_part, linktqStatus()->absoluteUrl().ref()))
+ if(hasAnchor(html_part, linkStatus()->absoluteUrl().ref()))
{
linkstatus_->setStatusText("OK");
- linkstatus_->settqStatus(LinktqStatus::SUCCESSFULL);
+ linkstatus_->setStatus(LinkStatus::SUCCESSFULL);
}
else
{
linkstatus_->setErrorOccurred(true);
linkstatus_->setError(i18n( "Link destination not found." ));
- linkstatus_->settqStatus(LinktqStatus::BROKEN);
+ linkstatus_->setStatus(LinkStatus::BROKEN);
}
finnish();
@@ -684,20 +684,20 @@ void LinkChecker::killJob()
aux->kill(true); // quietly
}
-LinktqStatus::tqStatus LinkChecker::getHttptqStatus() const
+LinkStatus::Status LinkChecker::getHttpStatus() const
{
TQString status_code = TQString::number(linkstatus_->httpHeader().statusCode());
if(status_code[0] == '2')
- return LinktqStatus::SUCCESSFULL;
+ return LinkStatus::SUCCESSFULL;
else if(status_code[0] == '3')
- return LinktqStatus::HTTP_REDIRECTION;
+ return LinkStatus::HTTP_REDIRECTION;
else if(status_code[0] == '4')
- return LinktqStatus::HTTP_CLIENT_ERROR;
+ return LinkStatus::HTTP_CLIENT_ERROR;
else if(status_code[0] == '5')
- return LinktqStatus::HTTP_SERVER_ERROR;
+ return LinkStatus::HTTP_SERVER_ERROR;
else
- return LinktqStatus::UNDETERMINED;
+ return LinkStatus::UNDETERMINED;
}
#include "linkchecker.moc"