X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fdaemon%2Fcalllistener.cpp;h=bdc6529ed930f2f54653e518ab34ff81ccc323b1;hb=7c78a6f936682395aa101b2429c118934bb0f1d8;hp=b4d80d474c4e9021eee039f6d44a681199d89cc8;hpb=311f8d8c00ac52bcb59c1f3aa8523f905584f1bf;p=jenirok diff --git a/src/daemon/calllistener.cpp b/src/daemon/calllistener.cpp index b4d80d4..bdc6529 100644 --- a/src/daemon/calllistener.cpp +++ b/src/daemon/calllistener.cpp @@ -43,7 +43,7 @@ QDBusConnection CallListener::systemBus_ = QDBusConnection::systemBus(); CallListener::CallListener(): source_(0), closeConnection_(false), initialized_(false), box_(0), label_(0), -retries_(-1), timer_(0), currentCall_(0) +retries_(-1), timer_(0), currentCall_(0), ignoreFirstZero_(false) { } @@ -68,6 +68,8 @@ bool CallListener::begin() sourceConfig_ = tmpConfig; delete config; + ignoreFirstZero_ = (Settings::instance()->get("ignore_first_zero") == "1"); + systemBus_.connect(CALL_SERVICE_NAME, CALL_SERVICE_PATH, CALL_SERVICE_INTERFACE, @@ -111,8 +113,6 @@ void CallListener::end() void CallListener::search(Source::SearchDetails const& details) { - qDebug() << "Search called"; - if(currentCall_) { delete currentCall_; @@ -150,8 +150,6 @@ void CallListener::search(Source::SearchDetails const& details) showDelayedResult(tr("Searching..."), BANNER_DELAY); - qDebug() << "Starting to search..."; - source_->search(details); } @@ -161,12 +159,14 @@ void CallListener::requestFinished(QVector const& results, Source::SearchDetails const& details, bool error) { - if(closeConnection_) + /*if(closeConnection_) { closeConnection_ = false; ConnectionManager cm; cm.disconnect(true); - } + }*/ + + qDebug() << "Request finished"; // If box is not visible, the call must have been terminated already if(!initialized_ || !box_->isVisible() || !currentCall_) @@ -273,6 +273,13 @@ void CallListener::incomingCall(QDBusObjectPath path, QString number) return; } + // If the call has come through some kind of switch board + // there might be a leading zero added + if(ignoreFirstZero_) + { + number = number.replace(QRegExp("^00"), "0"); + } + ContactManager cm; if(!cm.numberExists(number)) @@ -405,6 +412,14 @@ void CallListener::searchClose() if(closeConnection_) { + QTimer::singleShot(500, this, SLOT(closeConnection())); + } +} + +void CallListener::closeConnection() +{ + if(closeConnection_) + { closeConnection_ = false; ConnectionManager cm; cm.disconnect(true); @@ -422,6 +437,7 @@ bool CallListener::handleConnection() if(cm.isConnected()) { + cm.connect(); closeConnection_ = false; return true; } @@ -515,7 +531,7 @@ bool CallListener::handleConnection() return false; } - qDebug() << "Connecting to " << best.name; + qDebug() << "Connecting to " << best.name << " (" << best.id << ")"; if(cm.connect(best.id)) { @@ -533,7 +549,8 @@ bool CallListener::handleConnection() if(retries < CONNECT_RETRIES) { - sendRetrySignal(best.id, initialized_); + sendRetrySignal(best.id, false); + sleep(WAIT_BETWEEN_RETRIES); } } @@ -601,7 +618,7 @@ bool CallListener::is3g() void CallListener::sendRetrySignal(QString const& iap, bool retry) { - QDBusMessage msg = QDBusMessage::createSignal("/com/nokia/icd_ui", + QDBusMessage msg = QDBusMessage::createSignal("/com/nokia/icd_ui", "com.nokia.icd_ui", "retry");