mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-23 14:48:15 +00:00
- remove useless smart-search-bar from cpp - create a new `SipAddressesModel` component - create a `UnregisteredSipAddressesModel` (it uses the previous model) - `TimelineModel` uses too this model - many fixes and refactoring - `mapToSipAddress` moved from `ContactsListModel` to `SipAddressesModel` - ...
35 lines
1.3 KiB
C++
35 lines
1.3 KiB
C++
#include "../../app/App.hpp"
|
|
|
|
#include "ContactModel.hpp"
|
|
|
|
using namespace std;
|
|
|
|
// =============================================================================
|
|
|
|
ContactModel::ContactModel (shared_ptr<linphone::Friend> linphone_friend) {
|
|
m_linphone_friend = linphone_friend;
|
|
m_vcard = make_shared<VcardModel>(linphone_friend->getVcard());
|
|
|
|
App::getInstance()->getEngine()->setObjectOwnership(m_vcard.get(), QQmlEngine::CppOwnership);
|
|
QObject::connect(m_vcard.get(), &VcardModel::vcardUpdated, this, &ContactModel::contactUpdated);
|
|
}
|
|
|
|
ContactModel::ContactModel (VcardModel *vcard) {
|
|
QQmlEngine *engine = App::getInstance()->getEngine();
|
|
if (engine->objectOwnership(vcard) == QQmlEngine::CppOwnership)
|
|
throw std::invalid_argument("A contact is already linked to this vcard.");
|
|
|
|
m_linphone_friend = linphone::Friend::newFromVcard(vcard->m_vcard);
|
|
m_vcard.reset(vcard);
|
|
|
|
engine->setObjectOwnership(vcard, QQmlEngine::CppOwnership);
|
|
QObject::connect(vcard, &VcardModel::vcardUpdated, this, &ContactModel::contactUpdated);
|
|
}
|
|
|
|
Presence::PresenceStatus ContactModel::getPresenceStatus () const {
|
|
return Presence::PresenceStatus::Offline;
|
|
}
|
|
|
|
Presence::PresenceLevel ContactModel::getPresenceLevel () const {
|
|
return Presence::getPresenceLevel(getPresenceStatus());
|
|
}
|