Merge pull request 'search contact list' (#366) from dan/ui:contactSearch into master
the build was successful Details

Reviewed-on: #366
This commit is contained in:
erinn 2020-11-13 16:50:04 -08:00
commit 1c463f235c
1 changed files with 11 additions and 3 deletions

View File

@ -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)
}
}
}