mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Handle CallLog updates
This commit is contained in:
parent
6f08430661
commit
2fdddf942f
2 changed files with 17 additions and 6 deletions
|
|
@ -90,12 +90,8 @@ void CallHistoryList::setSelf(QSharedPointer<CallHistoryList> me) {
|
|||
});
|
||||
if (oldLog == mList.end()) { // New
|
||||
prepend(*callLogs);
|
||||
} else { // Update
|
||||
qWarning() << log()
|
||||
.arg("LinphoneCore::onCallLogUpdated has been call for an existant log which "
|
||||
"should not be the "
|
||||
"case. Check with the SDK. CallID=%1")
|
||||
.arg((*callLogs)->mCallId);
|
||||
} else { // Update (status, duration, etc ...)
|
||||
replace(oldLog->objectCast<CallHistoryCore>(), *callLogs);
|
||||
}
|
||||
delete[] callLogs;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -116,6 +116,21 @@ public:
|
|||
virtual bool remove(QSharedPointer<QObject> itemToRemove) {
|
||||
return remove(itemToRemove.get());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void replace(QSharedPointer<T> itemToReplace, QSharedPointer<T> replacementItem) {
|
||||
lInfo() << QStringLiteral("Replacing ") << itemToReplace->metaObject()->className() << QStringLiteral(" : ")
|
||||
<< itemToReplace << " by " << replacementItem;
|
||||
int index = mList.indexOf(itemToReplace);
|
||||
if (index == -1) {
|
||||
lWarning() << QStringLiteral("Unable to replace ") << itemToReplace->metaObject()->className()
|
||||
<< QStringLiteral(" : ") << itemToReplace << " not found in list";
|
||||
return;
|
||||
}
|
||||
mList[index] = replacementItem;
|
||||
QModelIndex modelIndex = createIndex(index, 0);
|
||||
emit dataChanged(modelIndex, modelIndex, {Qt::DisplayRole});
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue