projects
/
dorian
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
19cf9a4
)
Handle some race conditions.
author
Akos Polster
<akos@pipacs.com>
Sun, 24 Oct 2010 23:16:46 +0000
(
01:16
+0200)
committer
Akos Polster
<akos@pipacs.com>
Sun, 24 Oct 2010 23:16:46 +0000
(
01:16
+0200)
search.cpp
patch
|
blob
|
history
diff --git
a/search.cpp
b/search.cpp
index
27e4ed2
..
3456670
100644
(file)
--- a/
search.cpp
+++ b/
search.cpp
@@
-70,18
+70,27
@@
bool Search::download(const Search::Result &result, const QString &fileName)
void Search::finished()
{
Trace t("Search::finished");
void Search::finished()
{
Trace t("Search::finished");
+
+ if (!reply) {
+ return;
+ }
+
QByteArray data = reply->readAll();
qDebug() << data;
QByteArray data = reply->readAll();
qDebug() << data;
+ // Parse search results
+
QWebPage page(this);
QWebFrame *frame = page.mainFrame();
frame->setHtml(QString(data));
QWebElementCollection tables = frame->findAllElements("table");
if (tables.count() == 1) {
QWebPage page(this);
QWebFrame *frame = page.mainFrame();
frame->setHtml(QString(data));
QWebElementCollection tables = frame->findAllElements("table");
if (tables.count() == 1) {
- qDebug() << "Found table";
QWebElement table = tables[0];
foreach (QWebElement row, table.findAll("tr")) {
QWebElementCollection cols = row.findAll("td");
QWebElement table = tables[0];
foreach (QWebElement row, table.findAll("tr")) {
QWebElementCollection cols = row.findAll("td");
+ if (cols.count() < 5) {
+ continue;
+ }
QString id = cols[0].toPlainText().trimmed();
if (id.isEmpty()) {
continue;
QString id = cols[0].toPlainText().trimmed();
if (id.isEmpty()) {
continue;
@@
-105,5
+114,6
@@
void Search::finished()
}
reply->deleteLater();
}
reply->deleteLater();
+ reply = 0;
emit endSearch();
}
emit endSearch();
}