Commit 7e13551c authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app): little fixes

parent 8240c265
...@@ -40,7 +40,7 @@ QHash<int, QByteArray> ContactsListModel::roleNames () const { ...@@ -40,7 +40,7 @@ QHash<int, QByteArray> ContactsListModel::roleNames () const {
QVariant ContactsListModel::data (const QModelIndex &index, int role) const { QVariant ContactsListModel::data (const QModelIndex &index, int role) const {
int row = index.row(); int row = index.row();
if (row < 0 || row >= m_list.count()) if (!index.isValid() || row < 0 || row >= m_list.count())
return QVariant(); return QVariant();
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
// ============================================================================= // =============================================================================
class ContactsListModel : public QAbstractListModel { class ContactsListModel : public QAbstractListModel {
friend class ContactsListProxyModel;
friend class SipAddressesModel; friend class SipAddressesModel;
Q_OBJECT; Q_OBJECT;
......
...@@ -32,13 +32,7 @@ const QRegExp ContactsListProxyModel::m_search_separators("^[^_.-;@ ][_.-;@ ]"); ...@@ -32,13 +32,7 @@ const QRegExp ContactsListProxyModel::m_search_separators("^[^_.-;@ ][_.-;@ ]");
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
ContactsListProxyModel::ContactsListProxyModel (QObject *parent) : QSortFilterProxyModel(parent) { ContactsListProxyModel::ContactsListProxyModel (QObject *parent) : QSortFilterProxyModel(parent) {
m_list = CoreManager::getInstance()->getContactsListModel(); setSourceModel(CoreManager::getInstance()->getContactsListModel());
setSourceModel(m_list);
for (const ContactModel *contact : m_list->m_list)
m_weights[contact] = 0;
sort(0); sort(0);
} }
......
...@@ -39,7 +39,6 @@ private: ...@@ -39,7 +39,6 @@ private:
void setConnectedFilter (bool use_connected_filter); void setConnectedFilter (bool use_connected_filter);
ContactsListModel *m_list;
QString m_filter; QString m_filter;
bool m_use_connected_filter = false; bool m_use_connected_filter = false;
......
...@@ -82,7 +82,7 @@ QHash<int, QByteArray> SipAddressesModel::roleNames () const { ...@@ -82,7 +82,7 @@ QHash<int, QByteArray> SipAddressesModel::roleNames () const {
QVariant SipAddressesModel::data (const QModelIndex &index, int role) const { QVariant SipAddressesModel::data (const QModelIndex &index, int role) const {
int row = index.row(); int row = index.row();
if (row < 0 || row >= m_refs.count()) if (!index.isValid() || row < 0 || row >= m_refs.count())
return QVariant(); return QVariant();
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
......
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