X-Git-Url: http://git.maemo.org/git/?p=jenirok;a=blobdiff_plain;f=src%2Fcommon%2Feniro.cpp;h=718064dce2f47f09501b2e59ea984affea1ba6a8;hp=edffeedb3695b6303a6bd5176fda8e9e63526d69;hb=HEAD;hpb=40f8e10e1efc5019011df940328cdc734576143d diff --git a/src/common/eniro.cpp b/src/common/eniro.cpp index edffeed..718064d 100644 --- a/src/common/eniro.cpp +++ b/src/common/eniro.cpp @@ -25,7 +25,7 @@ namespace { "http://wap.eniro.fi/", "http://wap.eniro.se/", - "http://wap.eniro.dk/" + "http://m.krak.dk/" }; static const QString SITE_NAMES[Eniro::SITE_COUNT] = @@ -45,7 +45,7 @@ namespace static const QString INVALID_LOGIN_STRING = "Invalid login details"; static const QString TIMEOUT_STRING = "Request timed out"; static const QString PERSON_REGEXP = "(.*)(.*)"; - static const QString YELLOW_REGEXP = "(.*)(.*)"; + static const QString YELLOW_REGEXP = "(.*)(.*)|(.*)(.*)"; static const QString SINGLE_REGEXP = "
(.*)
(.*)
(.*)(
|

(.*)
|

(.*)
)"; static const QString NUMBER_REGEXP = "
(.*)
"; static const QString LOGIN_CHECK = " 1) + { + what = "wp"; + } + else if(loggedIn_ || site_ != FI) { switch(type) { @@ -178,6 +184,8 @@ void Eniro::search(SearchDetails const& details) http_.setHost(url.host(), url.port(80)); int id = http_.get(url.encodedPath() + '?' + url.encodedQuery()); + //qDebug() << "Url: " << url.host() << url.encodedPath() << "?" << url.encodedQuery(); + QVector results; // Store search data for later identification @@ -279,6 +287,13 @@ void Eniro::loadResults(int id, QString const& httpData) { searchMap::iterator it = pendingSearches_.find(id); + // Finnish person search is not working in wap mode so we have to use different type of loading + if(getMaxResults() > 1 && loggedIn_ && site_ == FI && it.value()->details.type == PERSONS) + { + loadFinnishPersonResults(id, httpData); + return; + } + QRegExp rx("((" + YELLOW_REGEXP + ")|(" + PERSON_REGEXP + ")|(" + SINGLE_REGEXP + "))"); rx.setMinimal(true); @@ -415,6 +430,7 @@ void Eniro::loadResults(int id, QString const& httpData) // Otherwise result is ready else { + it.value()->foundNumbers++; emit resultAvailable(result, it.value()->details); } @@ -443,6 +459,102 @@ void Eniro::loadResults(int id, QString const& httpData) } } +void Eniro::loadFinnishPersonResults(int id, QString const& httpData) +{ + searchMap::iterator it = pendingSearches_.find(id); + + static QRegExp rx("
"); + static QRegExp name("(.*)"); + static QRegExp number("(.*)