Commit 25b69259 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(app): little fixes & coding style

parent a7f626e3
...@@ -45,9 +45,7 @@ public: ...@@ -45,9 +45,7 @@ public:
public slots: public slots:
void loadMoreEntries (); void loadMoreEntries ();
void setEntryTypeFilter (ChatModel::EntryType type); void setEntryTypeFilter (ChatModel::EntryType type);
void removeEntry (int id); void removeEntry (int id);
void removeAllEntries () { void removeAllEntries () {
......
...@@ -17,7 +17,7 @@ ContactModel::ContactModel (shared_ptr<linphone::Friend> linphone_friend) { ...@@ -17,7 +17,7 @@ ContactModel::ContactModel (shared_ptr<linphone::Friend> linphone_friend) {
ContactModel::ContactModel (VcardModel *vcard) { ContactModel::ContactModel (VcardModel *vcard) {
QQmlEngine *engine = App::getInstance()->getEngine(); QQmlEngine *engine = App::getInstance()->getEngine();
if (engine->objectOwnership(vcard) == QQmlEngine::CppOwnership) if (engine->objectOwnership(vcard) == QQmlEngine::CppOwnership)
throw std::invalid_argument("A contact is already linked to this vcard."); throw invalid_argument("A contact is already linked to this vcard.");
m_linphone_friend = linphone::Friend::newFromVcard(vcard->m_vcard); m_linphone_friend = linphone::Friend::newFromVcard(vcard->m_vcard);
m_vcard.reset(vcard); m_vcard.reset(vcard);
......
#ifndef CORE_MANAGER_H_ #ifndef CORE_MANAGER_H_
#define CORE_MANAGER_H_ #define CORE_MANAGER_H_
#include "../contact/VcardModel.hpp"
#include "../contacts/ContactsListModel.hpp" #include "../contacts/ContactsListModel.hpp"
#include "../sip-addresses/SipAddressesModel.hpp" #include "../sip-addresses/SipAddressesModel.hpp"
......
...@@ -35,18 +35,16 @@ void SmartSearchBarModel::setFilter (const QString &pattern) { ...@@ -35,18 +35,16 @@ void SmartSearchBarModel::setFilter (const QString &pattern) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool SmartSearchBarModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const { bool SmartSearchBarModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const {
const QModelIndex index = sourceModel()->index(source_row, 0, source_parent); const QModelIndex &index = sourceModel()->index(source_row, 0, source_parent);
const QVariantMap map = index.data().toMap(); return computeStringWeight(index.data().toMap()["sipAddress"].toString()) > 0;
return computeStringWeight(map["sipAddress"].toString()) > 0;
} }
bool SmartSearchBarModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { bool SmartSearchBarModel::lessThan (const QModelIndex &left, const QModelIndex &right) const {
const QVariantMap map_a = sourceModel()->data(left).toMap(); const QVariantMap &map_a = sourceModel()->data(left).toMap();
const QVariantMap map_b = sourceModel()->data(right).toMap(); const QVariantMap &map_b = sourceModel()->data(right).toMap();
const QString sip_address_a = map_a["sipAddress"].toString(); const QString &sip_address_a = map_a["sipAddress"].toString();
const QString sip_address_b = map_b["sipAddress"].toString(); const QString &sip_address_b = map_b["sipAddress"].toString();
int weight_a = computeStringWeight(sip_address_a); int weight_a = computeStringWeight(sip_address_a);
int weight_b = computeStringWeight(sip_address_b); int weight_b = computeStringWeight(sip_address_b);
......
...@@ -18,15 +18,10 @@ QHash<int, QByteArray> TimelineModel::roleNames () const { ...@@ -18,15 +18,10 @@ QHash<int, QByteArray> TimelineModel::roleNames () const {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool TimelineModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const { bool TimelineModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const {
const QModelIndex index = sourceModel()->index(source_row, 0, source_parent); const QModelIndex &index = sourceModel()->index(source_row, 0, source_parent);
const QVariantMap map = index.data().toMap(); return index.data().toMap().contains("timestamp");
return map.contains("timestamp");
} }
bool TimelineModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { bool TimelineModel::lessThan (const QModelIndex &left, const QModelIndex &right) const {
const QVariantMap sip_address_a = sourceModel()->data(left).toMap(); return sourceModel()->data(left).toMap()["timestamp"] > sourceModel()->data(right).toMap()["timestamp"];
const QVariantMap sip_address_b = sourceModel()->data(right).toMap();
return sip_address_a["timestamp"] > sip_address_b["timestamp"];
} }
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