mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-31 10:59:23 +00:00
not stable, crash with mapSipAddressToContact
This commit is contained in:
parent
a20c32affd
commit
e6c4550305
5 changed files with 16 additions and 9 deletions
|
|
@ -11,8 +11,10 @@ ContactsListModel::ContactsListModel (QObject *parent): QAbstractListModel(paren
|
|||
shared_ptr<linphone::Core> core(CoreManager::getInstance()->getCore());
|
||||
|
||||
// Init contacts with linphone friends list.
|
||||
for (auto&& contact : core->getFriendsLists().front()->getFriends()) {
|
||||
m_list << new ContactModel(contact);
|
||||
for (const auto &friend_ : core->getFriendsLists().front()->getFriends()) {
|
||||
ContactModel *contact = new ContactModel(friend_);
|
||||
m_friend_to_contact[friend_.get()] = contact;
|
||||
m_list << contact;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -37,5 +39,9 @@ QVariant ContactsListModel::data (const QModelIndex &index, int role) const {
|
|||
// -------------------------------------------------------------------
|
||||
|
||||
ContactModel *ContactsListModel::mapSipAddressToContact (const QString &sipAddress) {
|
||||
return ContactsListProxyModel::getContactsListModel()->m_list.front();
|
||||
return m_friend_to_contact[
|
||||
CoreManager::getInstance()->getCore()->getFriendsLists().front()->findFriendByUri(
|
||||
sipAddress.toStdString()
|
||||
).get()
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,11 @@ public:
|
|||
QVariant data (const QModelIndex &index, int role) const;
|
||||
|
||||
public slots:
|
||||
static ContactModel *mapSipAddressToContact (const QString &sipAddress);
|
||||
ContactModel *mapSipAddressToContact (const QString &sipAddress);
|
||||
|
||||
private:
|
||||
QList<ContactModel *> m_list;
|
||||
QHash<linphone::Friend *, ContactModel* > m_friend_to_contact;
|
||||
};
|
||||
|
||||
#endif // CONTACTS_LIST_MODEL_H
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel &contact)
|
|||
const list<shared_ptr<linphone::Address> > addresses =
|
||||
contact.m_linphone_friend->getAddresses();
|
||||
|
||||
auto&& it = addresses.cbegin();
|
||||
auto it = addresses.cbegin();
|
||||
|
||||
// It exists at least one sip address.
|
||||
weight += computeStringWeight(
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ TimelineModel::TimelineModel (QObject *parent): QAbstractListModel(parent) {
|
|||
shared_ptr<linphone::Core> core(CoreManager::getInstance()->getCore());
|
||||
|
||||
// Insert chat rooms events.
|
||||
for (auto&& chat_room : core->getChatRooms()) {
|
||||
for (const auto &chat_room : core->getChatRooms()) {
|
||||
list<shared_ptr<linphone::ChatMessage> > history = chat_room->getHistory(0);
|
||||
|
||||
if (history.size() == 0)
|
||||
|
|
@ -50,7 +50,7 @@ TimelineModel::TimelineModel (QObject *parent): QAbstractListModel(parent) {
|
|||
|
||||
// Insert calls events.
|
||||
QHash<QString, bool> address_done;
|
||||
for (auto&& call_log : core->getCallLogs()) {
|
||||
for (const auto &call_log : core->getCallLogs()) {
|
||||
// Get a sip uri to check.
|
||||
QString address = Utils::linphoneStringToQString(
|
||||
call_log->getRemoteAddress()->asString()
|
||||
|
|
@ -69,7 +69,7 @@ TimelineModel::TimelineModel (QObject *parent): QAbstractListModel(parent) {
|
|||
map["sipAddresses"] = address;
|
||||
|
||||
// Search existing entry.
|
||||
auto&& it = find_if(
|
||||
auto it = find_if(
|
||||
m_entries.begin(), m_entries.end(), [&address](const QVariantMap &map) {
|
||||
return address == map["sipAddresses"].toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ ColumnLayout {
|
|||
|
||||
delegate: Item {
|
||||
property var contact: ContactsListModel.mapSipAddressToContact(
|
||||
$timelineEntry
|
||||
$timelineEntry.sipAddresses
|
||||
)
|
||||
|
||||
height: TimelineStyle.contact.height
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue