+void Eniro::loadFinnishPersonResults(int id, QString const& httpData)
+{
+ searchMap::iterator it = pendingSearches_.find(id);
+
+ static QRegExp rx("<div id=\"hit_(.*)<p class=\"adLinks\">");
+ static QRegExp name("<a class=\"fn expand\" href=\"#\">(.*)</a>");
+ static QRegExp number("<!-- sphoneid(.*)-->(.*)<!--");
+ static QRegExp street("<span class=\"street-address\">(.*)</span>");
+ static QRegExp zipCode("<span class=\"postal-code\">(.*)</span>");
+ static QRegExp city("<span class=\"locality\">(.*)</span>");
+ rx.setMinimal(true);
+ name.setMinimal(true);
+ number.setMinimal(true);
+ street.setMinimal(true);
+ zipCode.setMinimal(true);
+ city.setMinimal(true);
+
+ int pos = 0;
+
+ unsigned int maxResults = getMaxResults();
+ unsigned int foundResults = 0;
+
+ while((pos = rx.indexIn(httpData, pos)) != -1)
+ {
+ pos += rx.matchedLength();
+
+ QString data = rx.cap(0);
+
+ Result result;
+
+ if(name.indexIn(data) != -1)
+ {
+ result.name = name.cap(1);
+ }
+ else
+ {
+ continue;
+ }
+
+ if(number.indexIn(data) != -1)
+ {
+ result.number = number.cap(2);
+ }
+
+ if(street.indexIn(data) != -1)
+ {
+ result.street = street.cap(1);
+ }
+
+ QString cityStr;
+
+ if(zipCode.indexIn(data) != -1)
+ {
+ cityStr = zipCode.cap(1) + " ";
+ }
+
+ if(city.indexIn(data) != -1)
+ {
+ cityStr += city.cap(1);
+ }
+
+ result.city = cityStr;
+
+ result.name = cleanUpString(result.name);
+ result.street = cleanUpString(result.street);
+ result.number = cleanUpNumber(result.number);
+ result.city = cleanUpString(result.city);
+ result.country = "Finland";
+
+ it.value()->results.push_back(result);
+ emit resultAvailable(result, it.value()->details);
+
+ foundResults++;
+
+ if(foundResults >= maxResults)
+ {
+ break;
+ }
+
+ }
+
+ emitRequestFinished(it.key(), it.value(), false);
+
+}
+
+QString& Eniro::cleanUpString(QString& str)
+{
+ str = htmlEntityDecode(str);
+ str = str.toLower();
+ str = str.trimmed();
+ static QRegExp cleaner("(\r\n|\n|\t| )+");
+ str = str.replace(cleaner, " ");
+ str = ucFirst(str);
+ return str;
+}
+