diff --git a/src/call.cpp b/src/call.cpp index 2cee894ea843b5c2a3c554d13faa66e423a398fe..90046b021605fcd062ad949e49a6adc8c86937e6 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -518,12 +518,9 @@ Call* Call::buildHistoryCall(const QMap<QString,QString>& hc) //Try to assiciate a contact now, the real contact object is probably not //loaded yet, but we can get a placeholder for now -// const QString& contactUsed = hc[ Call::HistoryMapFields::CONTACT_USED ]; //TODO - const QString& contactUid = hc[ Call::HistoryMapFields::CONTACT_UID ]; - - + const QString& contactUid = hc[ Call::HistoryMapFields::CONTACT_UID ]; Person* ct = nullptr; - if (!hc[ Call::HistoryMapFields::CONTACT_UID].isEmpty()) + if (!contactUid.isEmpty()) ct = PersonModel::instance()->getPlaceHolder(contactUid.toLatin1()); Account* acc = AccountModel::instance()->getById(accId); @@ -792,7 +789,9 @@ FlagPack<Call::HoldFlags> Call::holdFlags() const ///Generate an human readable string from the difference between StartTimeStamp and StopTimeStamp (or 'now') QString Call::length() const { - if (d_ptr->m_pStartTimeStamp == d_ptr->m_pStopTimeStamp) return QString(); //Invalid + if (d_ptr->m_pStartTimeStamp == d_ptr->m_pStopTimeStamp) + return QString(); //Invalid + int nsec =0; if (d_ptr->m_pStopTimeStamp) nsec = stopTimeStamp() - startTimeStamp();//If the call is over @@ -1552,7 +1551,6 @@ void CallPrivate::cancel() CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "Canceling call. callId : " << q_ptr << "ConfId:" << q_ptr; emit q_ptr->dialNumberChanged(QString()); -// Q_NOREPLY callManager.hangUp(m_DringId); if (!callManager.hangUp(m_DringId)) { qWarning() << "HangUp failed, the call was probably already over"; changeCurrentState(Call::State::OVER); diff --git a/src/callmodel.cpp b/src/callmodel.cpp index 49a0bda54a33c8a5349ba1dca12a9cb6b8409ae1..e23bde525f8ae3797a49a5cb06e575bfd57445b0 100644 --- a/src/callmodel.cpp +++ b/src/callmodel.cpp @@ -573,8 +573,8 @@ void CallModelPrivate::removeCall(Call* call, bool noEmit) return; } - if (m_shInternalMapping[call] != nullptr) { - removeInternal(m_shInternalMapping[call]); + if (internal != nullptr) { + removeInternal(internal); //NOTE Do not free the memory, it can still be used elsewhere or in modelindexes } @@ -583,8 +583,6 @@ void CallModelPrivate::removeCall(Call* call, bool noEmit) m_shDringId.remove(m_shDringId.key(internal)); } - removeInternal(internal); - //Restore calls to the main list if they are not really over if (internal->m_lChildren.size()) { foreach(InternalStruct* child,internal->m_lChildren) {