icd2interface_->call(ICD_DBUS_API_CONNECT_REQ, QVariant(flags));
waitSignal(&connectionReady_);
+
+ if(connected_)
+ {
+ sleep(WAIT_AFTER_CONNECT);
+ }
+
return connected_;
}
connected_ = true;
+ sleep(WAIT_AFTER_CONNECT);
+
return true;
}
{
if(force)
{
- // Do not allow forced disconnection if connection was not started
- // by this class.
- if(!connected_)
- {
- return false;
- }
-
QDBusMessage msg = QDBusMessage::createSignal("/com/nokia/icd_ui",
"com.nokia.icd_ui",
"disconnect");
{
if(status == ICD_SCAN_NEW)
{
- connections_->insert(i, connection);
+ connections_->replace(i, connection);
}
return;
killTimer(timer_);
+ if(timeout_)
+ {
+ qDebug() << "Connection request timed out";
+ }
+
return *ready || !timeout_;
}
+void ConnectionManager::sleep(unsigned int ms)
+{
+ timeout_ = false;
+ timer_ = startTimer(ms);
+
+ while(!timeout_)
+ {
+ QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
+ }
+
+ killTimer(timer_);
+}
+
void ConnectionManager::timerEvent(QTimerEvent* event)
{
Q_UNUSED(event);
killTimer(timer_);
timeout_ = true;
timer_ = 0;
-
- qDebug() << "Connection request timed out";
}