CallListener::~CallListener()
{
end();
+ DB::removeDatabase();
}
bool CallListener::begin()
Source::SearchDetails const& details,
bool error)
{
+ if(closeConnection_)
+ {
+ closeConnection_ = false;
+ ConnectionManager cm;
+ cm.disconnect(true);
+ }
+
// If box is not visible, the call must have been terminated already
if(!initialized_ || !box_->isVisible())
{
retries_ = -1;
currentSearch_ = "";
-
- if(closeConnection_)
- {
- closeConnection_ = false;
- ConnectionManager cm;
- cm.disconnect(true);
- }
}
QString CallListener::createResult(QString const& name, QString const& street, QString const& city)
box_->hide();
}
- if(closeConnection_)
- {
- closeConnection_ = false;
- ConnectionManager cm;
- cm.disconnect(true);
- }
-
searchClose();
}
void CallListener::searchClose()
{
+ if(!initialized_)
+ {
+ return;
+ }
+
initialized_ = false;
qDebug() << "Closing search...";
delete box_;
box_ = 0;
label_ = 0;
+
+ if(closeConnection_)
+ {
+ closeConnection_ = false;
+ ConnectionManager cm;
+ cm.disconnect(true);
+ }
}
bool CallListener::handleConnection()
bool found = false;
int maxScans = GPRS_SCANS;
- if(lookupType == ConnectionManager::WLAN)
+ if(lookupType != ConnectionManager::GPRS)
{
maxScans = WLAN_SCANS;
}
return false;
}
- sleep(WAIT_BETWEEN_RETRIES);
+ retries++;
qDebug() << "Unable to connect, retrying...";
- retries++;
+
+ if(retries < CONNECT_RETRIES)
+ {
+ sendRetrySignal(best.id, initialized_);
+ }
}
- if(initialized_ && retries >= CONNECT_RETRIES)
+ if(retries >= CONNECT_RETRIES)
{
- showError(tr("Unable to connect to network."));
+ sendRetrySignal(best.id, false);
+
+ if(initialized_)
+ {
+ showError(tr("Unable to connect to network."));
+ }
+
return false;
}
uint status = rep.arguments().value(6).toUInt();
- if(status & 0x10) // 3.5G (HSUPA)
- {
- return true;
- }
- else if(status & 0x08) // 3G (HSDPA)
+ if(status & 0x10 || status & 0x08)
{
return true;
}
- // Something else
return false;
}
+void CallListener::sendRetrySignal(QString const& iap, bool retry)
+{
+ QDBusMessage msg = QDBusMessage::createSignal("/com/nokia/icd_ui",
+ "com.nokia.icd_ui",
+ "retry");
+
+ QList<QVariant> arguments;
+ arguments.append(QVariant(iap));
+ arguments.append(QVariant(retry));
+ msg.setArguments(arguments);
+
+ QDBusConnection::systemBus().send(msg);
+
+ qDebug() << "Retry signal sent";
+}
+
void CallListener::timerEvent(QTimerEvent* event)
{
Q_UNUSED(event);