projects
/
jenirok
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed search to retry automatically couple of times before failing.
[jenirok]
/
src
/
gui
/
resultwindow.cpp
diff --git
a/src/gui/resultwindow.cpp
b/src/gui/resultwindow.cpp
index
dc1509f
..
1bd7cb4
100644
(file)
--- a/
src/gui/resultwindow.cpp
+++ b/
src/gui/resultwindow.cpp
@@
-30,7
+30,7
@@
#include "sourcecoreconfig.h"
ResultWindow::ResultWindow(QWidget* parent): QMainWindow(parent),
#include "sourcecoreconfig.h"
ResultWindow::ResultWindow(QWidget* parent): QMainWindow(parent),
-source_(0), list_(0), connectionManager_(0), timer_(0), searching_(false)
+source_(0), list_(0), connectionManager_(0), timer_(0), searching_(false), retries_(0)
{
setAttribute(Qt::WA_Maemo5StackedWindow);
setWindowTitle(tr("Search results"));
{
setAttribute(Qt::WA_Maemo5StackedWindow);
setWindowTitle(tr("Search results"));
@@
-113,7
+113,9
@@
void ResultWindow::search(SearchDialog::SearchDetails& details)
list_->clear();
searching_ = true;
list_->clear();
searching_ = true;
- source_->search(Source::SearchDetails(details.name, details.location, details.type));
+ retries_ = 0;
+ currentSearch_ = Source::SearchDetails(details.name, details.location, details.type);
+ source_->search(currentSearch_);
}
}
@@
-165,6
+167,15
@@
void ResultWindow::requestFinished(QVector <Source::Result> const& results,
if(error)
{
if(error)
{
+ if(retries_ < RETRIES)
+ {
+ qDebug() << "Searching failed, retrying...";
+ retries_++;
+ list_->clear();
+ source_->search(currentSearch_);
+ return;
+ }
+
QString errorString;
Source::Error error = source_->error();
QString errorString;
Source::Error error = source_->error();
@@
-197,12
+208,6
@@
void ResultWindow::requestFinished(QVector <Source::Result> const& results,
setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
- if(timer_)
- {
- killTimer(timer_);
- }
-
- timer_ = startTimer(SEARCH_INTERVAL);
searching_ = false;
}
searching_ = false;
}