Commit dd09e6d3 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(app): coding style

parent 0310ccb6
...@@ -39,6 +39,8 @@ ContactModel::ContactModel (shared_ptr<linphone::Friend> linphone_friend) { ...@@ -39,6 +39,8 @@ ContactModel::ContactModel (shared_ptr<linphone::Friend> linphone_friend) {
} }
ContactModel::ContactModel (VcardModel *vcard) { ContactModel::ContactModel (VcardModel *vcard) {
Q_ASSERT(vcard != nullptr);
QQmlEngine *engine = App::getInstance()->getEngine(); QQmlEngine *engine = App::getInstance()->getEngine();
if (engine->objectOwnership(vcard) == QQmlEngine::CppOwnership) if (engine->objectOwnership(vcard) == QQmlEngine::CppOwnership)
throw invalid_argument("A contact is already linked to this vcard."); throw invalid_argument("A contact is already linked to this vcard.");
...@@ -49,8 +51,11 @@ ContactModel::ContactModel (VcardModel *vcard) { ...@@ -49,8 +51,11 @@ ContactModel::ContactModel (VcardModel *vcard) {
engine->setObjectOwnership(vcard, QQmlEngine::CppOwnership); engine->setObjectOwnership(vcard, QQmlEngine::CppOwnership);
} }
void ContactModel::presenceReceived () { void ContactModel::refreshPresence () {
Presence::PresenceStatus status = static_cast<Presence::PresenceStatus>(m_linphone_friend->getConsolidatedPresence()); Presence::PresenceStatus status = static_cast<Presence::PresenceStatus>(
m_linphone_friend->getConsolidatedPresence()
);
emit presenceStatusChanged(status); emit presenceStatusChanged(status);
emit presenceLevelChanged(Presence::getPresenceLevel(status)); emit presenceLevelChanged(Presence::getPresenceLevel(status));
} }
......
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
return m_vcard; return m_vcard;
} }
void presenceReceived (); void refreshPresence ();
Q_INVOKABLE void startEdit (); Q_INVOKABLE void startEdit ();
Q_INVOKABLE void endEdit (); Q_INVOKABLE void endEdit ();
......
...@@ -69,12 +69,11 @@ void CoreHandlers::onMessageReceived ( ...@@ -69,12 +69,11 @@ void CoreHandlers::onMessageReceived (
void CoreHandlers::onNotifyPresenceReceivedForUriOrTel ( void CoreHandlers::onNotifyPresenceReceivedForUriOrTel (
const shared_ptr<linphone::Core> &, const shared_ptr<linphone::Core> &,
const shared_ptr<linphone::Friend> &lf, const shared_ptr<linphone::Friend> &linphone_friend,
const string &, const string &,
const shared_ptr<linphone::PresenceModel> & const shared_ptr<linphone::PresenceModel> &
) { ) {
ContactModel *contact_model = &lf->getData<ContactModel>("contact-model"); linphone_friend->getData<ContactModel>("contact-model").refreshPresence();
contact_model->presenceReceived();
} }
void CoreHandlers::onRegistrationStateChanged ( void CoreHandlers::onRegistrationStateChanged (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment