Commit ceef883d authored by Ronan's avatar Ronan
Browse files

fix(ui/views/App/MainWindow/Contacts): $contact was undefined in some cases

parent 31321a4d
......@@ -7,8 +7,8 @@
#include "ContactsListProxyModel.hpp"
#define USERNAME_WEIGHT 50.0
#define MAIN_SIP_ADDRESS_WEIGHT 30.0
#define OTHER_SIP_ADDRESSES_WEIGHT 20.0
#define MAIN_SIP_ADDRESS_WEIGHT 25.0
#define OTHER_SIP_ADDRESSES_WEIGHT 25.0
#define FACTOR_POS_1 0.90
#define FACTOR_POS_2 0.80
......@@ -44,6 +44,7 @@ ContactsListProxyModel::ContactsListProxyModel (QObject *parent) : QSortFilterPr
for (const ContactModel *contact : m_list->m_list)
m_weights[contact] = 0;
setDynamicSortFilter(false);
sort(0);
}
......
......@@ -24,6 +24,12 @@ public:
return m_list;
}
public slots:
void setFilter (const QString &pattern) {
setFilterFixedString(pattern);
sort(0);
}
protected:
bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const;
bool lessThan (const QModelIndex &left, const QModelIndex &right) const;
......
......@@ -10,21 +10,6 @@ import App.Styles 1.0
// ===================================================================
ColumnLayout {
function _filter (text) {
Utils.assert(
contacts.setFilterFixedString != null,
'`contacts.setFilterFixedString` must be defined.'
)
Utils.assert(
contacts.invalidate != null,
'`contacts.invalidate` must be defined.'
)
contacts.setFilterFixedString(text)
contacts.invalidate()
}
function _removeContact (contact) {
Utils.openConfirmDialog(window, {
descriptionText: qsTr('removeContactDescription'),
......@@ -62,7 +47,7 @@ ColumnLayout {
icon: 'filter'
placeholderText: qsTr('searchContactPlaceholder')
onTextChanged: _filter(text)
onTextChanged: contacts.setFilter(text)
}
ExclusiveButtons {
......@@ -71,7 +56,7 @@ ColumnLayout {
qsTr('selectConnectedContacts')
]
onClicked: contacts.useConnectedFilter = (button === 1)
onClicked: contacts.useConnectedFilter = !!button
}
TextButtonB {
......
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