|(.*)
|(.*)
)";
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
@@ -201,6 +209,13 @@ void Eniro::handleHttpData(int id, QByteArray const& data)
if((searchIt = pendingSearches_.find(id)) !=
pendingSearches_.end())
{
+ if(data.isEmpty())
+ {
+ setError(CONNECTION_FAILURE, "Server returned empty data");
+ emitRequestFinished(id, searchIt.value(), true);
+ return;
+ }
+
// Load results from html data
loadResults(id, data);
}
@@ -209,6 +224,13 @@ void Eniro::handleHttpData(int id, QByteArray const& data)
else if((numberIt = pendingNumberRequests_.find(id)) !=
pendingNumberRequests_.end())
{
+ if(data.isEmpty())
+ {
+ setError(CONNECTION_FAILURE, "Server returned empty data");
+ emitRequestFinished(id, searchIt.value(), true);
+ return;
+ }
+
// Load number from html data
loadNumber(id, data);
}
@@ -257,7 +279,6 @@ void Eniro::handleHttpError(int id)
pendingLoginRequests_.end())
{
emit loginStatus(false);
-
}
}
@@ -266,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);
@@ -430,6 +458,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("(.*)