2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2020-06-13 13:49:20 +00:00
|
|
|
import "./samples/"
|
|
|
|
import "../../../../../imports"
|
|
|
|
import "../../../../../shared"
|
2020-06-17 21:54:03 +00:00
|
|
|
import "../../../Chat/components"
|
2020-06-18 13:54:08 +00:00
|
|
|
import "."
|
2020-06-13 13:49:20 +00:00
|
|
|
|
|
|
|
ListView {
|
2020-06-16 18:04:56 +00:00
|
|
|
id: contactList
|
2020-06-13 13:49:20 +00:00
|
|
|
property var contacts: ContactsData {}
|
2020-06-16 18:04:56 +00:00
|
|
|
property var selectable: true
|
2020-07-24 11:27:26 +00:00
|
|
|
property string searchStr: ""
|
2020-06-16 18:04:56 +00:00
|
|
|
property alias selectedContact: contactGroup.checkedButton
|
2020-07-21 21:03:22 +00:00
|
|
|
property string searchString: ""
|
|
|
|
property string lowerCaseSearchString: searchString.toLowerCase()
|
2020-06-13 13:49:20 +00:00
|
|
|
|
2020-07-21 21:03:22 +00:00
|
|
|
width: parent.width
|
2020-06-13 13:49:20 +00:00
|
|
|
|
|
|
|
model: contacts
|
|
|
|
delegate: Contact {
|
2020-08-07 19:26:51 +00:00
|
|
|
name: Utils.removeStatusEns(model.name)
|
2020-06-13 13:49:20 +00:00
|
|
|
address: model.address
|
|
|
|
identicon: model.identicon
|
2020-06-22 12:16:44 +00:00
|
|
|
isContact: model.isContact
|
2020-07-24 11:27:26 +00:00
|
|
|
isBlocked: model.isBlocked
|
2020-06-16 18:04:56 +00:00
|
|
|
selectable: contactList.selectable
|
2020-06-17 21:54:03 +00:00
|
|
|
profileClick: profilePopup.openPopup.bind(profilePopup)
|
2020-07-21 21:03:22 +00:00
|
|
|
visible: searchString === "" ||
|
|
|
|
model.name.toLowerCase().includes(lowerCaseSearchString) ||
|
|
|
|
model.address.toLowerCase().includes(lowerCaseSearchString)
|
2020-08-10 11:56:16 +00:00
|
|
|
onBlockContactActionTriggered: {
|
|
|
|
blockContactConfirmationDialog.contactName = name
|
|
|
|
blockContactConfirmationDialog.contactAddress = address
|
|
|
|
blockContactConfirmationDialog.open()
|
|
|
|
}
|
2020-08-10 12:15:57 +00:00
|
|
|
onRemoveContactActionTriggered: {
|
|
|
|
removeContactConfirmationDialog.contactAddress = address
|
|
|
|
removeContactConfirmationDialog.open()
|
|
|
|
}
|
2020-06-17 21:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ProfilePopup {
|
|
|
|
id: profilePopup
|
2020-08-10 11:56:16 +00:00
|
|
|
onBlockButtonClicked: {
|
|
|
|
blockContactConfirmationDialog.contactName = name
|
|
|
|
blockContactConfirmationDialog.contactAddress = address
|
|
|
|
blockContactConfirmationDialog.open()
|
|
|
|
}
|
2020-08-10 12:15:57 +00:00
|
|
|
onRemoveButtonClicked: {
|
|
|
|
removeContactConfirmationDialog.contactAddress = address
|
|
|
|
removeContactConfirmationDialog.open()
|
|
|
|
}
|
2020-06-16 18:04:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ButtonGroup {
|
|
|
|
id: contactGroup
|
2020-06-13 13:49:20 +00:00
|
|
|
}
|
2020-07-24 11:27:26 +00:00
|
|
|
|
2020-08-10 11:56:16 +00:00
|
|
|
BlockContactConfirmationDialog {
|
|
|
|
id: blockContactConfirmationDialog
|
|
|
|
onBlockButtonClicked: {
|
|
|
|
profileModel.blockContact(blockContactConfirmationDialog.contactAddress)
|
|
|
|
blockContactConfirmationDialog.close()
|
|
|
|
}
|
|
|
|
}
|
2020-08-10 12:15:57 +00:00
|
|
|
|
|
|
|
RemoveContactConfirmationDialog {
|
|
|
|
id: removeContactConfirmationDialog
|
|
|
|
onRemoveButtonClicked: {
|
|
|
|
if (profileModel.isAdded(removeContactConfirmationDialog.contactAddress)) {
|
|
|
|
profileModel.removeContact(removeContactConfirmationDialog.contactAddress)
|
|
|
|
}
|
|
|
|
removeContactConfirmationDialog.close()
|
|
|
|
}
|
|
|
|
}
|
2020-06-13 13:49:20 +00:00
|
|
|
}
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|