feat(app): little fixes

This commit is contained in:
Ronan Abhamon 2016-12-23 14:37:05 +01:00
parent 8240c265e3
commit 7e13551cab
5 changed files with 3 additions and 11 deletions

View file

@ -40,7 +40,7 @@ QHash<int, QByteArray> ContactsListModel::roleNames () const {
QVariant ContactsListModel::data (const QModelIndex &index, int role) const {
int row = index.row();
if (row < 0 || row >= m_list.count())
if (!index.isValid() || row < 0 || row >= m_list.count())
return QVariant();
if (role == Qt::DisplayRole)

View file

@ -9,7 +9,6 @@
// =============================================================================
class ContactsListModel : public QAbstractListModel {
friend class ContactsListProxyModel;
friend class SipAddressesModel;
Q_OBJECT;

View file

@ -32,13 +32,7 @@ const QRegExp ContactsListProxyModel::m_search_separators("^[^_.-;@ ][_.-;@ ]");
// -----------------------------------------------------------------------------
ContactsListProxyModel::ContactsListProxyModel (QObject *parent) : QSortFilterProxyModel(parent) {
m_list = CoreManager::getInstance()->getContactsListModel();
setSourceModel(m_list);
for (const ContactModel *contact : m_list->m_list)
m_weights[contact] = 0;
setSourceModel(CoreManager::getInstance()->getContactsListModel());
sort(0);
}

View file

@ -39,7 +39,6 @@ private:
void setConnectedFilter (bool use_connected_filter);
ContactsListModel *m_list;
QString m_filter;
bool m_use_connected_filter = false;

View file

@ -82,7 +82,7 @@ QHash<int, QByteArray> SipAddressesModel::roleNames () const {
QVariant SipAddressesModel::data (const QModelIndex &index, int role) const {
int row = index.row();
if (row < 0 || row >= m_refs.count())
if (!index.isValid() || row < 0 || row >= m_refs.count())
return QVariant();
if (role == Qt::DisplayRole)