QDBusConnection CallListener::systemBus_ = QDBusConnection::systemBus();
-CallListener::CallListener(): eniro_(0), contactManager_(0), box_(0), label_(0)
+CallListener::CallListener(): eniro_(0), contactManager_(0), box_(0), label_(0), retries_(-1)
{
}
else
{
showResult(tr("Searching..."));
+ retries_ = 0;
+ currentSearch_ = details;
eniro_->search(details);
}
if(error)
{
qDebug() << "Error: " << eniro_->errorString();
- message = tr("Search failed:") + " " + eniro_->errorString() + ".";
+
+ if(retries_ < NUMBER_OF_RETRIES && retries_ >= 0)
+ {
+ retries_++;
+ eniro_->search(currentSearch_);
+ return;
+ }
+ else
+ {
+ message = tr("Search failed:") + " " + eniro_->errorString() + ".";
+ }
}
else if(results.size() == 0)
{
Cache::instance().addItem(result);
}
+ retries_ = -1;
+
timedMessage_ = message;
// Show banner after small delay
~CallListener();
void begin();
void end();
- static const int REQUEST_TIMEOUT = 15000;
- static const int BANNER_DELAY = 350;
+ static const int REQUEST_TIMEOUT = 10000;
+ static const int BANNER_DELAY = 300;
+ static const int NUMBER_OF_RETRIES = 3;
private slots:
void requestFinished(QVector <Eniro::Result> const& results, Eniro::SearchDetails const& details, bool error);
InformationBox* box_;
QLabel* label_;
static QDBusConnection systemBus_;
+ int retries_;
+ Eniro::SearchDetails currentSearch_;
};
#endif // CALLLISTENER_H