summaryrefslogtreecommitdiffstats
path: root/klinkstatus/src/engine/searchmanager.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-16 19:02:47 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-16 19:02:47 +0000
commite985f7e545f4739493965aad69bbecb136dc9346 (patch)
tree54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /klinkstatus/src/engine/searchmanager.cpp
parentf7670c198945adc3b95ad69a959fe5f8ae55b493 (diff)
downloadtdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz
tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'klinkstatus/src/engine/searchmanager.cpp')
-rw-r--r--klinkstatus/src/engine/searchmanager.cpp96
1 files changed, 48 insertions, 48 deletions
diff --git a/klinkstatus/src/engine/searchmanager.cpp b/klinkstatus/src/engine/searchmanager.cpp
index c64c3a89..3a34d04c 100644
--- a/klinkstatus/src/engine/searchmanager.cpp
+++ b/klinkstatus/src/engine/searchmanager.cpp
@@ -37,8 +37,8 @@
SearchManager::SearchManager(int max_simultaneous_connections, int time_out,
- TQObject *parent, const char *name)
- : TQObject(parent, name),
+ TQObject *tqparent, const char *name)
+ : TQObject(tqparent, name),
max_simultaneous_connections_(max_simultaneous_connections), has_document_root_(false),
depth_(-1), current_depth_(0), external_domain_depth_(0),
current_node_(0), current_index_(0), links_being_checked_(0),
@@ -106,7 +106,7 @@ void SearchManager::cleanItems()
((search_results_[i])[j])[l] = 0;
}
else
- kdDebug(23100) << "LinkStatus NULL!!" << endl;
+ kdDebug(23100) << "LinktqStatus NULL!!" << endl;
}
search_results_[i][j].clear();
}
@@ -148,7 +148,7 @@ void SearchManager::startSearch(KURL const& root, SearchMode const& modo)
searching_ = true;
- //Q_ASSERT(domain_ != TQString::null);
+ //Q_ASSERT(domain_ != TQString());
checkRoot();
}
@@ -191,8 +191,8 @@ void SearchManager::checkRoot()
LinkChecker* checker = new LinkChecker(&root_, time_out_, this, "link_checker");
checker->setSearchManager(this);
- connect(checker, TQT_SIGNAL(transactionFinished(const LinkStatus *, LinkChecker *)),
- this, TQT_SLOT(slotRootChecked(const LinkStatus *, LinkChecker *)));
+ connect(checker, TQT_SIGNAL(transactionFinished(const LinktqStatus *, LinkChecker *)),
+ this, TQT_SLOT(slotRootChecked(const LinktqStatus *, LinkChecker *)));
/*
connect(checker, TQT_SIGNAL(jobFinnished(LinkChecker *)),
this, TQT_SLOT(slotLinkCheckerFinnished(LinkChecker *)));
@@ -200,11 +200,11 @@ void SearchManager::checkRoot()
checker->check();
}
-void SearchManager::slotRootChecked(const LinkStatus * link, LinkChecker * checker)
+void SearchManager::slotRootChecked(const LinktqStatus * link, LinkChecker * checker)
{
kdDebug(23100) << "SearchManager::slotRootChecked:" << endl;
kdDebug(23100) << link->absoluteUrl().url() << " -> " <<
- LinkStatus::lastRedirection(&root_)->absoluteUrl().url() << endl;
+ LinktqStatus::lastRedirection(&root_)->absoluteUrl().url() << endl;
Q_ASSERT(checked_links_ == 0);
Q_ASSERT(search_results_.size() == 0);
@@ -217,11 +217,11 @@ void SearchManager::slotRootChecked(const LinkStatus * link, LinkChecker * check
{
current_depth_ = 1;
- vector<LinkStatus*> no = children(LinkStatus::lastRedirection(&root_));
+ vector<LinktqStatus*> no = tqchildren(LinktqStatus::lastRedirection(&root_));
emit signalLinksToCheckTotalSteps(no.size());
- vector< vector<LinkStatus*> > nivel;
+ vector< vector<LinktqStatus*> > nivel;
nivel.push_back(no);
search_results_.push_back(nivel);
@@ -255,14 +255,14 @@ void SearchManager::slotRootChecked(const LinkStatus * link, LinkChecker * check
checker = 0;
}
-vector<LinkStatus*> SearchManager::children(LinkStatus* link)
+vector<LinktqStatus*> SearchManager::tqchildren(LinktqStatus* link)
{
- vector<LinkStatus*> children;
+ vector<LinktqStatus*> tqchildren;
if(!link || link->absoluteUrl().hasRef())
- return children;
+ return tqchildren;
- vector<Node*> const& nodes = link->childrenNodes();
+ vector<Node*> const& nodes = link->tqchildrenNodes();
int count = 0;
for(uint i = 0; i != nodes.size(); ++i)
@@ -278,12 +278,12 @@ vector<LinkStatus*> SearchManager::children(LinkStatus* link)
if( (node->isLink() &&
checkable(url, *link) &&
- !Url::existUrl(url, children) &&
+ !Url::existUrl(url, tqchildren) &&
!node->url().isEmpty())
||
node->malformed() )
{
- LinkStatus* ls = new LinkStatus(node, link);
+ LinktqStatus* ls = new LinktqStatus(node, link);
ls->setAbsoluteUrl(url);
if(localDomain(ls->absoluteUrl()))
@@ -310,7 +310,7 @@ vector<LinkStatus*> SearchManager::children(LinkStatus* link)
}
Q_ASSERT(link->externalDomainDepth() <= external_domain_depth_);
- children.push_back(ls);
+ tqchildren.push_back(ls);
}
if(count == 50)
{
@@ -319,7 +319,7 @@ vector<LinkStatus*> SearchManager::children(LinkStatus* link)
}
}
- return children;
+ return tqchildren;
}
bool SearchManager::existUrl(KURL const& url, KURL const& url_parent) const
@@ -331,7 +331,7 @@ bool SearchManager::existUrl(KURL const& url, KURL const& url_parent) const
for(uint j = 0; j != search_results_[i].size(); ++j)
for(uint l = 0; l != (search_results_[i])[j].size(); ++l)
{
- LinkStatus* tmp = search_results_[i][j][l];
+ LinktqStatus* tmp = search_results_[i][j][l];
Q_ASSERT(tmp);
if(tmp->absoluteUrl() == url)
{ // URL exists
@@ -352,7 +352,7 @@ bool SearchManager::existUrl(KURL const& url, KURL const& url_parent) const
return false;
}
-LinkStatus const* SearchManager::linkStatus(TQString const& s_url) const
+LinktqStatus const* SearchManager::linktqStatus(TQString const& s_url) const
{
Q_ASSERT(!s_url.isEmpty());
@@ -366,7 +366,7 @@ LinkStatus const* SearchManager::linkStatus(TQString const& s_url) const
{
++count;
- LinkStatus* ls = search_results_[i][j][l];
+ LinktqStatus* ls = search_results_[i][j][l];
Q_ASSERT(ls);
if(ls->absoluteUrl().url() == s_url && ls->checked())
return ls;
@@ -402,7 +402,7 @@ void SearchManager::continueSearch()
{
Q_ASSERT(!links_being_checked_);
- vector<LinkStatus*> const& no = nodeToAnalize();
+ vector<LinktqStatus*> const& no = nodeToAnalize();
if((uint)current_index_ < no.size())
checkVectorLinks(no);
@@ -442,7 +442,7 @@ void SearchManager::continueSearch()
}
}
-vector<LinkStatus*> const& SearchManager::nodeToAnalize() const
+vector<LinktqStatus*> const& SearchManager::nodeToAnalize() const
{
Q_ASSERT( (uint)current_depth_ == search_results_.size() );
Q_ASSERT( (uint)current_node_ < (search_results_[current_depth_ - 1]).size() );
@@ -450,14 +450,14 @@ vector<LinkStatus*> const& SearchManager::nodeToAnalize() const
return (search_results_[current_depth_ - 1])[current_node_];
}
-void SearchManager::checkVectorLinks(vector<LinkStatus*> const& links)
+void SearchManager::checkVectorLinks(vector<LinktqStatus*> const& links)
{
checkLinksSimultaneously(chooseLinks(links));
}
-vector<LinkStatus*> SearchManager::chooseLinks(vector<LinkStatus*> const& links)
+vector<LinktqStatus*> SearchManager::chooseLinks(vector<LinktqStatus*> const& links)
{
- vector<LinkStatus*> escolha;
+ vector<LinktqStatus*> escolha;
for(int i = 0; i != max_simultaneous_connections_; ++i)
{
if((uint)current_index_ < links.size())
@@ -466,7 +466,7 @@ vector<LinkStatus*> SearchManager::chooseLinks(vector<LinkStatus*> const& links)
return escolha;
}
-void SearchManager::checkLinksSimultaneously(vector<LinkStatus*> const& links)
+void SearchManager::checkLinksSimultaneously(vector<LinktqStatus*> const& links)
{
Q_ASSERT(finished_connections_ <= max_simultaneous_connections_);
finished_connections_ = 0;
@@ -480,7 +480,7 @@ void SearchManager::checkLinksSimultaneously(vector<LinkStatus*> const& links)
for(uint i = 0; i != links.size(); ++i)
{
- LinkStatus* ls(links[i]);
+ LinktqStatus* ls(links[i]);
Q_ASSERT(ls);
TQString protocol = ls->absoluteUrl().protocol();
@@ -491,19 +491,19 @@ void SearchManager::checkLinksSimultaneously(vector<LinkStatus*> const& links)
if(ls->malformed())
{
Q_ASSERT(ls->errorOccurred());
- Q_ASSERT(ls->status() == LinkStatus::MALFORMED);
+ Q_ASSERT(ls->status() == LinktqStatus::MALFORMED);
ls->setChecked(true);
slotLinkChecked(ls, 0);
}
- else if(ls->absoluteUrl().prettyURL().contains("javascript:", false))
+ else if(ls->absoluteUrl().prettyURL().tqcontains("javascript:", false))
{
++ignored_links_;
ls->setIgnored(true);
ls->setErrorOccurred(true);
ls->setError(i18n( "Javascript not supported" ));
- ls->setStatus(LinkStatus::NOT_SUPPORTED);
+ ls->settqStatus(LinktqStatus::NOT_SUPPORTED);
ls->setChecked(true);
slotLinkChecked(ls, 0);
}
@@ -513,8 +513,8 @@ void SearchManager::checkLinksSimultaneously(vector<LinkStatus*> const& links)
++ignored_links_;
ls->setIgnored(true);
ls->setErrorOccurred(true);
- ls->setError(i18n("Protocol %1 not supported").arg(protocol));
- ls->setStatus(LinkStatus::MALFORMED);
+ ls->setError(i18n("Protocol %1 not supported").tqarg(protocol));
+ ls->settqStatus(LinktqStatus::MALFORMED);
ls->setChecked(true);
slotLinkChecked(ls, 0);
}
@@ -524,8 +524,8 @@ void SearchManager::checkLinksSimultaneously(vector<LinkStatus*> const& links)
LinkChecker* checker = new LinkChecker(ls, time_out_, this, "link_checker");
checker->setSearchManager(this);
- connect(checker, TQT_SIGNAL(transactionFinished(const LinkStatus *, LinkChecker *)),
- this, TQT_SLOT(slotLinkChecked(const LinkStatus *, LinkChecker *)));
+ connect(checker, TQT_SIGNAL(transactionFinished(const LinktqStatus *, LinkChecker *)),
+ this, TQT_SLOT(slotLinkChecked(const LinktqStatus *, LinkChecker *)));
/*
connect(checker, TQT_SIGNAL(jobFinnished(LinkChecker *)),
this, TQT_SLOT(slotLinkCheckerFinnished(LinkChecker *)));
@@ -535,11 +535,11 @@ void SearchManager::checkLinksSimultaneously(vector<LinkStatus*> const& links)
}
}
-void SearchManager::slotLinkChecked(const LinkStatus * link, LinkChecker * checker)
+void SearchManager::slotLinkChecked(const LinktqStatus * link, LinkChecker * checker)
{
kdDebug(23100) << "SearchManager::slotLinkChecked:" << endl;
// kdDebug(23100) << link->absoluteUrl().url() << " -> " <<
-// LinkStatus::lastRedirection((const_cast<LinkStatus*> (link)))->absoluteUrl().url() << endl;
+// LinktqStatus::lastRedirection((const_cast<LinktqStatus*> (link)))->absoluteUrl().url() << endl;
Q_ASSERT(link);
emit signalLinkChecked(link, checker);
@@ -569,8 +569,8 @@ void SearchManager::slotLinkChecked(const LinkStatus * link, LinkChecker * check
void SearchManager::addLevel()
{
- search_results_.push_back(vector< vector <LinkStatus*> >());
- vector< vector <LinkStatus*> >& ultimo_nivel(search_results_[search_results_.size() - 2]);
+ search_results_.push_back(vector< vector <LinktqStatus*> >());
+ vector< vector <LinktqStatus*> >& ultimo_nivel(search_results_[search_results_.size() - 2]);
number_of_level_links_ = 0;
number_of_links_to_check_ = 0;
@@ -591,7 +591,7 @@ void SearchManager::addLevel()
uint end_sub1 = ultimo_nivel[i].size();
for(uint j = 0; j != end_sub1; ++j) // links
{
- vector <LinkStatus*> f(children( LinkStatus::lastRedirection(((ultimo_nivel[i])[j])) ));
+ vector <LinktqStatus*> f(tqchildren( LinktqStatus::lastRedirection(((ultimo_nivel[i])[j])) ));
if(f.size() != 0)
{
search_results_[search_results_.size() - 1].push_back(f);
@@ -608,7 +608,7 @@ void SearchManager::addLevel()
emit signalLinksToCheckTotalSteps(number_of_links_to_check_);
}
-bool SearchManager::checkable(KURL const& url, LinkStatus const& link_parent) const
+bool SearchManager::checkable(KURL const& url, LinktqStatus const& link_parent) const
{
if(existUrl(url, link_parent.absoluteUrl()))
return false;
@@ -618,7 +618,7 @@ bool SearchManager::checkable(KURL const& url, LinkStatus const& link_parent) co
if(!check_parent_dirs_)
{
- if(Url::parentDir(root_.absoluteUrl(), url))
+ if(Url::tqparentDir(root_.absoluteUrl(), url))
return false;
}
if(!check_external_links_)
@@ -638,7 +638,7 @@ bool SearchManager::checkable(KURL const& url, LinkStatus const& link_parent) co
return true;
}
-bool SearchManager::checkableByDomain(KURL const& url, LinkStatus const& link_parent) const
+bool SearchManager::checkableByDomain(KURL const& url, LinktqStatus const& link_parent) const
{
bool result = false;
if(localDomain(url))
@@ -749,7 +749,7 @@ bool SearchManager::generalDomain() const
if(!check_parent_dirs_)
return false;
- int barra = domain_.find('/');
+ int barra = domain_.tqfind('/');
if(barra != -1 && (uint)barra != domain_.length() - 1)
{
kdDebug(23100) << "Domain nao vago" << endl;
@@ -781,7 +781,7 @@ bool SearchManager::generalDomain() const
}
}
-bool SearchManager::onlyCheckHeader(LinkStatus* ls) const
+bool SearchManager::onlyCheckHeader(LinktqStatus* ls) const
{
if(search_mode_ == depth)
return current_depth_ == depth_;
@@ -805,7 +805,7 @@ void SearchManager::slotLinkCheckerFinnished(LinkChecker * checker)
kdDebug(23100) << "deleting linkchecker" << endl;
Q_ASSERT(checker);
- //Q_ASSERT(checker->linkStatus()->checked());
+ //Q_ASSERT(checker->linktqStatus()->checked());
delete checker;
checker = 0;
@@ -813,7 +813,7 @@ void SearchManager::slotLinkCheckerFinnished(LinkChecker * checker)
KHTMLPart* SearchManager::htmlPart(TQString const& key_url) const
{
- if(!html_parts_.contains(key_url))
+ if(!html_parts_.tqcontains(key_url))
return 0;
return html_parts_[key_url];
@@ -891,7 +891,7 @@ void SearchManager::save(TQDomElement& element) const
{
for(uint l = 0; l != (search_results_[i])[j].size(); ++l)
{
- LinkStatus* ls = ((search_results_[i])[j])[l];
+ LinktqStatus* ls = ((search_results_[i])[j])[l];
if(ls->checked())
ls->save(child_element);
}