diff --git a/src/call.cpp b/src/call.cpp index e7d08540f1104a2cbf7b52bf5312f3f77143fb0b..7c9472f8d06b5d63afed6e433284955047cdd279 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -191,11 +191,11 @@ QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::Action& c) ///Constructor Call::Call(Call::State startState, const QString& callId, const QString& peerName, PhoneNumber* number, Account* account) - : QObject(CallModel::instance()), m_isConference(false),m_pStopTimeStamp(0), + : QObject(CallModel::instance()),m_pStopTimeStamp(0), m_pImModel(nullptr),m_pTimer(nullptr),m_Recording(false),m_Account(nullptr), m_PeerName(peerName),m_pPeerPhoneNumber(number),m_HistoryConst(HistoryTimeCategoryModel::HistoryConst::Never), m_CallId(callId),m_CurrentState(startState),m_pStartTimeStamp(0),m_pDialNumber(nullptr),m_pTransferNumber(nullptr), - m_History(false),m_Missed(false),m_Direction(Call::Direction::OUTGOING),m_pBackend(nullptr) + m_History(false),m_Missed(false),m_Direction(Call::Direction::OUTGOING),m_pBackend(nullptr),m_Type(Call::Type::CALL) { m_Account = account; Q_ASSERT(!callId.isEmpty()); @@ -218,23 +218,23 @@ Call::~Call() ///Constructor Call::Call(const QString& confId, const QString& account): QObject(CallModel::instance()), - m_pStopTimeStamp(0),m_pStartTimeStamp(0),m_pImModel(nullptr),m_ConfId(confId), + m_pStopTimeStamp(0),m_pStartTimeStamp(0),m_pImModel(nullptr), m_Account(AccountListModel::instance()->getAccountById(account)),m_CurrentState(Call::State::CONFERENCE), - m_pTimer(nullptr), m_isConference(false),m_pPeerPhoneNumber(nullptr),m_pDialNumber(nullptr),m_pTransferNumber(nullptr), + m_pTimer(nullptr),m_pPeerPhoneNumber(nullptr),m_pDialNumber(nullptr),m_pTransferNumber(nullptr), m_HistoryConst(HistoryTimeCategoryModel::HistoryConst::Never),m_History(false),m_Missed(false), - m_Direction(Call::Direction::OUTGOING),m_pBackend(nullptr) + m_Direction(Call::Direction::OUTGOING),m_pBackend(nullptr), m_CallId(confId), + m_Type((!confId.isEmpty())?Call::Type::CONFERENCE:Call::Type::CALL) { setObjectName("Conf:"+confId); - m_isConference = !m_ConfId.isEmpty(); m_pUserActionModel = new UserActionModel(this); - if (m_isConference) { + if (type() == Call::Type::CONFERENCE) { time_t curTime; ::time(&curTime); setStartTimeStamp(curTime); initTimer(); CallManagerInterface& callManager = DBus::CallManager::instance(); - MapStringString details = callManager.getConferenceDetails(m_ConfId) ; + MapStringString details = callManager.getConferenceDetails(id()) ; m_CurrentState = confStatetoCallState(details[ConfDetailsMapFields::CONF_STATE]); emit stateChanged(); } @@ -435,9 +435,9 @@ Call::State Call::startStateFromDaemonCallState(const QString& daemonCallState, return Call::State::HOLD ; else if(daemonCallState == Call::DaemonStateInit::BUSY ) return Call::State::BUSY ; - else if(daemonCallState == Call::DaemonStateInit::INACTIVE && daemonCallType == Call::CallType::INCOMING ) + else if(daemonCallState == Call::DaemonStateInit::INACTIVE && daemonCallType == Call::CallDirection::INCOMING ) return Call::State::INCOMING ; - else if(daemonCallState == Call::DaemonStateInit::INACTIVE && daemonCallType == Call::CallType::OUTGOING ) + else if(daemonCallState == Call::DaemonStateInit::INACTIVE && daemonCallType == Call::CallDirection::OUTGOING ) return Call::State::RINGING ; else if(daemonCallState == Call::DaemonStateInit::INCOMING ) return Call::State::INCOMING ; @@ -599,7 +599,7 @@ const QString Call::peerName() const ///Generate the best possible peer name const QString Call::formattedName() const { - if (isConference()) + if (type() == Call::Type::CONFERENCE) return tr("Conference"); else if (!peerPhoneNumber()) return "Error"; @@ -657,6 +657,12 @@ Call::Direction Call::direction() const return m_Direction; } +///Is the call a conference or something else +Call::Type Call::type() const +{ + return m_Type; +} + ///Return the backend used to serialize this call AbstractHistoryBackend* Call::backend() const { @@ -699,18 +705,6 @@ Account* Call::account() const return m_Account; } -///Is this call a conference -bool Call::isConference() const -{ - return m_isConference; -} - -///Get the conference ID -const QString Call::confId() const -{ - return m_ConfId; -} - ///Get the recording path const QString Call::recordingPath() const { @@ -761,12 +755,6 @@ void Call::setTransferNumber(const QString& number) m_pTransferNumber->setUri(number); } -///This call is a conference -void Call::setConference(bool value) -{ - m_isConference = value; -} - ///Set the call number void Call::setDialNumber(const QString& number) { @@ -799,12 +787,6 @@ void Call::setDialNumber(const PhoneNumber* number) emit changed(this); } -///Set the conference ID -void Call::setConfId(const QString& value) -{ - m_ConfId = value; -} - ///Set the recording path void Call::setRecordingPath(const QString& path) { @@ -845,7 +827,7 @@ void Call::setBackend(AbstractHistoryBackend* backend) Call::State Call::stateChanged(const QString& newStateName) { const Call::State previousState = m_CurrentState; - if (!m_isConference) { + if (type() != Call::Type::CONFERENCE) { Call::DaemonState dcs = toDaemonCallState(newStateName); if (dcs == Call::DaemonState::__COUNT || m_CurrentState == Call::State::__COUNT) { qDebug() << "Error: Invalid state change"; @@ -1008,7 +990,7 @@ void Call::setStartTimeStamp(time_t stamp) void Call::sendTextMessage(const QString& message) { CallManagerInterface& callManager = DBus::CallManager::instance(); - Q_NOREPLY callManager.sendTextMessage(isConference()?m_ConfId:m_CallId,message); + Q_NOREPLY callManager.sendTextMessage(m_CallId,message); if (!m_pImModel) { m_pImModel = InstantMessagingModelManager::instance()->getModel(this); } @@ -1046,7 +1028,7 @@ void Call::accept() Q_ASSERT_IS_IN_PROGRESS CallManagerInterface & callManager = DBus::CallManager::instance(); - qDebug() << "Accepting call. callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Accepting call. callId : " << m_CallId << "ConfId:" << id(); Q_NOREPLY callManager.accept(m_CallId); time_t curTime; ::time(&curTime); @@ -1059,7 +1041,7 @@ void Call::accept() void Call::refuse() { CallManagerInterface & callManager = DBus::CallManager::instance(); - qDebug() << "Refusing call. callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Refusing call. callId : " << m_CallId << "ConfId:" << id(); const bool ret = callManager.refuse(m_CallId); time_t curTime; ::time(&curTime); @@ -1082,7 +1064,7 @@ void Call::acceptTransf() return; } CallManagerInterface & callManager = DBus::CallManager::instance(); - qDebug() << "Accepting call and transferring it to number : " << m_pTransferNumber->uri() << ". callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Accepting call and transferring it to number : " << m_pTransferNumber->uri() << ". callId : " << m_CallId << "ConfId:" << id(); callManager.accept(m_CallId); Q_NOREPLY callManager.transfer(m_CallId, m_pTransferNumber->uri()); } @@ -1093,7 +1075,7 @@ void Call::acceptHold() Q_ASSERT_IS_IN_PROGRESS CallManagerInterface & callManager = DBus::CallManager::instance(); - qDebug() << "Accepting call and holding it. callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Accepting call and holding it. callId : " << m_CallId << "ConfId:" << id(); callManager.accept(m_CallId); Q_NOREPLY callManager.hold(m_CallId); this->m_HistoryState = LegacyHistoryState::INCOMING; @@ -1109,15 +1091,15 @@ void Call::hangUp() time_t curTime; ::time(&curTime); m_pStopTimeStamp = curTime; - qDebug() << "Hanging up call. callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Hanging up call. callId : " << m_CallId << "ConfId:" << id(); bool ret; if (videoRenderer()) { //TODO remove, cheap hack videoRenderer()->stopRendering(); } - if (!isConference()) + if (type() != Call::Type::CONFERENCE) ret = callManager.hangUp(m_CallId); else - ret = callManager.hangUpConference(m_ConfId); + ret = callManager.hangUpConference(id()); if (!ret) { //Can happen if the daemon crash and open again qDebug() << "Error: Invalid call, the daemon may have crashed"; changeCurrentState(Call::State::OVER); @@ -1142,7 +1124,7 @@ void Call::cancel() { //This one can be over if the peer server failed to comply with the correct sequence CallManagerInterface & callManager = DBus::CallManager::instance(); - qDebug() << "Canceling call. callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Canceling call. callId : " << m_CallId << "ConfId:" << id(); emit dialNumberChanged(QString()); // Q_NOREPLY callManager.hangUp(m_CallId); if (!callManager.hangUp(m_CallId)) { @@ -1157,11 +1139,11 @@ void Call::hold() Q_ASSERT_IS_IN_PROGRESS CallManagerInterface & callManager = DBus::CallManager::instance(); - qDebug() << "Holding call. callId : " << m_CallId << "ConfId:" << m_ConfId; - if (!isConference()) + qDebug() << "Holding call. callId : " << m_CallId << "ConfId:" << id(); + if (type() != Call::Type::CONFERENCE) Q_NOREPLY callManager.hold(m_CallId); else - Q_NOREPLY callManager.holdConference(m_ConfId); + Q_NOREPLY callManager.holdConference(id()); } ///Start the call @@ -1192,7 +1174,7 @@ void Call::call() } //Normal case else if(m_Account) { - qDebug() << "Calling " << peerPhoneNumber()->uri() << " with account " << m_Account << ". callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Calling " << peerPhoneNumber()->uri() << " with account " << m_Account << ". callId : " << m_CallId << "ConfId:" << id(); callManager.placeCall(m_Account->id(), m_CallId, m_pDialNumber->uri()); this->m_pPeerPhoneNumber = PhoneDirectoryModel::instance()->getNumber(m_pDialNumber->uri(),account()); if (ContactModel::instance()->hasBackends()) { @@ -1215,7 +1197,7 @@ void Call::call() } else { qDebug() << "Trying to call " << (m_pTransferNumber?m_pTransferNumber->uri():"ERROR") - << " with no account registered . callId : " << m_CallId << "ConfId:" << m_ConfId; + << " with no account registered . callId : " << m_CallId << "ConfId:" << id(); this->m_HistoryState = LegacyHistoryState::NONE; throw tr("No account registered!"); } @@ -1242,25 +1224,25 @@ void Call::unhold() Q_ASSERT_IS_IN_PROGRESS CallManagerInterface & callManager = DBus::CallManager::instance(); - qDebug() << "Unholding call. callId : " << m_CallId << "ConfId:" << m_ConfId; - if (!isConference()) + qDebug() << "Unholding call. callId : " << m_CallId << "ConfId:" << id(); + if (type() != Call::Type::CONFERENCE) Q_NOREPLY callManager.unhold(m_CallId); else - Q_NOREPLY callManager.unholdConference(m_ConfId); + Q_NOREPLY callManager.unholdConference(id()); } ///Record the call void Call::setRecord() { CallManagerInterface & callManager = DBus::CallManager::instance(); - qDebug() << "Setting record " << !m_Recording << " for call. callId : " << m_CallId << "ConfId:" << m_ConfId; - callManager.toggleRecording((!m_isConference)?m_CallId:m_ConfId); + qDebug() << "Setting record " << !m_Recording << " for call. callId : " << m_CallId << "ConfId:" << id(); + callManager.toggleRecording(id()); } ///Start the timer void Call::start() { - qDebug() << "Starting call. callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Starting call. callId : " << m_CallId << "ConfId:" << id(); time_t curTime; ::time(&curTime); emit changed(); @@ -1277,7 +1259,7 @@ void Call::start() ///Toggle the timer void Call::startStop() { - qDebug() << "Starting and stoping call. callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Starting and stoping call. callId : " << m_CallId << "ConfId:" << id(); time_t curTime; ::time(&curTime); setStartTimeStamp(curTime); @@ -1287,7 +1269,7 @@ void Call::startStop() ///Stop the timer void Call::stop() { - qDebug() << "Stoping call. callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Stoping call. callId : " << m_CallId << "ConfId:" << id(); if (videoRenderer()) { //TODO remove, cheap hack videoRenderer()->stopRendering(); } @@ -1299,7 +1281,7 @@ void Call::stop() ///Handle error instead of crashing void Call::startWeird() { - qDebug() << "Starting call. callId : " << m_CallId << "ConfId:" << m_ConfId; + qDebug() << "Starting call. callId : " << m_CallId << "ConfId:" << id(); time_t curTime; ::time(&curTime); setStartTimeStamp(curTime); @@ -1548,7 +1530,7 @@ QVariant Call::roleData(int role) const switch (role) { case Call::Role::Name: case Qt::DisplayRole: - if (isConference()) + if (type() == Call::Type::CONFERENCE) return tr("Conference"); else if (state() == Call::State::DIALING) return dialNumber(); @@ -1608,9 +1590,6 @@ QVariant Call::roleData(int role) const case Call::Role::Organisation: return ct?ct->organization():QVariant(); break; - case Call::Role::IsConference: - return isConference(); - break; case Call::Role::Object: return QVariant::fromValue(const_cast<Call*>(this)); break; @@ -1624,7 +1603,7 @@ QVariant Call::roleData(int role) const return static_cast<int>(state()); //TODO Qt5, use the Q_ENUM break; case Call::Role::Id: - return ((m_isConference)?confId():id()); + return id(); break; case Call::Role::StartTime: return (int) m_pStartTimeStamp; diff --git a/src/call.h b/src/call.h index 3f5681e29bc9c4d9dee88e0e2a8d605109907781..8903127095d32b07c26df85771a136a539f344fb 100644 --- a/src/call.h +++ b/src/call.h @@ -94,7 +94,6 @@ public: Department = 112, Email = 113, Organisation = 114, - IsConference = 116, Object = 117, PhotoPtr = 118, CallState = 119, @@ -235,12 +234,19 @@ public: }; ///If the call is incoming or outgoing - class CallType { + class CallDirection { public: constexpr static const char* INCOMING = "0"; constexpr static const char* OUTGOING = "1"; }; + ///Is the call between one or more participants + enum class Type { + CALL , /** A simple call */ + CONFERENCE, /** A composition of other calls */ + HISTORY , /** A call from a previous session */ + }; + /** @enum Call::DaemonState * This enum have all the states a call can take for the daemon. */ @@ -286,8 +292,6 @@ public: Q_PROPERTY( uint stopTimeStamp READ stopTimeStamp ) Q_PROPERTY( uint startTimeStamp READ startTimeStamp ) Q_PROPERTY( bool isSecure READ isSecure ) - Q_PROPERTY( bool isConference READ isConference ) - Q_PROPERTY( QString confId READ confId ) Q_PROPERTY( VideoRenderer* videoRenderer READ videoRenderer ) Q_PROPERTY( QString formattedName READ formattedName ) Q_PROPERTY( QString length READ length ) @@ -332,8 +336,6 @@ public: time_t stopTimeStamp () const; time_t startTimeStamp () const; bool isSecure () const; - bool isConference () const; - const QString confId () const; const QString transferNumber () const; const QString dialNumber () const; const QString recordingPath () const; @@ -350,14 +352,13 @@ public: AbstractHistoryBackend* backend () const; bool hasVideo () const; Call::LifeCycleState lifeCycleState () const; + Call::Type type () const; //Automated function Call::State stateChanged(const QString & newState); Call::State performAction(Call::Action action); //Setters - void setConference ( bool value ); - void setConfId ( const QString& value ); void setTransferNumber ( const QString& number ); void setDialNumber ( const QString& number ); void setDialNumber ( const PhoneNumber* number ); @@ -380,7 +381,6 @@ private: //Attributes Account* m_Account ; QString m_CallId ; - QString m_ConfId ; PhoneNumber* m_pPeerPhoneNumber; QString m_PeerName ; QString m_RecordingPath ; @@ -389,7 +389,6 @@ private: time_t m_pStopTimeStamp ; TemporaryPhoneNumber* m_pTransferNumber ; TemporaryPhoneNumber* m_pDialNumber ; - bool m_isConference ; Call::State m_CurrentState ; bool m_Recording ; InstantMessagingModel* m_pImModel ; @@ -398,6 +397,7 @@ private: bool m_History ; bool m_Missed ; Call::Direction m_Direction ; + Call::Type m_Type ; AbstractHistoryBackend* m_pBackend ; //Cache diff --git a/src/callmodel.cpp b/src/callmodel.cpp index 1c136df95bf77f7fdff8d53fc639486ded53d7d2..43ee7c6f9a05650f08e07d0f23b80c95b67ce0ee 100644 --- a/src/callmodel.cpp +++ b/src/callmodel.cpp @@ -160,7 +160,6 @@ void CallModel::initRoles() roles.insert(Call::Role::Department ,QByteArray("department")); roles.insert(Call::Role::Email ,QByteArray("email")); roles.insert(Call::Role::Organisation ,QByteArray("organisation")); - roles.insert(Call::Role::IsConference ,QByteArray("isConference")); roles.insert(Call::Role::Object ,QByteArray("object")); roles.insert(Call::Role::PhotoPtr ,QByteArray("photoPtr")); roles.insert(Call::Role::CallState ,QByteArray("callState")); @@ -401,7 +400,7 @@ void CallModel::removeCall(Call* call, bool noEmit) //The daemon often fail to emit the right signal, cleanup manually foreach(InternalStruct* topLevel, m_lInternalModel) { - if (topLevel->call_real->isConference() && + if (topLevel->call_real->type() == Call::Type::CONFERENCE && (!topLevel->m_lChildren.size() //HACK Make a simple validation to prevent ERROR->ERROR->ERROR state loop for conferences || topLevel->m_lChildren.first()->call_real->state() == Call::State::ERROR @@ -528,8 +527,8 @@ bool CallModel::createConferenceFromCall(Call* call1, Call* call2) ///Add a new participant to a conference bool CallModel::addParticipant(Call* call2, Call* conference) { - if (conference->isConference()) { - Q_NOREPLY DBus::CallManager::instance().addParticipant(call2->id(), conference->confId()); + if (conference->type() == Call::Type::CONFERENCE) { + Q_NOREPLY DBus::CallManager::instance().addParticipant(call2->id(), conference->id()); return true; } else { @@ -548,7 +547,7 @@ bool CallModel::detachParticipant(Call* call) ///Merge two conferences bool CallModel::mergeConferences(Call* conf1, Call* conf2) { - Q_NOREPLY DBus::CallManager::instance().joinConference(conf1->confId(),conf2->confId()); + Q_NOREPLY DBus::CallManager::instance().joinConference(conf1->id(),conf2->id()); return true; } @@ -669,12 +668,12 @@ int CallModel::rowCount( const QModelIndex& parentIdx ) const const InternalStruct* modelItem = static_cast<InternalStruct*>(parentIdx.internalPointer()); if (modelItem) { - if (modelItem->call_real->isConference() && modelItem->m_lChildren.size() > 0) + if (modelItem->call_real->type() == Call::Type::CONFERENCE && modelItem->m_lChildren.size() > 0) return modelItem->m_lChildren.size(); - else if (modelItem->call_real->isConference()) + else if (modelItem->call_real->type() == Call::Type::CONFERENCE) qWarning() << modelItem->call_real << "have" << modelItem->m_lChildren.size() << "and" - << (modelItem->call_real->isConference()?"is":"is not") << "a conference"; + << ((modelItem->call_real->type() == Call::Type::CONFERENCE)?"is":"is not") << "a conference"; } return 0; } @@ -684,10 +683,16 @@ Qt::ItemFlags CallModel::flags( const QModelIndex& idx ) const { if (!idx.isValid()) return Qt::NoItemFlags; - return Qt::ItemIsEnabled|Qt::ItemIsSelectable - | Qt::ItemIsDragEnabled - | ((!idx.data(Call::Role::IsConference).toBool())?(Qt::ItemIsDropEnabled):Qt::ItemIsEnabled) - | ((idx.data(Call::Role::CallState) == static_cast<int>(Call::State::DIALING))?Qt::ItemIsEditable:Qt::NoItemFlags); + + const InternalStruct* modelItem = static_cast<InternalStruct*>(idx.internalPointer()); + if (modelItem ) { + const Call* c = modelItem->call_real; + return Qt::ItemIsEnabled|Qt::ItemIsSelectable + | Qt::ItemIsDragEnabled + | ((c->type() != Call::Type::CONFERENCE)?(Qt::ItemIsDropEnabled):Qt::ItemIsEnabled) + | ((c->state() == Call::State::DIALING)?Qt::ItemIsEditable:Qt::NoItemFlags); + } + return Qt::NoItemFlags; } ///Return valid payload types @@ -701,7 +706,7 @@ int CallModel::columnCount ( const QModelIndex& parentIdx) const { const InternalStruct* modelItem = static_cast<InternalStruct*>(parentIdx.internalPointer()); if (modelItem) { - return modelItem->call_real->isConference()?1:0; + return (modelItem->call_real->type() == Call::Type::CONFERENCE)?1:0; } else if (parentIdx.isValid()) return 0; @@ -803,22 +808,22 @@ bool CallModel::dropMimeData(const QMimeData* mimedata, Qt::DropAction action, i return false; } //Conference dropped on a conference -> merge both conferences - else if (call && target && call->isConference() && target->isConference()) { - qDebug() << "Merge conferences" << call->confId() << "and" << target->confId(); + else if (call && target && call->type() == Call::Type::CONFERENCE && target->type() == Call::Type::CONFERENCE) { + qDebug() << "Merge conferences" << call->id() << "and" << target->id(); mergeConferences(call,target); return true; } //Conference dropped on a call part of a conference -> merge both conferences - else if (call && call->isConference() && targetIdx.parent().isValid()) { - qDebug() << "Merge conferences" << call->confId() << "and" << targetIdx.parent().data(Call::Role::Id).toString(); + else if (call && call->type() == Call::Type::CONFERENCE && targetIdx.parent().isValid()) { + qDebug() << "Merge conferences" << call->id() << "and" << targetIdx.parent().data(Call::Role::Id).toString(); mergeConferences(call,getCall(targetIdx.parent())); return true; } //Drop a call on a conference -> add it to the conference - else if (target && (targetIdx.parent().isValid() || target->isConference())) { - Call* conf = target->isConference()?target:qvariant_cast<Call*>(targetIdx.parent().data(Call::Role::Object)); + else if (target && (targetIdx.parent().isValid() || target->type() == Call::Type::CONFERENCE)) { + Call* conf = target->type() == Call::Type::CONFERENCE?target:qvariant_cast<Call*>(targetIdx.parent().data(Call::Role::Object)); if (conf) { - qDebug() << "Adding call " << call->id() << "to conference" << conf->confId(); + qDebug() << "Adding call " << call->id() << "to conference" << conf->id(); addParticipant(call,conf); return true; } @@ -994,7 +999,7 @@ void CallModel::slotChangingConference(const QString &confID, const QString& sta //The daemon often fail to emit the right signal, cleanup manually foreach(InternalStruct* topLevel, m_lInternalModel) { - if (topLevel->call_real->isConference() && !topLevel->m_lChildren.size()) { + if (topLevel->call_real->type() == Call::Type::CONFERENCE && !topLevel->m_lChildren.size()) { removeConference(topLevel->call_real); } } @@ -1007,7 +1012,7 @@ void CallModel::slotChangingConference(const QString &confID, const QString& sta if (callInt) { const QString confId = callDetails[Call::DetailsMapFields::CONF_ID]; if (callInt->m_pParent) { - if (!confId.isEmpty() && callInt->m_pParent->call_real->confId() != confId) { + if (!confId.isEmpty() && callInt->m_pParent->call_real->id() != confId) { qWarning() << "Conference parent mismatch"; } else if (confId.isEmpty() ){ @@ -1018,7 +1023,8 @@ void CallModel::slotChangingConference(const QString &confID, const QString& sta else if (!confId.isEmpty()) { qWarning() << "Found an orphan call"; InternalStruct* confInt2 = m_sPrivateCallList_callId[confId]; - if (confInt2 && confInt2->call_real->isConference() && !callInt->call_real->isConference()) { + if (confInt2 && confInt2->call_real->type() == Call::Type::CONFERENCE + && (callInt->call_real->type() != Call::Type::CONFERENCE)) { removeInternal(callInt); if (confInt2->m_lChildren.indexOf(callInt) == -1) confInt2->m_lChildren << callInt; diff --git a/src/historymodel.cpp b/src/historymodel.cpp index 10e73bf7baa62ef88eef351d69da70988f0f31fe..2fd0370e6be249c9b5b7efe5b1e847fea231310c 100644 --- a/src/historymodel.cpp +++ b/src/historymodel.cpp @@ -120,7 +120,6 @@ HistoryModel::HistoryModel():QAbstractItemModel(QCoreApplication::instance()),m_ roles.insert(Call::Role::Department ,QByteArray("department" )); roles.insert(Call::Role::Email ,QByteArray("email" )); roles.insert(Call::Role::Organisation ,QByteArray("organisation" )); - roles.insert(Call::Role::IsConference ,QByteArray("isConference" )); roles.insert(Call::Role::Object ,QByteArray("object" )); roles.insert(Call::Role::PhotoPtr ,QByteArray("photoPtr" )); roles.insert(Call::Role::CallState ,QByteArray("callState" )); diff --git a/src/instantmessagingmodel.cpp b/src/instantmessagingmodel.cpp index 3c30d654b1f18beb373e2fe1aa11929c7ef4b951..d0161881ce872a4eb5c7b3c8cc73e2d33c423c68 100644 --- a/src/instantmessagingmodel.cpp +++ b/src/instantmessagingmodel.cpp @@ -64,7 +64,7 @@ void InstantMessagingModelManager::newMessage(QString callId, QString from, QStr ///Singleton InstantMessagingModel* InstantMessagingModelManager::getModel(Call* call) { - const QString key = call->isConference()?call->confId():call->id(); + const QString key = call->id(); if (!m_lModels[key]) { m_lModels[key] = new InstantMessagingModel(call); emit newMessagingModel(call,m_lModels[key]);