static const QString INVALID_LOGIN_STRING = "Invalid login details";
static const QString TIMEOUT_STRING = "Request timed out";
static const QString PERSON_REGEXP = "<td class=\"hTd2\">(.*)<b>(.*)</td>";
- static const QString YELLOW_REGEXP = "<td class=\"hTd2\">(.*)<span class=\"gray\"\\}>(.*)</td>";
+ static const QString YELLOW_REGEXP = "<td class=\"hTd2\">(.*)<span class=\"gray\">(.*)</td>";
+ static const QString SINGLE_REGEXP = "<div class=\"header\">(.*)</div>(.*)<div class=\"callRow\">(.*)</div>";
static const QString NUMBER_REGEXP = "<div class=\"callRow\">(.*)</div>";
static const QString LOGIN_CHECK = "<input class=\"inpTxt\" id=\"loginformUsername\"";
}
default:
what = "moball";
+ break;
}
}
void Eniro::loadResults(int id, QString const& httpData)
{
searchMap::iterator it = pendingSearches_.find(id);
- QString expr;
-
- switch(it.value()->details.type)
- {
- case YELLOW_PAGES:
- expr = YELLOW_REGEXP;
- break;
- case PERSONS:
- expr = PERSON_REGEXP;
- break;
- default:
- return;
- }
- QRegExp rx(expr);
+ QRegExp rx("((" + YELLOW_REGEXP + ")|(" + PERSON_REGEXP + ")|(" + SINGLE_REGEXP + "))");
rx.setMinimal(true);
bool requestsPending = false;
{
pos += rx.matchedLength();
- data = rx.cap(2);
+ data = rx.cap(1);
+
data = stripTags(data);
QStringList rows = data.split('\n');
break;
case 3:
- result.name = rows[0];
- result.street = rows[1];
- result.city = rows[2];
+ if(isPhoneNumber(rows[1]))
+ {
+ result.name = rows[0];
+ result.number = cleanUpNumber(rows[1]);
+ result.city = rows[2];
+ }
+ else
+ {
+ result.name = rows[0];
+ result.street = rows[1];
+ result.city = rows[2];
+ }
break;
case 4: