search contact list #366
|
@ -28,6 +28,10 @@ ColumnLayout {
|
|||
id: myprof
|
||||
}
|
||||
|
||||
function filterContact(displayName, handle) {
|
||||
return searchAddText.text == "" || displayName.toLowerCase().includes(searchAddText.text.toLowerCase()) || handle.toLowerCase().startsWith(searchAddText.text.toLowerCase())
|
||||
}
|
||||
|
||||
function removeContact(model, handle) {
|
||||
for(var i = 0; i < model.count; i++){
|
||||
if(model.get(i)["_handle"] == handle) {
|
||||
|
@ -50,16 +54,17 @@ ColumnLayout {
|
|||
|
||||
|
||||
//: ex: "... paste an address here to add a contact ..."
|
||||
placeholderText: qsTr("paste-address-to-add-contact")
|
||||
//placeholderText: qsTr("paste-address-to-add-contact")
|
||||
horizontalAlignment: TextInput.AlignHCenter
|
||||
icon: gcd.assetPath + "core/search-24px.svg"
|
||||
|
||||
|
||||
onTextChanged: {
|
||||
if (text != "") {
|
||||
// TODO: detect peer or group address and insert a contactRow that asks to add the corresponding group or peer
|
||||
/*if (text != "") {
|
||||
gcd.importString(text)
|
||||
text = ""
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,6 +93,7 @@ ColumnLayout {
|
|||
model = blockedContactsModel
|
||||
}
|
||||
|
||||
// If contact already in model, skip
|
||||
for (var i = 0; i < model.count; i++) {
|
||||
if (model.get(i)["_handle"] == handle) {
|
||||
return
|
||||
|
@ -166,6 +172,7 @@ ColumnLayout {
|
|||
loading: _loading
|
||||
rowColor: (_authorization == Const.auth_unknown) ? Theme.backgroundHilightElementColor : Theme.backgroundMainColor
|
||||
Layout.fillWidth: true
|
||||
visible: filterContact(displayName, handle)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,6 +282,7 @@ ColumnLayout {
|
|||
authorization: _authorization
|
||||
loading: _loading
|
||||
Layout.fillWidth: true
|
||||
visible: filterContact(displayName, handle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue